Comments on: Dockerfile example how to compile libcurl for Android inside Docker container https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/ Programming, architecture and design (ะก++, QT, .Net/WPF, Android, iOS, NoSQL, distributed systems, mobile development, image processing, etc...) Thu, 22 Oct 2015 02:38:00 +0000 hourly 1 https://wordpress.org/?v=5.4.2 By: jattind https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45933 Thu, 22 Oct 2015 02:38:00 +0000 http://vitiy.info/?p=354#comment-45933 Hi Victor,

I am new to docker. I installed docker and I built the docker file. I can see the image in my repo (android/curl latest f4b6bd643336). How do I use the static lib? Is it only available within docker container?

]]>
By: Nifty Things for Week Ending 27 March » Ramblings https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45892 Fri, 27 Mar 2015 12:01:19 +0000 http://vitiy.info/?p=354#comment-45892 […] Dockerfile example how to compile libcurl for Android inside Docker container […]

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45868 Thu, 12 Feb 2015 10:24:00 +0000 http://vitiy.info/?p=354#comment-45868 Tried to use COPY as below:
#Build SSL section starts
# download, configure and make openssl

RUN curl -O https://www.openssl.org/source/openssl-1.0.2.tar.gz &&
tar -xzf openssl-1.0.2.tar.gz &&
mv openssl-1.0.2 openssl

copy libssl.so /openssl
copy libcrypto.so /openssl
#Build SSL section ends

And then added –with-ssl=/Android/openssl in ./configure but the compiled libcurl does not seem to link libssl as size of libcurl.a don’t change & also ssl functionality doesn’t work.

Am I missing something?

]]>
By: Victor Laskin https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45867 Wed, 11 Feb 2015 13:03:00 +0000 http://vitiy.info/?p=354#comment-45867 You can use COPY command inside Dockerfile. But i consider this as bad way.

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45866 Wed, 11 Feb 2015 12:11:00 +0000 http://vitiy.info/?p=354#comment-45866 Hi Victor,

We got that every Android OS has libssl and libcrypto libraries that are part of OpenSSL, but not included in NDK for using them. You can pull them via below command:

$adb pull /system/lib/libssl.so /myndk/platforms/android-19/arch-arm/usr/lib

$adb pull /system/lib/libcrypto.so /myndk/platforms/android-19/arch-arm/usr/lib

We are able to pull these arm based libssl.so & libcrypto.so modules.
Now the question is how can we get them into docker image so that we can use it for libcurl build?

Thanks
Rakesh

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45863 Tue, 10 Feb 2015 12:00:00 +0000 http://vitiy.info/?p=354#comment-45863 After setting some more environment variables now compilation seem to happen but it fails in linking.
Tried various changes in path related variables but can’t get rid of following error:
/Android/toolchain-arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-
linux-androideabi/bin/ld: error: cannot find -ldl
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to ‘dlopen’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to ‘dlsym’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to ‘dlclose’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to ‘dlsym’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to ‘dlerror’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to ‘dlsym’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to ‘dlerror’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to ‘dlopen’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to ‘dlclose’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to ‘dlerror’
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined
reference to ‘dlclose’
collect2: error: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory /Android/openssl/apps'
make[1]: *** [openssl] Error 2
make[1]: Leaving directory
/Android/openssl/apps’
make: *** [build_apps] Error 1
INFO[0142] The command [/bin/sh -c cd openssl && ./config –static no-ssl2 no-ss
l3 no-comp no-hw no-engine && make depend && make && ls -hs . && cp l
ibssl.a /Android/output] returned a non-zero code: 2

I have sent latest docker file in email.

]]>
By: Victor Laskin https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45862 Mon, 09 Feb 2015 21:34:00 +0000 http://vitiy.info/?p=354#comment-45862 Looks like a lot of ENV variables must be set – look here: http://wiki.openssl.org/index.php/Android

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45861 Mon, 09 Feb 2015 14:40:00 +0000 http://vitiy.info/?p=354#comment-45861 Yes, initially I used it but it gave error of offending argument as below hence removed from the script later:-

Step 34 : RUN cd openssl && ./config –static android-armv7 && make && ls -hs .
&& cp libopenssl.a /Android/output
—> Running in 19bcfa72d7e2
Operating system: x86_64-whatever-linux2
Configuring for linux-x86_64
target already defined – linux-x86_64 (offending arg: android-armv7)
INFO[0001] The command [/bin/sh -c cd openssl && ./config –static android-armv7
&& make && ls -hs . && cp libopenssl.a /Android/output] returne
d a non-zero code: 255
docker@boot2docker:/home/curl_SSL$

]]>
By: Victor Laskin https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45860 Mon, 09 Feb 2015 14:10:00 +0000 http://vitiy.info/?p=354#comment-45860 Have you tried ./Configure android-armv7 as it was written at stackoverflow as i dont see this line in your Dockerfile?

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45859 Mon, 09 Feb 2015 13:51:00 +0000 http://vitiy.info/?p=354#comment-45859 I modified docker script to add few env variables & make openssl as below:

ENV ARCH_FLAGS -march=armv7 -mfloat-abi=softfp -mfpu=vfpv3-d16
ENV CPPFLAGS -std=c++11
ENV LINK $CXX
ENV ARCH_LINK -march=armv7 -Wl,–fix-cortex-a8
ENV LDFLAGS ${ARCH_LINK}
ENV CPPFLAGS ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64
ENV CXXFLAGS ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions
ENV CFLAGS ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64

# download, configure and make openssl

RUN curl -O https://www.openssl.org/source/openssl-1.0.2.tar.gz &&
tar -xzf openssl-1.0.2.tar.gz &&
mv openssl-1.0.2 openssl
RUN cd openssl && ./config –static &&
make &&
ls -hs . &&
cp libopenssl.a /Android/output

ENV CROSS_COMPILE arm-linux-androideabi

And added “–with-ssl=/Android/openssl” option to ./configure.

But I keep getting following error inspite of some trials of changing few variables.
Can’t seem to understand why it keeps complaining about line option ‘-m64’. Any idea?

Configured for linux-x86_64.
making all in crypto…
make[1]: Entering directory /Android/openssl/crypto'
/usr/bin/perl ../util/mkbuildinf.pl "arm-linux-androideabi-gcc -I. -I.. -I../inc
lude -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H --static -Wa,--n
oexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_A
SM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DS
HA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_AS
M -DECP_NISTZ256_ASM" "linux-x86_64" >buildinf.h
arm-linux-androideabi-gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT
-DDSO_DLFCN -DHAVE_DLFCN_H --static -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -
O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPEN
SSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES
_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -march=armv7 -mf
loat-abi=softfp -mfpu=vfpv3-d16 -fpic -ffunction-sections -funwind-tables -fstac
k-protector -fno-strict-aliasing -finline-limit=64 -c -o cryptlib.o cryptlib.c
arm-linux-androideabi-gcc: error: unrecognized command line option '-m64'
make[1]: Leaving directory
/Android/openssl/crypto’
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1
INFO[0034] The command [/bin/sh -c cd openssl && ./config –static && make &&
ls -hs . && cp libopenssl.a /Android/output] returned a non-zero cod
e: 2

I have also send docker script in email.

]]>
By: Rakesh Desai https://vitiy.info/dockerfile-example-to-compile-libcurl-for-android-inside-docker-container/#comment-45855 Fri, 06 Feb 2015 14:06:00 +0000 http://vitiy.info/?p=354#comment-45855 Yes, I was also looking at the same link.
Let me try out & will get back.

]]>