andreasgal / B2G

Boot to Gecko aims to create a complete, standalone operating system for the open web.
https://wiki.mozilla.org/B2G
907 stars 158 forks source link

C compiler cannot create executables #217

Open xophdware opened 12 years ago

xophdware commented 12 years ago

Hi, I cloned https://github.com/andreasgal/B2G.git and followed the instruction in INSTALL for the "Android Emulator" During "make" (last step) I am getting the following error:

$ make Adding client.mk options from /home/cdiehl/Mozilla/B2G/gecko/mozconfig: MOZ_OBJDIR=$(TOPSRCDIR)/objdir-prof-gonk MOZ_MAKE_FLAGS=-s -j16 cd /home/cdiehl/Mozilla/B2G/gecko/objdir-prof-gonk /home/cdiehl/Mozilla/B2G/gecko/configure Adding configure options from /home/cdiehl/Mozilla/B2G/gecko/mozconfig: --target=arm-android-eabi --with-gonk=/home/cdiehl/Mozilla/B2G/glue/gonk --with-endian=little --enable-application=b2g --disable-elf-hack --enable-debug-symbols --enable-profiling --with-ccache --enable-marionette --enable-omx-plugin loading cache ./config.cache checking host system type... x86_64-unknown-linux-gnu checking target system type... arm-android-eabi checking build system type... x86_64-unknown-linux-gnu checking for mawk... mawk checking for perl5... no checking for perl... /usr/bin/perl cross compiling from x86_64-unknown-linux-gnu to arm-android-eabi checking for host c compiler... checking for gcc... gcc gcc checking for host c++ compiler... checking for c++... c++ c++ checking for ranlib... no checking for ar... no checking whether the host c compiler (gcc ) works... yes checking whether the host c++ compiler (c++ ) works... yes checking for /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc... /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc checking for gcc... /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc checking whether the C compiler (/home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc -mandroid -fno-short-enums -fno-exceptions -mandroid -L/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib -Wl,-rpath-link=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib --sysroot=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/ -llog ) works... no configure: error: installation or configuration problem: C compiler cannot create executables. * Fix above errors and then restart with "make -f client.mk build" make[3]: * [configure] Error 1 make[2]: * [/home/cdiehl/Mozilla/B2G/gecko/objdir-prof-gonk/Makefile] Error 2 make[1]: * [build] Error 2 make: *\ [gecko] Error 2

$ cat gecko/objdir-prof-gonk/config.log This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake.

configure:1064: checking host system type configure:1085: checking target system type configure:1103: checking build system type configure:1183: checking for mawk configure:1424: checking for perl5 configure:1424: checking for perl configure:1809: checking for host c compiler configure:1815: checking for gcc configure:1850: checking for host c++ compiler configure:1856: checking for c++ configure:1908: checking for ranlib configure:1943: checking for ar configure:1978: checking whether the host c compiler (gcc ) works configure:1987: gcc -c -DANDROID -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/include/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/common -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/arch-arm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/arch-arm -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/opengl/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/native/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware_legacy/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/system/core/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/ndk/sources/cxx-stl/stlport/stlport/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/services/sensorservice conftest.c 1>&5 configure:2002: checking whether the host c++ compiler (c++ ) works configure:2011: c++ -c -DANDROID -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/include/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/common -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/arch-arm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/arch-arm -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/opengl/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/native/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware_legacy/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/system/core/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/ndk/sources/cxx-stl/stlport/stlport/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/services/sensorservice conftest.c 1>&5 configure:2031: checking for /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc configure:2065: checking for gcc configure:2178: checking whether the C compiler (/home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc -mandroid -fno-short-enums -fno-exceptions -mandroid -L/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib -Wl,-rpath-link=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib --sysroot=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/ -llog ) works configure:2194: /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc -o conftest -mandroid -fno-short-enums -fno-exceptions -DANDROID -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/include/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/common -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/arch-arm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libc/kernel/arch-arm -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic/libm/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/opengl/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/native/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/hardware/libhardware_legacy/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/system/core/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/bionic -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/include -I/home/cdiehl/Mozilla/B2G/glue/gonk/ndk/sources/cxx-stl/stlport/stlport/ -I/home/cdiehl/Mozilla/B2G/glue/gonk/frameworks/base/services/sensorservice -mandroid -L/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib -Wl,-rpath-link=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/lib --sysroot=/home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj/ -llog conftest.c -lstlport 1>&5 /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: error: cannot find -lc /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: error: cannot find -ldl /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: error: cannot find -llog /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: error: cannot find -lstlport /home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: /home/cdiehl/Mozilla/B2G/glue/gonk/out/target/product/generic/obj//lib/crtbegin_dynamic.o:(.text+0x10): error: undefined reference to '__libc_init' collect2: ld returned 1 exit status configure: failed program was:

