How to build OpenSSL on Android/Linux ? - android

Hi
I'm in need to build OpenSSL lib for Android NDK r5b, today it will be second day of my ... useles fight. Here is short list what i've done
Downloaded: https://github.com/fries/android-external-openssl/
As i found here on StackOverflow fixed .S <->.s problem
Crypto gets builded... until i get this message:
/prebuilt/windows/bin/arm-linux-androideabi-
SharedLibrary : libcrypto.so
arm-linux-androideabi-g++.exe: CreateProcess: No such file or directory
make: * [/cygdrive/c/AndroidDev/AndroidOpenSSL/obj/local/armeabi/libcrypto.so]
Error 1*
It's 10 years when i last time used make, and i was sure it's problem with g++ path. Added some debug to toolchain, and got:
TOOLCHAIN_NAME: arm-linux-androideabi-4.4.3
TOOLCHAIN_PREFIX: /cygdrive/c/Android_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
both looks fine for me, as /cygdrive/c/Android_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/ does exist, and arm-linux-androideabi-g++.exe is right there :(
Any one ever had this same problem? I realy have no idea where to look any future :(
Will be appreciative for help

One solution is also to shorten the openssl build path, eg. from c:\code\openssl-android to just c:\ssl

Looks like only i had such problem. Here is a solution i found, mayby someone will figure out why this happend.
Saved command line to separate file called bild_data (output from ndk-build), then removed from it g++ call, this way my build file had only list of files and needed flags. Then i just executed from cygwin arm-linux-androideabi-g++ #build_data
After that i had my 'precious' libcrypto.so, ndk-build executed again with libcrypto.so alerdy builded from command line, builded openssl library.
For me it looks like command line that was over 31kb did not fit to cygwin buffer :(

I had the same problem building on Windows (cygwin), and shortening the path to the project directory (see mango's answer) is what worked for me.

Related

How can I fix pthread_mutex_trylock error in Android

I have a Problem on an emulated Android device. To be honest on every emulated Android Device. There is a mutex test from Android Bionic. It could be found under:
https://android.googlesource.com/platform/system/extras/+/froyo/tests/bionic/libc/bionic/test_mutex.c
So, when compiling this with CMake and the Android Toolchain for Android x86 or x86_64 it compiles fine.
Altough, when running the file it throws an error in line 90:
expect( pthread_mutex_trylock( &lock ), EDEADLK );
The error message:
generic_x86_arm:/data/local # ./test_mutex
/home/tjk/coding/oorexx/mutex/test_mutex.c:80: call returned 16 instead of 35: pthread_mutex_trylock( &lock )
If I delete this on line everything is fine and I get an "ok". Thats not a solution because I'm working on a big project and debugging tells me that there are problems and its very likely that the trylock function is the reason for that. So I need to fix that. The mutex test has to work.
What can I do? What could be the reason for that? Is it the device? Is it the Android Toolchain or is there something wrong with my CMake Command? My CMake Command:
cmake -H./ -B./build2 -DANDROID_NDK=~/coding/android-ndk-r22b/ -DCMAKE_TOOLCHAIN_FILE=~/coding/android-ndk-r22b/build/cmake/android.toolchain.cmake -DANDROID_ABI="x86" -DCMAKE_BUILD_TYPE=Release \ (base)
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DANDROID_NATIVE_API_LEVEL=30
The CMakeLists.txt:
cmake_minimum_required(VERSION 3.6.0)
project(test_mutex)
add_executable(test_mutex test_mutex.c)
I would really appreciate any useful tips. Thank you!
Best Regards Thomas

x264 Building error - Android

I am using this repository to build ffmpeg static library which includes x264,libpng and others, please
visit this link https://github.com/writingminds/ffmpeg-android
i am using windows 7 as host and ubuntu 15.10 (_64) as guest os using VMware Workstation 12 and
Android-ndk-r11b-linux-x86_64
i do have Prebuilt libraries , but now i want it without PIE support
i am getting this error in config.log in x264 folder while building
through
./android_build.sh
here is the log :
x264 configure script
Command line options: "--cross-prefix=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-gcc
checking whether /mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-gcc
--sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot works... no
Failed commandline was:
--sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot conftest.c -Wall -I. -I$(SRCPATH) --sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot --sysroot=/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/sysroot -lm -o conftest
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: fatal error:
conftest: Input/output error
Failed program was:
int main (void) { return 0; }
DIED: No working C compiler found.
ushare is my shared folder between windows and ubuntu
I have spend almost a week ,trying to solve every error i get.
these errors are like never ending , 1 solution give 10 more errors
i have researched a LOT for this library
thanks a lot in advance.
Also i thought that x264 library might have poroblem ,so i tried to disable it
but next library "libpng" also had Same log Error
i think problem is in Input/output error (obviously)
this line in log kind of confuses me (those /../../)
/mnt/hgfs/uShare/ffmpeg-android/toolchain-android/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: fatal error:
its like two folder overlaping address...
thanks a lot in advance.
please don't go harsh on me ,its my first time,all thanks to this thing...
Well i solved my problem. the problem was in NDK ,i extracted it in windows and was using it on ubuntu. Later i used ubuntu to extract ,and found the built to be working.
hope this help to new future users!

mk:1: *** missing separator. android NDK

I am trying to compile some source code but when i run the command
make -f android-9-armv7.mk
I get the following error
android-9-armv7.mk:1: * missing separator. Stop.
This is the contents of the file above:
And I have set the IMAGINE_PATH variable as well, cant seem to figure it out.
link ../imagine/make/shortcut/common-builds/android-9-armv7.mk
Compiling instructions
http://code.google.com/p/emu-ex-plus-alpha/wiki/Compiling
Imagine is locaed at C:/Imagine
I don't know where you've taken the sources, but all the android-9-armv7.mk files from different projects on that git has following content:
../imagine/make/shortcut/common-builds/android-9-armv7.mk
...there is no link keyword, which probably is why you get this error.
Also, please be informed that you're building this on Windows machine while documentation clearly states that it's supported only on Linux and Mac OS X.

Android NDK build: File not found Error

Need your guidance, I am writing one app in android with the help of native code which will communicate with CAN (Controller Area Network) port ; for that in my C code i used linux/can.h header file. and i am following "http://mobilepearls.com/labs/ndk-builder-in-eclipse/" this link to build my app. but one i set all thing i got bellow msg in eclipse console box
Compile thumb : can_port <= cansend.c
jni/cansend.c:14:23: fatal error: linux/can.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/can_port/cansend.o] Error 1
One more thing, i am working on windows environment. But i don't think this may be cause.
It is correct that it is not a Windows/Linux problem. The simple problem is that compiler is unable to find the file can.h. Now, for your info, when the compiler starts compiling, it searches for its header files in the folder
C:\(path to NDK folder)\platforms\(android-version)\(arch)\usr\include\linux
Now, if there isn't a can.h there, the compiler will flag an error. So the best way is
Either copy can.h to the above path (not tested)
Modify your Makefile to path to the correct directory where this header file is kept
Hope this helps!

error: 'gint' has not been declared

I am trying to build a Gstreamer plugin(a surface texture sink) in android. I got this error along with several others:
"error: 'gint' has not been declared".
I did source build/envsetup.sh and then went into the sink directory and did "mm". Then I got the above error.
I believe I should include "gst.h" and "glib.h". But when I add these include lines, I get an error saying that these files cannot be located. So, I think that the path to these header files need to be set correctly. But I don't know how or where to set this path.
Should Android.mk be modified in some way ?
Kindly help
Thanks.
gint is declared in glib.h on all systems I have seen. Do you have glib installed?

Categories

Resources