Android build failure - android

I followed instructions from here. After $ repo sync I tried to build it with $ make, but got this error:
host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] Error 1
Using Ubuntu 10.04 LTS. Any help appreciated.
UPD: I found a discussion, that claims, that problem could be that I'm having 64bit libs on my 32bit system.
$ ls -l /usr/lib/libz.so
lrwxrwxrwx 1 root root 20 2010-07-07 17:08 /usr/lib/libz.so -> /lib/libz.so.1.2.3.3
$ file /lib/libz.so.1.2.3.3
/lib/libz.so.1.2.3.3: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
How do I figure out, if that libz.so.1.2.3.3 is the right lib, and in case I have to replace it with the right one, how do I do it?
Also, $ arch says, I have an i686 architecture. Machine, I'm using is Lenovo ThinkPad SL500 with Core 2 DUO CPU.

Everything works now, the solution was to install lib64z1-dev:
sudo apt-get install lib64z1-dev
Edit: now there's another problem, with ClearSilver, described here and finally resolved here.

You need to install libz.
sudo apt-get install libz-dev

libz library has different name in different distros
lib32z1 on debian system

Related

Android Opensource Project build error `FAILED: out/soong/build.ninja`

I became interested in the Android's source code. I precisely repeated all the steps from the official guide source.android.com to compile it.
I tried to compile it and I got:
... error while loading shared libraries: libncurses.so.5: cannot open shared
object file: No such file or directory
To fix it:
Arch: Enable multilib,sudo pacman -S lib32-ncurses
Ubuntu: sudo apt install libncurses5:i386
Then i tried to compile again
Next time i got no errors messages except exit status 1
[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b
out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build
-globs.ninja -o out/soong/build.ninja Android.bp
21:03:08 soong bootstrap failed with: exit status 1
#### failed to build some targets (24:14 (mm:ss)) ####
When there are no error messages, I can't guess what's the matter
But i know, what:
This error is independent of linux distribution
Deleting and downloading all sources again cannot fix this error
Before I get this error, my computer freezes
It seems that your ninja process is getting killed. That's probably because it tries to use too much RAM: we currently allow ~3.5GB RAM per workspace, so the Linux OOM-killer will kill any process that makes your workspace use more than that.
In order to use less RAM, could you please try building with fewer processes? E.g. with:
$ make -j2 aapt

How to fix cannot find libgcc.a: No such file or directory error

I'm trying to make a standalone compile of the kernel for my android phone, using Google Toolchain, and have already tried Uber and linarc.
All of them give the same error, which I don't understand:
/home/aayushgupta219/kernel/toolchain64/bin/aarch64-linux-android-ld: cannot find libgcc.a: No such file or directory
/home/aayushgupta219/kernel/toolchain64/bin/aarch64-linux-android-ld: cannot find libgcc.a: No such file or directory
Makefile:814: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
Here is a copy of the source.
Here is a copy of the logfile
OK. In case anyone is having same error and finding no fix here is my own fix for it. I was on Ubuntu 16.04 having gcc5 and was getting this error. I upgraded to Ubuntu 17.04 with gcc6 preinstalled and now no more such errors.
-Fist of all
use command
gcc -m32 -print-libgcc-file-name.
then use
sudo apt-get install -y build-essential gdb git vim
sudo apt-get install gcc-multilib
if it dosent work.
-Second
gcc -m32 -print-libgcc-file-name will give you a path that include libgcc.a.
just copy that to this place.
that path is /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.ain my computer
use cp /usr/lib/gcc/x86_64-linux-gnu/7/32/libgcc.a ./

Debug app segmentation fault? Compiler's fault?

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:
re-do the package installation following these instructions
sudo ldconfig
reboot my machine
I looked into removing gcc-4.6 to get only gcc-4.5 on my machine.
But synaptic showed so many dependencies needed to be uninstalled,
that I didn't make that step :)
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:
Is com.android.launcher cross-compiled or compiled with host 32bit
compiler? What keyword should I look for to find the associated command in the build log?
How can I debug this segmentation fault? In particular, I am looking
for starting com.android.launcher with the "am" command.
Will strace provide valuable information for this issue?
Thanks heaps.
Use gdb. Requirements:
# is the target shell, although being root is not mandatory
$ is the host shell
The app must be compiled in debug mode
LOCAL_CFLAGS += -g
start gdbserver on the target:
# gdbserver :5039 </system/bin/executable>
(or)
# gdbserver :5039 --attach <pid>
forward tcp port to adb connection:
$ adb forward tcp:5039 tcp:5039
start gdbclient on the host:
$ 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.

error compiling Android on ubuntu 11.10

I am getting following error while compiling Android on ubuntu 11.10
target arm C: libc <= bionic/libc/bionic/pthread.c
arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libc_intermediates/bionic/pthread.o] Error 1
Any Clue?
It can't find cc1. On my fresh install of Ubuntu 11.10 it's installed but not in my path. Try adding it manually to your path.
export PATH=<pathtoitgoeshere>:$PATH
On my Ubuntu, it was found at
/usr/lib/gcc/i686-linux-gnu/4.6.1/cc1
But you can find it for yours by using
gcc -print-prog-name=cc1
I have spent about a day to find root cause of this: arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file... and others issues. The issue was that I unpacked NDK and SDK with 7z which removed executable permission for all binaries and Eclipse was not able to start cc1. Once I unpacked tar files of SDK and NDK using tar, everything started working well.
PS. I hope it will safe a day for others.
I encountered this problem after upgrading from Ubuntu 12.04 => 14.04.
Seems like the build-essential package wasn't upgraded properly. For me, I was able to fix by doing
sudo apt-get purge gcc
sudo apt-get install gcc

Cannot find -ltinfo when compiling android 4.0.3

Hi I have got a problem that I can't solve when compiling the android source for ICS. The build gets to a certain stage, then I get the message:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../libtinfo.so when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../libtinfo.a when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/libtinfo.so when searching for -ltinfo
/usr/bin/ld: skipping incompatible /usr/lib/libtinfo.a when searching for -ltinfo
/usr/bin/ld: cannot find -ltinfo
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
make: *** Waiting for unfinished jobs....
I have tried updating/installing libncurses5-dev and libtinfo-dev which were both latest versions and am a bit stuck now. How can I get rid of this to allow the build to happen properly?
I had seen similar issue with gingerbread when compiled on 64bit ubuntu. It got fixed with installation of lib32ncurses5-dev and its dependencies which includes lib32tinfo5-dev. The compiled host adb executable with android is a 32-bit executable.
I have seen same problem on my fedora 16 64bit, same android branch 4.0.3 r1
you might want to try ncurses-devel.i686
yum install ncurses-devel.i686
it solved my problem
I got this issue while I was building mysql statically. So I had to install the static versions of these libraries. For example I did run:
yum search ncurses
Then I installed,
yum install ncurses-static # not exactly the same syntax, but something similar; see search command's output
This might work in Fedora 23
dnf install ncurses-devel

Categories

Resources