sherpya / android-busybox

Android busybox for standalone bionic toolchain - ALWAYS REBASED (so pull --rebase --ff-only), look at https://github.com/sherpya/android-busybox/blob/master/ANDROID.md for info
Other
79 stars 38 forks source link

static build fail #7

Open ChanChunSong opened 4 years ago

ChanChunSong commented 4 years ago

I modified the CONFIG_STATIC=y in .config file. But I got these error message usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libc.a(syscalls-arm.o): multiple definition of 'adjtimex' /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: libbb/lib.a(missing_syscalls.o): previous definition here /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libc.a(syscalls-arm.o): multiple definition of 'getsid' /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: libbb/lib.a(missing_syscalls.o): previous definition here /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libc.a(syscalls-arm.o): multiple definition of 'sethostname' /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: libbb/lib.a(missing_syscalls.o): previous definition here /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libc.a(syscalls-arm.o): multiple definition of 'swapoff' /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: libbb/lib.a(missing_syscalls.o): previous definition here /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libc.a(syscalls-arm.o): multiple definition of 'swapon' /usr/local/google/home/worker/codebase/tool/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: libbb/lib.a(missing_syscalls.o): previous definition here clang90: error: linker command failed with exit code 1 (use -v to see invocation)

Did I miss something ?

sherpya commented 4 years ago

I had similar problems with other calls that can be easily resolved (I already fixed them for other symbols), the problem is the current toolchain is unable to link static binary, what version of ndk are you using?

sherpya commented 4 years ago

I've force pushed a fix, android ndk team cheats to have to buid less versions of static bionic btw 64bit static build still fails for relocation overflow in the link stage

ChanChunSong commented 4 years ago

I used android-ndk-r21c. Do you mean the earlier ndk version can build static binary ?

sherpya commented 4 years ago

@ChanChunSong I've fixed the problem you encountered, static build still fail on aarch64 but does work on arm