Search code examples
androidandroid-sourceyacc

Error during Android build: iproute yacc issue


I get the error while building the AOSP source code: POSIX Yacc does not support %name-prefix [-Wyacc]

more detail:

   10 | %token-table
      | ^~~~~~~~~~~~
external/iproute2/tc/emp_ematch.y:11.1-14: warning: POSIX Yacc does not support %error-verbose [-Wyacc]
   11 | %error-verbose
      | ^~~~~~~~~~~~~~
external/iproute2/tc/emp_ematch.y:11.1-14: warning: deprecated directive: ‘%error-verbose’, use ‘%define parse.error verbose’ [-Wdeprecated]
   11 | %error-verbose
      | ^~~~~~~~~~~~~~
      | %define parse.error verbose
external/iproute2/tc/emp_ematch.y:12.14-22: warning: POSIX Yacc does not support string literals [-Wyacc]
   12 | %name-prefix "ematch_"
      |              ^~~~~~~~~
external/iproute2/tc/emp_ematch.y:12.1-22: warning: POSIX Yacc does not support %name-prefix  [-Wyacc]
   12 | %name-prefix "ematch_"
      | ^~~~~~~~~~~~~~~~~~~~~~
external/iproute2/tc/emp_ematch.y:12.1-22: warning: deprecated directive: ‘%name-prefix "ematch_"’, use ‘%define api.prefix {ematch_}’ [-Wdeprecated]
   12 | %name-prefix "ematch_"
      | ^~~~~~~~~~~~~~~~~~~~~~
      | %define api.prefix {ematch_}
12:13:00 ninja failed with: exit status 1

Solution

  • After a few hours, I found it was because of the m4 package that was not installed on my machine, The solution is just run:

    sudo apt install m4
    

    And continue to build.