How can I link the cpufeatures lib with the native android library?

I am trying to link android cpu_features with a native library.
I am using android gcc compiler directly as cross compiler. ( NOT ndk-build ).

I have included the header ( $ NDK_PATH / sources / android / cpufeatures / cpu-features.h ), but I cannot see the libcpufeatures.a ready- made anywhere under the ndk folder.
How can I build this library? Or where can I find it so I can link it correctly?

+3


source to share


1 answer


You can simply include the source file cpu-features.c

in your project, or create it manually with gcc:

arm-linux-androideabi-gcc -c cpu-features.c -o cpu-features.o --sysroot=$SYSROOT
arm-linux-androideabi-ar rcs libcpufeatures.a cpu-features.o

      



It shouldn't require any special compiler flags or additional definitions, but when linking to it, you might need to add -ldl

as it uses dlopen

.

+3


source







All Articles