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

Getting "clang70: error: unknown argument: '-mandroid'" error when I try to compile on macOS #4

Open
davidfekke opened this issue Nov 28, 2018 · 1 comment

Comments

@davidfekke
Copy link

I am getting "clang70: error: unknown argument: '-mandroid'" error when I try to compile on macOS. I think this may be because by default the mac uses a 'g++' alias to clang instead of the regular GCC compiler.

Here is the full error;

Configuring OpenSSL version 1.1.0h (0x1010008fL)
    no-asan         [default]  OPENSSL_NO_ASAN
    no-crypto-mdebug [default]  OPENSSL_NO_CRYPTO_MDEBUG
    no-crypto-mdebug-backtrace [default]  OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128
    no-egd          [default]  OPENSSL_NO_EGD
    no-fuzz-afl     [default]  OPENSSL_NO_FUZZ_AFL
    no-fuzz-libfuzzer [default]  OPENSSL_NO_FUZZ_LIBFUZZER
    no-heartbeats   [default]  OPENSSL_NO_HEARTBEATS
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-msan         [default]  OPENSSL_NO_MSAN
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE
    no-ssl3         [default]  OPENSSL_NO_SSL3
    no-ssl3-method  [default]  OPENSSL_NO_SSL3_METHOD
    no-ubsan        [default]  OPENSSL_NO_UBSAN
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST
    no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS
    no-zlib         [default] 
    no-zlib-dynamic [default] 
Configuring for dist
CC            =cc
CFLAG         =-O 
SHARED_CFLAG  =
DEFINES       =NDEBUG OPENSSL_NO_DYNAMIC_ENGINE
LFLAG         =
PLIB_LFLAG    =
EX_LIBS       = 
APPS_OBJ      =
CPUID_OBJ     =mem_clr.o
UPLINK_OBJ    =
BN_ASM        =bn_asm.o
EC_ASM        =
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o rc4_skey.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
CMLL_ENC      =camellia.o cmll_misc.o cmll_cbc.o
MODES_OBJ     =
PADLOCK_OBJ   =
CHACHA_ENC    =chacha_enc.o
POLY1305_OBJ  =
BLAKE2_OBJ    =
PROCESSOR     =
RANLIB        =ranlib
ARFLAGS       =
PERL          =/usr/local/Cellar/perl/5.28.0/bin/perl

THIRTY_TWO_BIT mode

Configured for dist.

The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.

The options 'shared', 'pic' and 'dynamic-engine' aren't supported on this
platform, so we will pretend you gave the option 'no-pic', which also disables
'shared' and 'dynamic-engine'.  If you know how to implement shared libraries
or position independent code, please let us know (but please first make sure
you have tried with a current version of OpenSSL).
Building for libcrypto.a and libssl.a for armeabi
Configuring OpenSSL version 1.1.0h (0x1010008fL)
    no-asan         [default]  OPENSSL_NO_ASAN
    no-crypto-mdebug [default]  OPENSSL_NO_CRYPTO_MDEBUG
    no-crypto-mdebug-backtrace [default]  OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128
    no-egd          [default]  OPENSSL_NO_EGD
    no-fuzz-afl     [default]  OPENSSL_NO_FUZZ_AFL
    no-fuzz-libfuzzer [default]  OPENSSL_NO_FUZZ_LIBFUZZER
    no-heartbeats   [default]  OPENSSL_NO_HEARTBEATS
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-msan         [default]  OPENSSL_NO_MSAN
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE
    no-ssl3         [default]  OPENSSL_NO_SSL3
    no-ssl3-method  [default]  OPENSSL_NO_SSL3_METHOD
    no-ubsan        [default]  OPENSSL_NO_UBSAN
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST
    no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS
    no-zlib         [default] 
    no-zlib-dynamic [default] 
