Reputation: 5901
I am currently compiling Android Linaro build 11.11 (staging-panda) for pandaboard.
In the build process, Android compiles some tools with the host gcc compiler. On my Linux Mint 12 (Ubuntu-11.10 based), I have gcc-4.6 installed by default.
I built Android, everything runs fine, pandaboard booted, but then starting any application will lead to segmentation fault (signal 11 in logcat).
I then learned that Linaro built this release with gcc-4.5, not 4.6 version. I installed it using apt-get. I removed out/ directory and rebuild Android entirely.
The compilation runs fine, but the linker insults me:
g++-4.5 -Wl,-rpath-link=out/target/product/pandaboard/obj/lib -Wl,-rpath,\$ORIGIN/../lib -Lout/host/linux-x86/obj/lib -Wl,--no-undefined -m32 out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o -Wl,--whole-archive -Wl,--no-whole-archive out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a -o out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp
g++-4.5 -Wl,-rpath-link=out/target/product/pandaboard/obj/lib -Wl,-rpath,\$ORIGIN/../lib -Lout/host/linux-x86/obj/lib -Wl,--no-undefined -m32 out/host/linux-x86/obj/EXECUTABLES/mkbootfs_intermediates/mkbootfs.o -Wl,--whole-archive -Wl,--no-whole-archive -o out/host/linux-x86/obj/EXECUTABLES/mkbootfs_intermediates/mkbootfs
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.5.4/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
The linker grabs the 64bit libraries of gcc-4.5, although it probably for 32bit version. So far, here are the things I tried, without success:
Finally I've been told to install gcc-4.5-multilib and g++-4.5-multilib. It worked, and the build got further. I start the panda, still the apps (eg com.android.launcher) fails to launch. I know this is an assumption, but I think that this segfault is somehow linked to the compiler.
My questions are simple:
Thanks heaps.
Upvotes: 1
Views: 4702
Reputation: 5901
Use gdb. Requirements:
#
is the target shell, although being root is not mandatory
$
is the host shell
LOCAL_CFLAGS += -g
# gdbserver :5039 </system/bin/executable>
# gdbserver :5039 --attach <pid>
$ adb forward tcp:5039 tcp:5039
$ gdbclient :5039 <executable>
If you struggle with gdbclient
, check build/envsetup.sh
where the function is defined: $ type gdbclient
Adding the verbose -v
option might be of some help. Also if your executable is not in system/bin
, you'll definitely need to modify build/envsetup.sh
as it is hard-coded.
Some more information can be found here.
Upvotes: 2