Building OpenSSL libraries for Android, from windows
-
wrote on 17 Mar 2014, 14:48 last edited by
Hello,
I have a simple chat program that uses OpenSSL
It works fine on windows, but I want to deploy it on android.
I tried to build the libcrypto and libssl libraries for android.I got the information how to to it in linux here:
http://qt-project.org/doc/qt-5/opensslsupport.htmlbut if I go to the OpenSSL source directory, Configure is not recognized anymore
if I use the full path (C:\Qt\Qt5.2.1\5.2.1\Src\qtbase\configure.bat)
it says "andriod is an unknown option" (android-armv7 also)
I do not have a "make" or "build_lib" in windows equivalent to the scripts in linux.
how does configure know in which directory im am configuring?
how do I compile those openSSL sources to libcrypto.so and libssl.so (or libcrypto.lib and libssl.lib) from windows command prompt, so that I can package them into my APK for android?
what is the difference between .so libraries and .lib libraries?please help! I am coming from visual studio and never did anything outside windows!
-
wrote on 17 Mar 2014, 17:37 last edited by
ok I downloaded the Msys shell,
and I see the script Configure in the OpenSSL-Source directory
but when i run it with "./Configure shared android" it gives me:
./Configure: line 2: exec: perl: not foundstill need help!
-
wrote on 17 Mar 2014, 18:03 last edited by
ok i needed to install perl for windows, which I did (ActivePerl)
now next problem, when i use make build_libs: gcc.exe: error: unrecognized command line option '-mandroid'here is complete output:
$ make build_libs
making all in crypto...
make[1]: Entering directory/c/openssl-1.0.1f/crypto' ( echo "#ifndef MK1MF_BUILD"; \ echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \ echo ' #define CFLAGS "gcc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REE NTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mandroid -I/include -B/lib -O3 -fomit-frame-p ointer -Wall"'; \ echo ' #define PLATFORM "android"'; \ echo " #define DATE \"
LC_ALL=C LC_TIME=C date\""; \ echo '#endif' ) >buildinf.h gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -D DSO_DLFCN -DHAVE_DLFCN_H -mandroid -I/include -B/lib -O3 -fomit-frame-pointer -W all -c -o cryptlib.o cryptlib.c gcc.exe: error: unrecognized command line option '-mandroid' make[1]: *** [cryptlib.o] Error 1 make[1]: Leaving directory
/c/openssl-1.0.1f/crypto'
make: *** [build_crypto] Error 1 -
wrote on 18 Mar 2014, 14:41 last edited by
ok, I was using wrong GCC.exe or G++.exe compiler
I adjusted my $PATH variable to include :
C:\android\AndroidNDK\toolchains\arm-linux-androideabi-4.6\prebuilt\windows-x86_64\arm-linux-androideabi\binlibcrypto.so and libssl.so are now created.
1/4