Configuring for android
CC            =arm-linux-androideabi-gcc
CFLAG         =-Wall -O3 -pthread -mandroid -fPIC --sysroot=$(CROSS_SYSROOT) -Wa,--noexecstack 
SHARED_CFLAG  =-fPIC -DOPENSSL_USE_NODELETE
DEFINES       =DSO_DLFCN HAVE_DLFCN_H NDEBUG OPENSSL_THREADS OPENSSL_NO_STATIC_ENGINE OPENSSL_PIC __ANDROID_API__=16
LFLAG         =
PLIB_LFLAG    =
EX_LIBS       =-ldl -pthread 
APPS_OBJ      =
CPUID_OBJ     =mem_clr.o
UPLINK_OBJ    =
BN_ASM        =bn_asm.o
EC_ASM        =
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o rc4_skey.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
CMLL_ENC      =camellia.o cmll_misc.o cmll_cbc.o
MODES_OBJ     =
PADLOCK_OBJ   =
CHACHA_ENC    =chacha_enc.o
POLY1305_OBJ  =
BLAKE2_OBJ    =
PROCESSOR     =
RANLIB        =arm-linux-androideabi-ranlib
ARFLAGS       =
PERL          =/usr/local/Cellar/perl/5.28.0/bin/perl

THIRTY_TWO_BIT mode
BN_LLONG mode
RC4 uses unsigned char