line 2189 "configure"

include "confdefs.h"

I know there are already two reported bugs with the same isse but those were older and I was also not able to fix it with the described recommendation.

Thanks for any help.

philikon commented 12 years ago

Did you do "make gonk" first? The very first time you build, you need to do "make gonk" before "make".

xophdware commented 12 years ago

Yes, I did that.

notmasteryet commented 12 years ago

Same problem; steps before 'make' (just after git clone):

make sync
make config-qemu
make gonk
lemketron commented 12 years ago

This happened to me too. I wonder if there was some sort of parallel build dependency issue that caused something (like bionic) to not be ready which caused configure to think that the "C compiler cannot create executables".

In my case, repeating the "make sync" and "make config..." and "make gonk" worked the second time.

lloydchang commented 12 years ago

Hello xophdware, philikon, notmasteryet and lemketron:

To resolve this, it seems that we have two options...

Option 1: Consider switching to build B2G for QEMU Emulator

Its instructions are at https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko/Building_B2G_for_QEMU_Emulator

One good reason is because b2g-android official support stopped on December 25, 2011 via the announcement at http://groups.google.com/group/mozilla.dev.b2g/browse_thread/thread/bedc971a21b16a4f

Option 2: Continue trying to build for B2G for Android Emulator

In xophdware's log, it's reporting 'x86_64-unknown-linux-gnu' as in

checking host system type... x86_64-unknown-linux-gnu
checking target system type... arm-android-eabi
checking build system type... x86_64-unknown-linux-gnu

Yet xeophdware's computer is trying to execute a prebuilt binary at

/home/cdiehl/Mozilla/B2G/glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc

That armeabi-gcc is from Android Gingerbread 2.3 at https://github.com/mozilla-b2g/platform_prebuilt/tree/b2g-gingerbread-release/linux-x86/toolchain/arm-eabi-4.4.3/bin

Which is only compatible with 64-bit Ubuntu Linux 10.04 according to https://groups.google.com/group/android-building/msg/a91dcdc4825ef0db

Hence if you're using other Linux distributions or Ubuntu versions for your host system, that may explain the error message.

xophdware and notmasteryet, which specific Linux distribution, version and architecture are your host systems running?

Would you run uname -a and lsb_release -a in your shell prompts and paste their outputs? In order to continue trying option 2, you'll want to try using 64-bit (amd64 or x86_64) Ubuntu 10.04 for binary code compatibility with this specific prebuilt armeabi-gcc.

andresriancho commented 12 years ago

Got the same issue here and this is my output:

xyz@laptop:/B2G$ uname -a
Linux laptop 2.6.32-41-generic #88-Ubuntu SMP Thu Mar 29 13:10:32 UTC 2012 x86_64 GNU/Linux
xyz@laptop:/B2G$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04.4 LTS
Release:    10.04
Codename:   lucid

Also, this might be useful:

xyz@laptop:/B2G$ file glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
lloydchang commented 12 years ago

