lzhiyong / android-sdk-tools

building android-sdk tools for Android
Apache License 2.0
378 stars 65 forks source link

Failed to link AAPT2 with libcrypto #10

Closed itsaky closed 3 years ago

itsaky commented 3 years ago

Hello,

I'm trying to build AAPT2. But the build fails at the linking stage with the following error :

ld: error: undefined symbol: aes_hw_encrypt
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_wrap_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_wrap_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 19 more times

ld: error: undefined symbol: vpaes_encrypt
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_wrap_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_wrap_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 19 more times

ld: error: undefined symbol: aes_hw_decrypt
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_decrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_unwrap_key_inner) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_unwrap_key_inner) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 16 more times

ld: error: undefined symbol: vpaes_decrypt
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_decrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_unwrap_key_inner) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_unwrap_key_inner) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 16 more times

ld: error: undefined symbol: aes_hw_set_encrypt_key
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_set_encrypt_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(CTR_DRBG_init) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 3 more times

ld: error: undefined symbol: vpaes_set_encrypt_key
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_set_encrypt_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(CTR_DRBG_init) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 3 more times

ld: error: undefined symbol: aes_hw_set_decrypt_key
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_set_decrypt_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(boringssl_fips_self_test) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_init_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a

ld: error: undefined symbol: vpaes_set_decrypt_key
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_set_decrypt_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(boringssl_fips_self_test) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_init_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a

ld: error: undefined symbol: aes_hw_ctr32_encrypt_blocks
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_ctr128_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_ctr128_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: vpaes_ctr32_encrypt_blocks
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_ctr128_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_ctr128_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: aes_hw_cbc_encrypt
>>> referenced by bcm.c
>>>               bcm.c.o:(AES_cbc_encrypt) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(boringssl_fips_self_test) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_init_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 3 more times

ld: error: undefined symbol: bn_mul_mont
>>> referenced by bcm.c
>>>               bcm.c.o:(BN_mod_mul_montgomery) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(bn_mod_mul_montgomery_small) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a

ld: error: undefined symbol: gcm_init_v8
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(CRYPTO_gcm128_init_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 2 more times

ld: error: undefined symbol: gcm_ghash_v8
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: gcm_gmult_v8
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: gcm_init_neon
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(CRYPTO_gcm128_init_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 2 more times

ld: error: undefined symbol: gcm_ghash_neon
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: gcm_gmult_neon
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(aes_ctr_set_key) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 7 more times

ld: error: undefined symbol: sha256_block_data_order
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA224) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA224) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA256) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 13 more times

ld: error: undefined symbol: sha512_block_data_order
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA384) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA384) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced by bcm.c
>>>               bcm.c.o:(SHA512) in archive /data/data/com.termux/files/home/sdk-tools/cmake/lib/libs/libcrypto.a
>>> referenced 20 more times

I built boringssl successfully. Running nm to find symbol
sha512_block_data_order in libcrypto.a give the following output :

$ nm libcrypto.a | grep sha512_block_data_order
                U sha512_block_data_order

It's undefined in the library. Could you help me fix this?

I just wanted to build AAPT2. So I built all the required libraries one by one and put them in a single folder libs.

itsaky commented 3 years ago

Fixed it by rebuilding boringssl.

oSumAtrIX commented 2 years ago

This still happens. Including the directory with the CMakeLists.txt of boringssl still does not build the library.