Configured for android.
rm -f libcrypto.so.1.1
rm -f libcrypto.so
rm -f libssl.so.1.1
rm -f libssl.so
rm -f libcrypto.a libssl.a
rm -f *.map
rm -f apps/openssl fuzz/asn1-test fuzz/asn1parse-test fuzz/bignum-test fuzz/bndiv-test fuzz/cms-test fuzz/conf-test fuzz/crl-test fuzz/ct-test fuzz/server-test fuzz/x509-test test/aborttest test/afalgtest test/asynciotest test/asynctest test/bad_dtls_test test/bftest test/bio_enc_test test/bioprinttest test/bntest test/buildtest_aes test/buildtest_asn1 test/buildtest_asn1t test/buildtest_async test/buildtest_bio test/buildtest_blowfish test/buildtest_bn test/buildtest_buffer test/buildtest_camellia test/buildtest_cast test/buildtest_cmac test/buildtest_cms test/buildtest_comp test/buildtest_conf test/buildtest_conf_api test/buildtest_crypto test/buildtest_ct test/buildtest_des test/buildtest_dh test/buildtest_dsa test/buildtest_dtls1 test/buildtest_e_os2 test/buildtest_ebcdic test/buildtest_ec test/buildtest_ecdh test/buildtest_ecdsa test/buildtest_engine test/buildtest_err test/buildtest_evp test/buildtest_hmac test/buildtest_idea test/buildtest_kdf test/buildtest_lhash test/buildtest_md4 test/buildtest_md5 test/buildtest_mdc2 test/buildtest_modes test/buildtest_obj_mac test/buildtest_objects test/buildtest_ocsp test/buildtest_opensslconf test/buildtest_opensslv test/buildtest_ossl_typ test/buildtest_pem test/buildtest_pem2 test/buildtest_pkcs12 test/buildtest_pkcs7 test/buildtest_rand test/buildtest_rc2 test/buildtest_rc4 test/buildtest_ripemd test/buildtest_rsa test/buildtest_safestack test/buildtest_seed test/buildtest_sha test/buildtest_srp test/buildtest_srtp test/buildtest_ssl test/buildtest_ssl2 test/buildtest_stack test/buildtest_symhacks test/buildtest_tls1 test/buildtest_ts test/buildtest_txt_db test/buildtest_ui test/buildtest_whrlpool test/buildtest_x509 test/buildtest_x509_vfy test/buildtest_x509v3 test/casttest test/cipherlist_test test/clienthellotest test/constant_time_test test/crltest test/ct_test test/d2i_test test/danetest test/destest test/dhtest test/dsatest test/dtlstest test/dtlsv1listentest test/ecdsatest test/ectest test/enginetest test/evp_extra_test test/evp_test test/exdatatest test/exptest test/fatalerrtest test/gmdifftest test/heartbeat_test test/hmactest test/ideatest test/igetest test/md2test test/md4test test/md5test test/mdc2test test/memleaktest test/ocspapitest test/p5_crpt2_test test/packettest test/pbelutest test/randtest test/rc2test test/rc4test test/rc5test test/rmdtest test/rsa_test test/sanitytest test/secmemtest test/sha1test test/sha256t test/sha512t test/shlibloadtest test/srptest test/ssl_test test/ssl_test_ctx_test test/sslapitest test/sslcorrupttest test/ssltest_old test/threadstest test/v3ext test/v3nametest test/verify_extra_test test/wp_test test/x509aux  engines/capi.so engines/dasync.so engines/ossltest.so engines/padlock.so apps/CA.pl apps/tsget tools/c_rehash util/shlib_wrap.sh
rm -f test/buildtest_camellia.c test/buildtest_buffer.c test/buildtest_safestack.c test/buildtest_cast.c test/buildtest_pem.c test/buildtest_e_os2.c test/buildtest_bio.c test/buildtest_stack.c test/buildtest_lhash.c test/buildtest_cms.c test/buildtest_conf_api.c test/buildtest_rc4.c test/buildtest_pkcs7.c test/buildtest_ssl.c test/buildtest_ui.c test/buildtest_comp.c test/buildtest_asn1t.c test/buildtest_ecdsa.c test/buildtest_ssl2.c test/buildtest_rc2.c test/buildtest_cmac.c test/buildtest_dsa.c test/buildtest_md4.c test/buildtest_pem2.c test/buildtest_opensslv.c test/buildtest_ocsp.c test/buildtest_conf.c test/buildtest_sha.c test/buildtest_dtls1.c test/buildtest_md5.c test/buildtest_bn.c test/buildtest_async.c test/buildtest_x509v3.c test/buildtest_ripemd.c test/buildtest_rsa.c test/buildtest_hmac.c test/buildtest_des.c test/buildtest_aes.c test/buildtest_objects.c test/buildtest_crypto.c test/buildtest_pkcs12.c test/buildtest_ossl_typ.c test/buildtest_whrlpool.c test/buildtest_txt_db.c test/buildtest_x509_vfy.c test/buildtest_srtp.c test/buildtest_modes.c test/buildtest_tls1.c test/buildtest_ts.c test/buildtest_idea.c test/buildtest_symhacks.c test/buildtest_seed.c test/buildtest_srp.c test/buildtest_evp.c test/buildtest_ec.c test/buildtest_asn1.c test/buildtest_x509.c test/buildtest_obj_mac.c test/buildtest_blowfish.c test/buildtest_dh.c test/buildtest_ecdh.c test/buildtest_rand.c test/buildtest_err.c test/buildtest_ct.c test/buildtest_mdc2.c test/buildtest_ebcdic.c test/buildtest_engine.c test/buildtest_opensslconf.c test/buildtest_kdf.c crypto/include/internal/bn_conf.h crypto/buildinf.h include/openssl/opensslconf.h crypto/include/internal/dso_conf.h apps/progs.h
rm -f `find . -name '*.d' -a \! -path "./.git/*"`
rm -f `find . -name '*.o' -a \! -path "./.git/*"`
rm -f core
rm -f tags TAGS doc-nits
rm -f -r test/test-runs
rm -f openssl.pc libcrypto.pc libssl.pc
rm -f `find . -type l -a \! -path "./.git/*"`
rm -f ../openssl-1.1.0h.tar
/usr/local/Cellar/perl/5.28.0/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" crypto/include/internal/bn_conf.h.in > crypto/include/internal/bn_conf.h
/usr/local/Cellar/perl/5.28.0/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" crypto/include/internal/dso_conf.h.in > crypto/include/internal/dso_conf.h
/usr/local/Cellar/perl/5.28.0/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _all
make[1]: Entering directory `/Users/davidfekke/Documents/cplusplus/projects/build-openssl-android/openssl-1.1.0h'
make[1]: Leaving directory `/Users/davidfekke/Documents/cplusplus/projects/build-openssl-android/openssl-1.1.0h'
make[1]: Entering directory `/Users/davidfekke/Documents/cplusplus/projects/build-openssl-android/openssl-1.1.0h'
arm-linux-androideabi-gcc  -I. -Icrypto/include -Iinclude -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -D__ANDROID_API__=16 -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -Wall -O3 -pthread -mandroid -fPIC --sysroot=/tmp/android-toolchain/sysroot -Wa,--noexecstack  -fPIC -DOPENSSL_USE_NODELETE -MMD -MF crypto/aes/aes_cbc.d.tmp -MT crypto/aes/aes_cbc.o -c -o crypto/aes/aes_cbc.o crypto/aes/aes_cbc.c
make[1]: Leaving directory `/Users/davidfekke/Documents/cplusplus/projects/build-openssl-android/openssl-1.1.0h'
Error executing make for platform:armeabi

@willyliu
Copy link
Owner

AFAIK, you can't build the openssl 1.1.0h with clang.
Please specify the ANDROID_NDK_ROOT so that
the script will create standalone toolchain and use the toolchain's gcc to compile.

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

2 participants