question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

failed to build with NDK 11 or higher (failed to build openssl)

See original GitHub issue

The pre-build version got a negative number for os.path.getsize() with 4GB file. So I try to build my version to test. ( http://stackoverflow.com/questions/5167120/why-does-os-path-getsize-return-a-negative-number-for-a-10gb-file )

But I got a fatal error when building openssl

ubuntu 16.04 android-ndk-r13b

build command:

CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" NDK_PATH=/home/ubuntu/source/android-ndk-r13b make build 
make[2]: Leaving directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl/.build_armeabi'

Since you've disabled or enabled at least one algorithm, you need to do
the following before building:

        make depend

Configured for android.
# make -C .build_armeabi/ depend
make -C .build_armeabi/ all
make[2]: Entering directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl/.build_armeabi'
making all in crypto...
make[3]: Entering directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl/.build_armeabi/crypto'
/usr/bin/perl ../util/mkbuildinf.pl ""arm-linux-androideabi-"gcc -mtune=xscale -march=armv5te -msoft-float --sysroot=/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fvisibility=default -fPIE -mandroid -I/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm/usr/include -B/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm/usr/lib -O3 -fomit-frame-pointer -Wall" "android" >buildinf.h
"arm-linux-androideabi-"gcc -mtune=xscale -march=armv5te -msoft-float --sysroot=/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fvisibility=default -fPIE -mandroid -I/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm/usr/include -B/home/ubuntu/source/android-ndk-r13b/platforms/android-4/arch-arm/usr/lib -O3 -fomit-frame-pointer -Wall   -c -o cryptlib.o cryptlib.c
In file included from cryptlib.c:117:0:
cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory
 # include <stdlib.h>
                     ^
compilation terminated.
<builtin>: recipe for target 'cryptlib.o' failed
make[3]: *** [cryptlib.o] Error 1
make[3]: Leaving directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl/.build_armeabi/crypto'
Makefile:284: recipe for target 'build_crypto' failed
make[2]: *** [build_crypto] Error 1
make[2]: Leaving directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl/.build_armeabi'
Makefile:78: recipe for target '.build_armeabi/libcrypto.so' failed
make[1]: *** [.build_armeabi/libcrypto.so] Error 2
make[1]: Leaving directory '/home/ubuntu/source/py4a/python-for-android-master/python-build/openssl'
Makefile:75: recipe for target '.build_openssl' failed
make: *** [.build_openssl] Error 2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kuri65536commented, Jan 6, 2017

Please use NDK 10e. I try to build with NDK 13 and then 11, some problem with these NDK and can not solve it (I have no much time to solve them…)

1reaction
hollychen503commented, Nov 22, 2016

Aha, I known how to fix it.

Modify the /path/to/python-for-android/python-build/openssl/Makefile

Change the ANDROID_API to your NDK platform version. The default is android-4. It may not in your NDK anymore.

for example:

  # setup arch depended variables: arm
  $(OPENSSL_BIN_arm): export ANDROID_API := android-19
Read more comments on GitHub >

github_iconTop Results From Across the Web

Openssl Build Issue with Android NDK r8
I ran into the same issue and fixed it by modifying OpenSSL1.0.1cForAndroid/crypto/Android.mk, adding libzib to the export list:
Read more >
Use the NDK with other build systems
The purpose of this document is to describe how to build existing code that uses other build systems. This is often the case...
Read more >
Android - OpenSSLWiki
This document will provide instructions for building the OpenSSL library for Android devices. If you need the FIPS Validated Object Module ...
Read more >
Can't compile open-ssl to android - help
OpenSSL dependency isn't built using just the Rust compiler. It needs a special C compiler able to cross-compile to Android, or a pre-compiled...
Read more >
OpenSSL for Android support
macOS Using Android NDK r10e ... On macOS, building OpenSSL fails when using NDK 11 or greater. Work-around is to download and use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found