andresriancho, is your installation is using 64-bit userspace? You can check via dpkg --print-architecture. On your particular system: Ubuntu 10.04 with x86_64 kernel, try running sudo apt-get install ia32-libs before running glue/gonk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc. ia32-libs provide shared libraries for use on amd64 and ia64 systems; more info at http://packages.ubuntu.com/lucid/ia32-libs and should allow your 64-bit operating environment to run 32-bit executables such as gonk's prebuilt arm-eabi-gcc 32-bit executable

andresriancho commented 12 years ago

"dpkg --print-architecture" returns amd64 and "ia32-libs is already the newest version". Trying to "make gonk" returns an error (which might require a new bug report?):

//usrusr//binbin//ld.bfd.realld.bfd.real::  cannotcannot  findfind  --lstdclstdc++++

collect2: collect2: ld returned 1 exit status
ld returned 1 exit status
make[1]: *** [out/host/linux-x86/obj/EXECUTABLES/bsdiff_intermediates/bsdiff] Error 1
make[1]: *** [out/host/linux-x86/obj/EXECUTABLES/bspatch_intermediates/bspatch] Error 1
/usr/bin/ld.bfd.real: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3//libstdc++.so usrwhen/ binsearching/ ld.bfd.realfor:  -skippinglstdc +incompatible+ 
//usrusr//libbin//gccld.bfd.real/:x86_64 -skippinglinux -incompatiblegnu //4.4.3usr//libstdclib+/+gcc./sox86_64 -whenlinux -searchinggnu /for4.4.3 /-libstdclstdc++++.
a/ usrwhen/ binsearching/ ld.bfd.realfor:  -skippinglstdc +incompatible+ 
//usrusr//libbin//gccld.bfd.real/:x86_64 -skippinglinux -incompatiblegnu //4.4.3usr//libstdclib+/+gcc./ax86_64 -whenlinux -searchinggnu /for4.4.3 /-libstdclstdc++++.
so/ usrwhen/ binsearching/ ld.bfd.realfor:  -skippinglstdc +incompatible+ 
//usrusr//libbin//gccld.bfd.real/:x86_64 -skippinglinux -incompatiblegnu //4.4.3usr//libstdclib+/+gcc./sox86_64 -whenlinux -searchinggnu /for4.4.3 /-libstdclstdc++++.
a/ usrwhen/ binsearching/ ld.bfd.realfor:  -skippinglstdc +incompatible+ 
//usrusr//libbin//gccld.bfd.real/:x86_64 -cannotlinux -findgnu /-4.4.3lstdc/+libstdc++
+.a when searching for -lstdc++
/usr/bin/ld.bfd.real: cannot find -lstdc++collect2: 
ld returned 1 exit status
collect2: ld returned 1 exit status

Any ideas?

andresriancho commented 12 years ago

Did this "sudo ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so" and now I get "/usr/bin/ld.bfd.real: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.so when searching for -lstdc++" , it seems that the .so file is 64bit and B2G requires 32bit? This is hell...

Will continue and report back when I'm done.

roycollings commented 11 years ago

andresriancho : "This is hell..." I know what you mean! I'm right at this point trying to get a working build of B2G after 3 days of trying (it's now 22:30 on day3)!

Did you get past this issue? How? Buy a Mac? :p

fabricedesre commented 11 years ago

@roydude, this repository is not used anymore. The one to use is https://github.com/mozilla-b2g/B2G

BrendanEich commented 11 years ago

Someone update the README?

roycollings commented 11 years ago

Thanks @fabricedesre - I finally got it all to finish "build.sh" at 23:30 last night! There's so much fragmentation between the different instructions on how to do this - parts of one are out of date, parts of the next one are out of date / instructions missing / 32-bit libs needed for some parts when installing on 64-bit Linux (even though it doesn't install on 32-bit linux) etc...

I guess it's all part of working at the 'bleeding edge', but someone seriously needs to keep the instructions up to date.

I now have one day to do all the 'actual work' I was meant to be doing 4 days ago, before tomorrows meeting. Once that's all out of the way I'm going to collect as much of the details I can remember about how I set this up in Linux64 and stick it up somewhere.