3

I am trying to compile Cyanogenmod on Linux Mint 15. And receive the following error.

host StaticLib: libmincrypt (/home/benji/Source/out/host/linux-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/libmincrypt.a)
ERROR: prebuilts/tools/gcc-sdk/../../gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux-ar only run on 64-bit linux
make: *** [/home/benji/Source/out/host/linux-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/libmincrypt.a] Error 1
make: *** Waiting for unfinished jobs....
# In case value of PACKAGES is empty.

-

benji@ultranoid ~/Source/prebuilts/tools/gcc-sdk $ ./gcc
ERROR: ./../../gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux-gcc only run on 64-bit linux

I can't figure out what is causing this. I am on a 64 bit install. Please advise.

benji@ultranoid ~/Source $ uname -p
x86_64
bskool
  • 2,068
  • 2
  • 17
  • 24

3 Answers3

6

Workaround

Comment out lines 23-38 of prebuilts/tools/gcc-sdk/gcc

Example: http://pastebin.com/qH0BYcSF

bskool
  • 2,068
  • 2
  • 17
  • 24
  • yea commenting those check it worked for me...but i moved to ubuntu 10.04....its a best... – Jeegar Patel Jun 19 '13 at 07:00
  • Didn't you by mistake comment out line 37 "Otherwise, choose 32-bit" ? – Pointer Null Mar 25 '14 at 14:33
  • No, because I'm compiling in an x64 environment. Though you're right to a point. I should have left line 25 uncommented, but it still works fine with this workaround. So whatever. – bskool May 19 '14 at 21:38
4

As pointed out here, within Android build system the test for x32 vs x64 host is based on the output of file -L "$SHELL" | grep -q "x86[_-]64". In other words it tests whether or not current shell is a 64 bit binary.

So a possible answer is : check out if value of environmental variable $SHELL is a valid path to a shell executable.

  1. You may try to change shell with chsh or

  2. create a link to your favorite shell so that $SHELL is satisfied. The latter did the trick for me - I've simply linked /bin/bash to where $SHELL pointed.

ppiskors
  • 81
  • 4
  • 1
    I had a problem - having `shell bash` in my `~/.screenrc` caused problems. Full path (`shell /bin/bash`) fixed that. Thanks. – pevik Feb 06 '14 at 13:39
  • Obviously `SHELL` points to login shell (which in my case is actually a symlink to another symlink that points to the actual binary) and not to the parent shell i.e. the shell the build script was invoked from. – huoneusto Aug 19 '14 at 13:03
0

use uname -m to check system.

#file -L "$SHELL" | grep -q "x86[_-]64"

#if [ $? != 0 ]; then

# $SHELL is not a 64-bit executable, so assume our userland is too.

# echo "ERROR: $MY_TOOL only run on 64-bit linux"

# exit 1

#fi

changed to:

ARCH_OS=uname -m | tr '[:upper:]' '[:lower:]'

if [ "$ARCH_OS" != "x86_64" ] ; then
    echo "ERROR: $MY_TOOL only run on 64-bit linux from uname -m"
    exit 1
fi
jp1017
  • 81
  • 11