microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k stars 1.65k forks source link

Build for Android failed in Ubuntu 20.04.2 #1693

Open nguyenthanhloc2609 opened 2 years ago

nguyenthanhloc2609 commented 2 years ago

Dear Developers,

When I follow this Build for Android on Linux to build cpprestsdk, I can not build successfully.

The error is like:

make[3]: Entering directory '/home/baop/locnt/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a' LD_LIBRARY_PATH=: clang -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="/home/baop/locnt/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a/../armeabi-v7a/ssl" -DENGINESDIR="/home/baop/locnt/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a/../armeabi-v7a/lib/engines-1.1" -Wall -O3 -pthread -fPIC --gcc-toolchain=/home/baop/locnt/android-ndk-r10/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 --sysroot=/home/baop/locnt/android-ndk-r10/platforms/android-18/arch-arm -isystem /home/baop/locnt/android-ndk-r10/platforms/android-18/arch-arm/usr/include -isystem /home/baop/locnt/android-ndk-r10/platforms/android-18/arch-arm/usr/include/arm-linux-androideabi -D__ANDROID_API__=18 -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Qunused-arguments -Wa,--noexecstack -target armv7-none-linux-androideabi -fPIC -DOPENSSL_USE_NODELETE -Wl,-znodelete -shared -Wl,-Bsymbolic -Wl,-soname=libcrypto.so.1.1 -o libcrypto.so.1.1 -Wl,--whole-archive,--version-script=crypto.map libcrypto.a -Wl,--no-whole-archive -ldl -pthread

<path to android ndk r10>/android-ndk-r10/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: [Makefile.shared:182: link_shlib.linux-shared] Error 1 make[3]: Leaving directory '<path to casablanca>/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a' make[2]: [Makefile:657: libcrypto.so] Error 2 make[2]: Leaving directory '<path to casablanca>/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a' make[1]: [Makefile:129: all] Error 2 make[1]: Leaving directory '<path to casablanca>/casablanca/Build_android/build/openssl/openssl-1.1.0j-armeabi-v7a' make: [Makefile:116: armeabi-v7a/lib/libssl.a] Error 2

I searched about this error but can not find any infomation about it.

Could you please help me to fix it?

Thanks and best regards!

nguyenthanhloc2609 commented 2 years ago

Another one:

When I skip build openssl with command ./configure.sh --ndk <**path to android-ndk-r10**>/android-ndk-r10 --skip-openssl I also get an error:

Cloning into 'Boost-for-Android'... remote: Enumerating objects: 923, done. remote: Counting objects: 100% (56/56), done. remote: Compressing objects: 100% (34/34), done. remote: Total 923 (delta 29), reused 32 (delta 15), pack-reused 867 Receiving objects: 100% (923/923), 290.54 KiB | 355.00 KiB/s, done. Resolving deltas: 100% (461/461), done. fatal: reference is not a tree: 7626dd6f7cab7866dce20e685d4a1b11194366a7