cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.23k stars 476 forks source link

libsrtp2 2.2.0-pre comple with android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc error #448

Closed qing310820 closed 4 years ago

qing310820 commented 5 years ago
configure:2650: checking whether the C compiler works configure:2672: /opt/android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc conftest.c >&5 /opt/android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory /opt/android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory /opt/android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc /opt/android/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl collect2: error: ld returned 1 exit status configure:2676: $? = 1 configure:2714: result: no configure: failed program was: / confdefs.h / #define PACKAGE_NAME "libsrtp2" #define PACKAGE_TARNAME "libsrtp2" #define PACKAGE_VERSION "2.2.0-pre" #define PACKAGE_STRING "libsrtp2 2.2.0-pre" #define PACKAGE_BUGREPORT "https://github.com/cisco/libsrtp/issues" #define PACKAGE_URL "" / end confdefs.h. /
int
main ()
{
;
return 0;
}

configure:2719: error: in `/home/liuping/wxq/forobjdump/libsrtp-master': configure:2721: error: C compiler cannot create executables configure: exit 77

paulej commented 5 years ago

I assume it might be that there are additional config settings needed to build on Android. I see a few options presented here: https://stackoverflow.com/questions/16795583/android-error-cannot-open-crtbegin-dynamic-o-no-such-file-or-directory

pabuhler commented 5 years ago

@qing310820 is this still and issue? Do you have the full command line you are using to try and build?

pabuhler commented 4 years ago

Hi I am able to build and run on android using android-ndk-r17c with the following setup, does this help you ?

export BUILD_TOOLCHAIN=/PATH_TO_TOOLCHAIN/toolchain-r17/arm64
export BUILD_ARC=aarch64-linux-android
export PATH=${BUILD_TOOLCHAIN}/bin:$PATH
export CC="${BUILD_ARC}-gcc --sysroot=${BUILD_TOOLCHAIN}/sysroot"
export CXX="${BUILD_ARC}-g++ --sysroot=${BUILD_TOOLCHAIN}/sysroot"
export LDFLAGS=-pie
export EXTRA_CFLAGS=-D__ANDROID_API__=21
./configure --host=${BUILD_ARC}
make

Alternatively can build with cmake using the following.

mkdir arm64
cd arm64
cmake -DCMAKE_TOOLCHAIN_FILE=/PATH_TO_NDK/android-ndk-r17c/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..
make
pabuhler commented 4 years ago

472 added examples of building for andoird ndk20 with both cmake & configure, please use them as a kind.