CoXier
CoXier

Reputation: 2663

Mac Illegal instruction : 4

I am building AOSP(Android Open Source Project) on MAC from doc and everything works fine although there is some problem which I can google to solve.

When I execute make, I got an error:

Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y

prebuilts/misc/darwin-x86/bison/bison -d -o out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y

make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Illegal instruction: 4

I have googled too much and I tried to install bison but it does not work for me.

Environment:

Mac SDK : 10.11
Mac OS  : 10.13
Android : 6.0.1
JDK     : 1.7
XCode   : 8.3
make    : 3.81

Can anyone help me ? Thanks in advance.

UPDATE

I also tried to downgrade XCode to 7.3.1 but it does not still work.

UPDATE for compatibility

file prebuilts/misc/darwin-x86/bison/bison
output : prebuilts/misc/darwin-x86/bison/bison: Mach-O executable i386

uname -a
output: root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

Upvotes: 3

Views: 4939

Answers (2)

nebulabox
nebulabox

Reputation: 430

https://groups.google.com/d/msg/android-building/D1-c5lZ9Oco/V9yPowRdCAAJ

cd /Volumes/AOSP/external/bison

git cherry-pick c0c852bd6fe462b148475476d9124fd740eba160
mm

Replace prebuilt bison binary with patched binary

cp /Volumes/AOSP/out/host/darwin-x86/bin/bison /Volumes/AOSP/prebuilts/misc/darwin-x86/bison/
Build

Upvotes: 0

user1658358
user1658358

Reputation:

I had the same problem. The bison executable was broken, so I installed bison with homebrew:

brew install bison

And then

sudo find / -name bison

Which gave me the path to the bison installation: /usr/bin/bison I removed the bison file from the AOSP:

sudo rm /Volumes/android/prebuilts/misc/darwin-x86/bison/bison

(Volumes/android/ is my working directory, the directory with aosp). Then I created a symbolic link to the bison installed with homebrew:

sudo ln -s /usr/bin/bison /Volumes/android/prebuilts/misc/darwin-x86/bison/bison

Upvotes: 1

Related Questions