Android Stand alone compiler getting openssl error - android

I tried to compile sofia-sip native library using Android NDK.
getting this error always:
/home/umn/android/android-ndk-r7c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld:
cannot find -lssl collect2: ld returned 1 exit status

Related

Cmake not able to compile simple test program on qt creator / collect2: error: ld

I am trying to build an Android project using the android NDK.
I have added the NDK to the QT Versions, the build kit was auto detected but when running CMake I get the following error:
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++", "-DCMAKE_C_COMPILER:STRING=/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc", "-DCMAKE_PREFIX_PATH:STRING=/home/self/Qt5.9.6/5.9.6/android_x86", "-DQT_QMAKE_EXECUTABLE:STRING=/home/self/Qt5.9.6/5.9.6/android_x86/bin/qmake".
The C compiler identification is GNU 4.9.0
The CXX compiler identification is GNU 4.9.0
Check for working C compiler: /home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc
Check for working C compiler: /home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /tmp/QtCreator-Tuub3S/qtc-cmake-XXSZ1kmJ/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/ninja" "cmTC_991f8"
[1/2] Building C object CMakeFiles/cmTC_991f8.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_991f8
FAILED: cmTC_991f8
: && /home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc -rdynamic CMakeFiles/cmTC_991f8.dir/testCCompiler.c.o -o cmTC_991f8 && :
/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot open crtend_android.o: No such file or directory
/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lc
/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -ldl
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
Configuring incomplete, errors occurred!
See also "/tmp/QtCreator-Tuub3S/qtc-cmake-XXSZ1kmJ/CMakeFiles/CMakeOutput.log".
See also "/tmp/QtCreator-Tuub3S/qtc-cmake-XXSZ1kmJ/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
What am I doing wrong?
EDIT So as suggested I downloaded NDK 10e ... Problem seems to stay the same:
/usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52: error: The C compiler "/home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc" is not able to compile a simple test program.
It fails with the following output: Change Dir: /tmp/QtCreator-vkcYcW/qtc-cmake-XXyT08En/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/ninja" "cmTC_3ab69"
[1/2] Building C object CMakeFiles/cmTC_3ab69.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_3ab69 FAILED: cmTC_3ab69 : && /home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc -rdynamic CMakeFiles/cmTC_3ab69.dir/testCCompiler.c.o -o cmTC_3ab69 && :
/home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-androi.d/4.9/../../../../i686-linux-android/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory /home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld: error: cannot open crtend_android.o: No such file or directory /home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld: error: cannot find -lc /home/self/Android/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9/../../../../i686-linux-android/bin/ld: error: cannot find -ldl
collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
Qt does not support a recent version of NDK, in the docs it is recommended to use NDK 10e

Compiling sdl linux project for android

I have a simple c++ sdl project which compiles fine for linux. I need to compile it for android without changing the source code (like in qt). When I tried to compile it using documentation, I had following error:
"jni/src/../SDL/src/main/android/SDL_android_main.c:62: error: undefined reference to 'SDL_main'
collect2: error: ld returned 1 exit status".
Can anyone give me working example that can be compiled both for linux and android?

Issue compiling Android 6.0 using Jack Server

I never had a problem compiling the AOSP version until 5.x. Now I'm trying to compile Android 6.0, which switched toolchain and uses Jack (Java Android Compiler Kit) but the compilation aborts.
The error seems to be related with a problem in compiling C object files, so the ld linker at some point starts producing file is empty errors such as the following one:
host SharedLib: libart (out/host/linux-x86/obj/lib/libart.so)
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld: error: out/host/linux-x86/obj/SHARED_LIBRARIES/libart_intermediates/check_jni.o: file is empty
When I check these files their size is 0 bytes. I tried the process two times before writing this, but every time the make process stops with the follosing error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [out/host/linux-x86/obj/lib/libart.so] Error 1
Have you experienced something like this and found a solution?

How to solve the "undefined reference to 'ntohl'" compile error in Android NDK?

How to solve the compile error?
error: undefined reference to 'ntohl'
collect2: error: ld returned 1 exit status
I use the android-ndk-r10d.
When building with the Android NDK, ntohl and the other functions for converting between network and host byte order are #defines present in the header <sys/endian.h>. So including that header should fix your compilation error.

Error compiling iptables using cygwin on android

I am using my iptables source from https://code.google.com/p/iptables4n1/ because source from netfilter.org has issues compiling using cygwin.
When I run the ndk-build from my cmd(Am using windows) the build process runs smoothly until it throws an error. Below is the cmd output of the error.
C:/Users/Chike/Desktop/DevSec/android-ndk-r9b/toolchains/arm-linux-androideabi-4
.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../
arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/iptables/iptables-sta
ndalone.o: in function main:jni/iptables-standalone.c:62: error: undefined refer
ence to 'init_extensions'
collect2: ld returned 1 exit status
make.exe: *** [obj/local/armeabi/iptables] Error 1
Anyone with solution?

Categories

Resources