Open Bab95 opened 2 months ago
For ./configure
to be happy, pkg-config
must find your library. It is not sufficient to set the LDFLAGS. If pkg-config finds your .pc
file, it will tell the LDFLAGS/CFLAGS to automake, anyway.
If you installed openssl via dpkg/apt, see https://github.com/tpm2-software/tpm2-tss/issues/2866#issuecomment-2247074872.
If you installed openssl manually (i.e. not via dpkg/apt), you might need to change your install location or set PKG_CONFIG_PATH
to make pkg-config
find the .pc
file (which is generated in the openssl build step)
defining PKG_CONFIG_PATH
doesn't make any difference, Issue is still the same.
Manually providing the CRYPTO_LIBS
and other flags resolve the above issue but still causing problems in make command.
./configure CRYPTO_LIBS=-L/usr/local/arm64/openssl/lib CRYPTO_CFLAGS=-I/usr/local/arm64/openssl/include CURL_LIBS=-L/usr/local/arm64/curl/lib CURL_CFLAGS=-I/usr/local/arm64/curl/include
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_context_new': esys_crypto_ossl.c:(.text+0x34): undefined reference to
OSSL_LIB_CTX_new'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_bn2binpad': esys_crypto_ossl.c:(.text+0xb4): undefined reference to
BN_num_bits'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0xe8): undefined reference to BN_bn2bin' /usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function
iesys_cryptossl_context_set_hash_md.isra.0':
esys_crypto_ossl.c:(.text+0x174): undefined reference to EVP_MD_fetch' /usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function
iesys_cryptossl_context_free.part.0':
esys_crypto_ossl.c:(.text+0x220): undefined reference to EVP_MD_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x228): undefined reference to
EVP_MD_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x230): undefined reference to OSSL_LIB_CTX_free' /usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function
iesys_cryptossl_hash_start':
esys_crypto_ossl.c:(.text+0x32c): undefined reference to EVP_MD_CTX_new' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x33c): undefined reference to
EVP_DigestInit'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_hash_update': esys_crypto_ossl.c:(.text+0x634): undefined reference to
EVP_DigestUpdate'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_hash_finish': esys_crypto_ossl.c:(.text+0x814): undefined reference to
EVP_DigestFinal'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_hmac_start': esys_crypto_ossl.c:(.text+0xcbc): undefined reference to
EVP_MD_CTX_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0xcd8): undefined reference to EVP_PKEY_new_raw_private_key' /usr/bin/ld: esys_crypto_ossl.c:(.text+0xcf4): undefined reference to
EVP_DigestSignInit'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0xd50): undefined reference to EVP_PKEY_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0xe50): undefined reference to
EVP_PKEY_free'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_hmac_update': esys_crypto_ossl.c:(.text+0x1070): undefined reference to
EVP_DigestSignUpdate'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_hmac_finish': esys_crypto_ossl.c:(.text+0x12c0): undefined reference to
EVP_DigestSignFinal'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_random2b': esys_crypto_ossl.c:(.text+0x1650): undefined reference to
OSSL_LIB_CTX_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1678): undefined reference to RAND_bytes_ex' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1684): undefined reference to
OSSL_LIB_CTX_free'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_pk_encrypt': esys_crypto_ossl.c:(.text+0x17a0): undefined reference to
OSSL_LIB_CTX_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x17dc): undefined reference to EVP_MD_fetch' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1868): undefined reference to
EVP_PKEY_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1874): undefined reference to EVP_MD_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x187c): undefined reference to
OSSL_LIB_CTX_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1914): undefined reference to BN_bin2bn' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1920): undefined reference to
OSSL_PARAM_BLD_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1938): undefined reference to OSSL_PARAM_BLD_push_BN' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1950): undefined reference to
OSSL_PARAM_BLD_push_uint32'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x19c0): undefined reference to EVP_PKEY_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x19cc): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x19d8): undefined reference to OSSL_PARAM_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x19e4): undefined reference to
OSSL_PARAM_BLD_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a08): undefined reference to OSSL_PARAM_BLD_to_param' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a24): undefined reference to
EVP_PKEY_CTX_new_from_name'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a30): undefined reference to EVP_PKEY_fromdata_init' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a50): undefined reference to
EVP_PKEY_fromdata'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a6c): undefined reference to EVP_PKEY_CTX_new' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1a80): undefined reference to
EVP_PKEY_encrypt_init'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1af8): undefined reference to EVP_PKEY_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1b00): undefined reference to
EVP_PKEY_CTX_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1b74): undefined reference to EVP_PKEY_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1b84): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1c08): undefined reference to OSSL_LIB_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1c60): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1c74): undefined reference to EVP_PKEY_CTX_set_rsa_padding' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1d08): undefined reference to
CRYPTO_strdup'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1d34): undefined reference to EVP_PKEY_CTX_set0_rsa_oaep_label' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1d58): undefined reference to
CRYPTO_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1e20): undefined reference to EVP_PKEY_CTX_set_rsa_oaep_md' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x1eb4): undefined reference to
EVP_PKEY_encrypt'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x1ef4): undefined reference to EVP_PKEY_encrypt' /usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function
iesys_cryptossl_get_ecdh_point':
esys_crypto_ossl.c:(.text+0x2138): undefined reference to EC_GROUP_new_by_curve_name' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2150): undefined reference to
EVP_PKEY_CTX_new_id'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x215c): undefined reference to EVP_PKEY_keygen_init' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2170): undefined reference to
EVP_PKEY_CTX_set_ec_paramgen_curve_nid'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2184): undefined reference to EVP_PKEY_keygen' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x21a0): undefined reference to
EVP_PKEY_get_bn_param'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x21b8): undefined reference to EVP_PKEY_get_bn_param' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x223c): undefined reference to
EC_GROUP_new_by_curve_name'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x23d4): undefined reference to EC_GROUP_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x23dc): undefined reference to
EVP_PKEY_CTX_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x23e8): undefined reference to EVP_PKEY_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x23f8): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2408): undefined reference to BN_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2418): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2490): undefined reference to EC_GROUP_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x250c): undefined reference to
EVP_PKEY_get_bn_param'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2624): undefined reference to BN_bin2bn' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x263c): undefined reference to
BN_bin2bn'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x264c): undefined reference to EC_POINT_new' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x266c): undefined reference to
EC_POINT_set_affine_coordinates'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x267c): undefined reference to EC_POINT_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x26e0): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x26e8): undefined reference to BN_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2744): undefined reference to
EC_GROUP_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2758): undefined reference to EC_POINT_is_on_curve' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2768): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2770): undefined reference to BN_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2778): undefined reference to
EC_POINT_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x279c): undefined reference to EC_POINT_mul' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2808): undefined reference to
EC_POINT_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2810): undefined reference to EC_POINT_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2828): undefined reference to
EC_POINT_get_affine_coordinates'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2a78): undefined reference to BN_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2afc): undefined reference to
BN_free'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2b04): undefined reference to BN_free' /usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function
iesys_cryptossl_sym_aes_encrypt':
esys_crypto_ossl.c:(.text+0x2cd4): undefined reference to EVP_aes_256_cfb128' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2ce8): undefined reference to
EVP_CIPHER_CTX_new'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2d00): undefined reference to EVP_EncryptInit' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2d24): undefined reference to
EVP_EncryptUpdate'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2d80): undefined reference to EVP_CIPHER_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2d94): undefined reference to
EVP_aes_128_cfb128'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x2ee8): undefined reference to EVP_aes_192_cfb128' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x2f00): undefined reference to
EVP_EncryptFinal'
/usr/bin/ld: src/tss2-esys/.libs/libtss2_esys_la-esys_crypto_ossl.o: in function iesys_cryptossl_sym_aes_decrypt': esys_crypto_ossl.c:(.text+0x30b0): undefined reference to
EVP_aes_256_cfb128'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x30b8): undefined reference to EVP_CIPHER_CTX_new' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x312c): undefined reference to
EVP_DecryptInit'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x3184): undefined reference to EVP_CIPHER_CTX_free' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x31c8): undefined reference to
EVP_aes_128_cfb128'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x31d0): undefined reference to EVP_CIPHER_CTX_new' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x325c): undefined reference to
EVP_DecryptUpdate'
/usr/bin/ld: esys_crypto_ossl.c:(.text+0x3274): undefined reference to EVP_DecryptFinal' /usr/bin/ld: esys_crypto_ossl.c:(.text+0x337c): undefined reference to
EVP_aes_192_cfb128'
collect2: error: ld returned 1 exit status
make[1]: [Makefile:12327: src/tss2-esys/libtss2-esys.la] Error 1
make[1]: Leaving directory '/usr/src/tpm2-tss'
make: [Makefile:11692: all] Error 2
To all the people who struggled out there following command worked
./configure CRYPTO_LIBS="-L/usr/local/arm64/openssl/lib -lssl -lcrypto" CRYPTO_CFLAGS="-I/usr/local/arm64/openssl/include" CURL_LIBS="-L/usr/local/arm64/curl/lib -lcurl" CURL_CFLAGS="-I/usr/local/arm64/curl/include" CFLAGS="-I/usr/local/arm64/openssl/include"
probably CRYPTO_CFLAGS
could be dropped. I don't know haven't checked. but i would still like to know why pkg-config didn't work and why i had to define CRYPTO_LIBS
flag and CURL_LIBS
flag specifically forcing to find libs not even LDFLAGS
setting was enough. If this is going to be the case then probably build instructions need to be updated.
Weird combination of flags though linking done via specific flags and include needs to be set with CFLAGS
I am building tpm2-tss repo on Arm64 arch ubuntu20.04 machine and facing missing openssl error while running configure command. I have build openssl 3.2.0 on the same machine and added path as well as defined in LDFLAGS and CFLAGS. Following are the flags and values i have configured.
when i run configure command i get libcrypto not found error
full configure command output
I am not sure what am I missing here. is there any problem in building it on arm64?