Re: [android-building] Vuilding AOSP (4.2.2) on Ubuntu 12.10 X64 Problem

541 views
Skip to first unread message

Magnus Bäck

unread,
May 3, 2013, 2:32:33 PM5/3/13
to android-...@googlegroups.com
On Friday, May 03, 2013 at 12:41 EDT,
Armin Aray <armi...@gmail.com> wrote:

> Hi, I'm trying to build AOSP (4.2.2) on Ubuntu 12.10 X64 and i get
> following error :

[...]

> /bin/bash: prebuilts/tools/gcc-sdk/g++: cannot execute binary file
> make: ***
> [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o]
> Error 126

In Android 4.2.2_r1.2, g++ should be a symlink to gcc and gcc a shell
script wrapper of the actual gcc executable. My first guess was that
your shell script is corrupt, probably empty, but trying to execute an
empty file should result in 'exec format error' and not 'cannot execute
binary file'. Anyway, inspect these files and make sure they're okay.

--
Magnus Bäck
ba...@google.com

Magnus Bäck

unread,
May 6, 2013, 11:00:20 AM5/6/13
to android-...@googlegroups.com
On Sunday, May 05, 2013 at 15:05 EDT,
Armin Aray <armi...@gmail.com> wrote:

> I symlink g++ to gcc and i got the same error !!

Yes, but what's state of the gcc file? As I said it should be a shell
script in 4.2.2. If it isn't your source directory is hosed. Until you
can start gcc by hand don't bother trying to get the Android build
working.

--
Magnus Bäck
ba...@google.com

Magnus Bäck

unread,
May 7, 2013, 1:20:28 PM5/7/13
to android-...@googlegroups.com
On Tuesday, May 07, 2013 at 02:33 EDT,
Sharmila Harsha <sharmila....@gmail.com> wrote:

> i also encountered the same error....
> it was a problem with version of GCC...
> i downgraded gcc 4.6 to gcc4.4
> then it was built successfull

Was it really this exact error? If so it's surprising given that the g++
binary that's being complained about is found in the prebuilt tree and
not on the host system.

--
Magnus Bäck
ba...@google.com

Magnus Bäck

unread,
May 7, 2013, 1:48:20 PM5/7/13
to android-...@googlegroups.com
On Tuesday, May 07, 2013 at 13:11 EDT,
Armin Aray <armi...@gmail.com> wrote:

> On Monday, May 6, 2013 7:30:20 PM UTC+4:30, Magnus Bäck wrote:
>
> > Yes, but what's state of the gcc file? As I said it should be a
> > shell script in 4.2.2. If it isn't your source directory is hosed.
> > Until you can start gcc by hand don't bother trying to get the
> > Android build working.
>
> Would you tell what to do in more details ?!

For AOSP 4.2.2 (android-4.2.2_r1.2) you should be able to replicate the
following sequence of commands (run from the source root directory):

$ cd prebuilts/tools/gcc-sdk
$ git rev-parse HEAD
bbf7c256c4f5261c20599ec2f0d4f9316cb226bd
$ ls -l gcc g++
lrwxrwxrwx 1 baeck eng 3 Jan 31 09:15 g++ -> gcc*
-rwxr-x--- 1 baeck eng 1447 May 7 13:40 gcc*
$ git ls-files -m
$ file gcc
gcc: Bourne-Again shell script, ASCII text executable
$ ./gcc
x86_64-linux-gcc: fatal error: no input files
compilation terminated.
$ uname -m
x86_64

Apart from the user and group part of the 'ls' output there shouldn't
be any differences. When you've posted that we might get more clues.

Judging by the error message emitted by bash it seems you actually have
a 32-bit system (despite the message subject) which is why I threw in
the last command.

--
Magnus Bäck
ba...@google.com

Magnus Bäck

unread,
May 9, 2013, 4:48:10 PM5/9/13
to android-...@googlegroups.com
On Wednesday, May 08, 2013 at 16:55 EDT,
Armin Aray <armi...@gmail.com> wrote:

> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ git rev-parse HEAD
> fatal: bad config file line 1 in .git/config

Not related to your build error, but do fix this.

> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ ls -l gcc g++
> -rwxrwxrwx 1 armin armin 20 Feb 27 00:08 g++
> -rwxrwxrwx 1 armin armin 1447 Feb 27 00:08 gcc
> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ git ls-files -m
> fatal: bad config file line 1 in .git/config
> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ file gcc
> gcc: Bourne-Again shell script, ASCII text executable
> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ ./gcc
> x86_64-linux-gcc: fatal error: no input files
> compilation terminated.
> armin@ubuntu:~/source/prebuilts/tools/gcc-sdk$ uname -m
> x86_64
>
> I'm using 64bit OS on a Dell L502-X. Thanks for your help. I really
> appreciate.

Hmm, I simply don't know why it can't run gcc during the build but is
able to from your shell. A couple of things to try:

- Add 'showcommands' to your make invocation to get the exact gcc
command that fails, then try to run that command from your shell.
- If you can compile the file from the shell but not via make, run
make under strace (possibly comparing to the successful invocation).

--
Magnus Bäck
ba...@google.com
Reply all
Reply to author
Forward
0 new messages