link library on my own .cc
Closed this issue · 5 comments
Hello, Im trying to link the lib native code with on my own .cc file. I have something like:
clang-9 fu_file.cc -g -O1 -fsanitize=address,fuzzer -L/home/nasa/android-gif-drawable/sample/build/intermediates/merged_native_libs/debug/out/lib/x86_64 -lpl_droidsonroids_gif -L/home/nasa/sdk/ndk/20.0.5594570/platforms/android-29/arch-x86_64/usr/lib64 -ljnigraphics -landroid -lGLESv2 -llog -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -o mainfu
I have this error:
/usr/bin/ld: /usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/libclang_rt.fuzzer-x86_64.a(fuzzer.o): undefined reference to symbol '__ctype_b_loc@@GLIBC_2.3'
//lib/x86_64-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line
I believe this error is due the @libc bionic that the native code and when compiling it uses my system libc?
Can you gimme an hand with this please?
You can understand better here (simple example): https://paste.debian.net/1119988/
undefined reference to
getEnv()'` it seems that you are not passing all C source files.
I'm not using cmake/clang directly but only via gradle, so I'm not 100% sure how to compile the sources without it.
So I can only give some hints.
I see undefined references to both symbols from this library and from bionic.
One more thing:
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.1.0/crtbegin.o
is that file from NDK? If not try to use *.o
files from NDK.
Closing due to inactivity, but feel free to ask new questions.