Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to run in OSX #1

Open
chiragmewada opened this issue Feb 21, 2017 · 10 comments
Open

unable to run in OSX #1

chiragmewada opened this issue Feb 21, 2017 · 10 comments

Comments

@chiragmewada
Copy link

Hi,

Can you please help me to update my openssl for android in OSX

make depend

making depend in crypto...
../util/domd: line 26: i686-linux-android-gcc: command not found
make[1]: *** [local_depend] Error 1
make: *** [depend] Error 1
making all in crypto...
i686-linux-android-gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mandroid -I/platforms/android-14/arch-x86/usr/include -B/platforms/android-14/arch-x86/usr/lib -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -c -o cryptlib.o cryptlib.c
make[1]: i686-linux-android-gcc: No such file or directory
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1
cp: lib*.a: No such file or directory
cp: lib*.so: No such file or directory

DONE for []

@ph4r05
Copy link
Owner

ph4r05 commented Feb 21, 2017

Check out if you have Android NDK configured as required (including ENV vars - ANDROID_NDK). Check also ANDROID_SDK presence. You need Android-14 platform also.

It works for me on Mac OSX. Let me know if you resolved this

@esutton
Copy link

esutton commented Jul 19, 2018

@ph4r05 Thank you for sharing your work! I have been trying to build x86 and Arm Android OpenSSl for days now.

Your script would be super amazing if I could get it to work!

I am getting an error that it cannot find the stdlib?

Do I need to figure out how to modify script to use a standalone toolchain ?

cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory
  • macOS 10.13.6

Environment: ~/.profile

ANDROID_HOME=$HOME/Library/Android/sdk
ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
ANDROID_NDK=$ANDROID_HOME/ndk-bundle
ANDROID_NDK_HOME=$ANDROID_NDK
ANDROID_NDK_ROOT=$ANDROID_NDK

Edited: build.sh

# OpenSSL version to download if src is missing
OPENSSL_VERSION="1.0.2j"

# Set acccording to your Android NDK
ANDROID_PLATFORM="android-18"

ANDROID_ARM_TOOLCHAIN="arm-linux-androideabi-4.9"
ANDROID_X86_TOOLCHAIN="x86-4.9"
generating dummy tests (if needed)...
md2test.c => dummytest.c
rc5test.c => dummytest.c
jpaketest.c => dummytest.c

Configured for android-x86.

*** Because of configuration changes, you MUST do the following before
*** building:

	make depend
making depend in crypto...
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.
mem.c:59:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
mem_clr.c:60:20: fatal error: string.h: No such file or directory
 #include <string.h>
                    ^
compilation terminated.
o_str.c:60:19: fatal error: ctype.h: No such file or directory
 #include <ctype.h>
                   ^
compilation terminated.
o_dir.c:60:19: fatal error: errno.h: No such file or directory
 #include <errno.h>
                   ^
compilation terminated.
In file included from o_fips.c:59:0:
cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory
 # include <stdlib.h>
                     ^
compilation terminated.
In file included from o_init.c:56:0:
../e_os.h:468:28: fatal error: unistd.h: No such file or directory
 #    include OPENSSL_UNISTD
                            ^
compilation terminated.
make[1]: *** [local_depend] Error 1
make: *** [depend] Error 1
making all in crypto...
i686-linux-android-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -mandroid -I/Users/edward3/Library/Android/sdk/ndk-bundle/platforms/android-18/arch-x86/usr/include -B/Users/edward3/Library/Android/sdk/ndk-bundle/platforms/android-18/arch-x86/usr/lib -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM   -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.
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1
cp: lib*.a: No such file or directory
cp: lib*.so: No such file or directory
> DONE for []

@esutton
Copy link

esutton commented Jul 19, 2018

Actually, the first build, the arch-armeabi build succeeds in creating binaries:

arch-armeabi
└── lib
    ├── libcrypto.a
    ├── libcrypto.so
    ├── libssl.a
    └── libssl.so

It is the arch-armeabi-v7a and x86 builds that fail.

arm7

Configured for android-armv7.

*** Because of configuration changes, you MUST do the following before
*** building:

	make depend
making depend in crypto...
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.

x86

Configured for android-x86.

*** Because of configuration changes, you MUST do the following before
*** building:

	make depend
making depend in crypto...
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.
mem.c:59:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>

So something to do with stdlib on arm7 and x86?

ANDROID_HOME=/Users/edward3/Library/Android/sdk
ANDROID_SDK_ROOT=/Users/edward3/Library/Android/sdk

ANDROID_NDK=/Users/edward3/Library/Android/sdk/ndk-bundle
ANDROID_NDK_HOME=/Users/edward3/Library/Android/sdk/ndk-bundle
ANDROID_NDK_ROOT=/Users/edward3/Library/Android/sdk/ndk-bundle

It looks like stdio.h can be found under ndk-bundle.

find $ANDROID_NDK -name 'stdio.h'

/Users/edward3/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/tr1/stdio.h
/Users/edward3/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include/stdio.h
/Users/edward3/Library/Android/sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stdio.h
/Users/edward3/Library/Android/sdk/ndk-bundle/sources/android/support/include/stdio.h
/Users/edward3/Library/Android/sdk/ndk-bundle/sysroot/usr/include/bits/fortify/stdio.h
/Users/edward3/Library/Android/sdk/ndk-bundle/sysroot/usr/include/stdio.h

@esutton
Copy link

esutton commented Jul 20, 2018

Rolling back to ndk-r10e seems to have solved my build problems for macOS !!

I still cannot build on Ubuntu 18.04 using ndk-r10e. I am OK with that since macOS is my main development host.

Ubuntu build error:

i686-linux-android-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mandroid -I/home/edward3/Android/Sdk/ndk-r10e/platforms/android-14/arch-x86/usr/include -B/home/edward3/Android/Sdk/ndk-r10e/platforms/android-14/arch-x86/usr/lib -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM   -c -o cryptlib.o cryptlib.c
make[1]: i686-linux-android-gcc: Command not found
<builtin>: recipe for target 'cryptlib.o' failed

@ph4r05
Copy link
Owner

ph4r05 commented Jul 21, 2018

Interesting, I've just built it with android-ndk-r15c.

I am using macOS primarily, for Ubuntu I would need some PR.

@esutton
Copy link

esutton commented Jul 21, 2018

@ph4r05 Curious. Thanks, I will give r15c a try.

I only setup Ubuntu because I was suspected it could be a clang problem. I prefer to stay on macOS.

@ph4r05
Copy link
Owner

ph4r05 commented Jul 21, 2018

Hmm it seems there is something broken also with r15c :/

@esutton
Copy link

esutton commented Jul 21, 2018

Its seemed like newer NDKs could not find stdlib.h or a compiler.
However a find command could find either under the $ANDROID_NDK

Is a stand-alone NDK toolchain required under newer NDKs?

@gilador
Copy link

gilador commented Jul 4, 2019

Hi, is there any progress with newer NDK versions? say, r20?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@ph4r05 @esutton @gilador @chiragmewada and others