当前位置:网站首页>编译 libssl 报错

编译 libssl 报错

2022-07-07 10:26:00 qq_38781075

我用openssl是谷歌的 boringssl。

我使用其他工程的configure检查ssl时,报错找不到ssl,还好有config.log,报错就是 /lib64/libssl.so: undefined reference to `CBS_get_asn1_uint64' 这样子的错误

我手动模拟了configure文件检查ssl的逻辑(编译代码,应该是因工程而异)

# gcc -o a.out a.c -lssl
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_GROUP_get0_order'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_asn1_uint64'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `ERR_add_error_dataf'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_POINT_point2cbb'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_find_type'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_bytes'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_asn1'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_pop_free_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_AEAD_CTX_seal_scatter'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_Digest'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_STORE_up_ref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `HMAC_Final'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DigestVerify'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_set_group'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_up_ref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_up_ref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `PEM_ASN1_read_bio'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_free_ex_data'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_ctrl'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_len'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_cmp'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_NAME_cmp'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_null_sha1_tls'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_method_type'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BN_rand_range_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_u24_length_prefixed'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_AEAD_CTX_aead'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_asn1_octet_string'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_u16'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DigestVerifyInit'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_optional_asn1_octet_string'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_get0_public_key'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `i2d_X509'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `HRSS_decap'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_STORE_set_default_paths'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DigestInit_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_get0_group'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_contains_zero_byte'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_MD_CTX_md'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_POINT_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_id'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_BUFFER_up_ref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X25519'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BN_bn2cbb_padded'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_memcmp'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_AEAD_CTX_cleanup'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `HRSS_encap'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_BUFFER_len'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_parse_from_buffer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `lh_retrieve'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_set1_RSA'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_VERIFY_PARAM_set1'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_space'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BN_CTX_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_value'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_u24'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_asn1_bitstring_has_bit'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_aes_128_gcm_tls13'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_asn1_int64'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BN_CTX_end'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_peek_asn1_tag'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_s_socket'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `PEM_ASN1_write'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_new_null'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DecryptInit_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_AEAD_CTX_zero'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `HKDF_expand'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_push'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_aes_128_gcm'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_callback_ctrl'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_asn1'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `RAND_bytes'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_data'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BN_CTX_new'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `RSA_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_should_write'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `OPENSSL_memdup'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_CIPHER_CTX_init'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_CTX_set_rsa_padding'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_set_public_key'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_STORE_CTX_zero'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_asn1_int64'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `ECDSA_do_sign'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_VERIFY_PARAM_set_trust'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_any_asn1_element'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `sk_set'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_aes_256_gcm'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_reserve'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `PEM_ASN1_write_bio'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `SHA256_Final'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DigestFinal_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_DecryptFinal_ex'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_u24_length_prefixed'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBS_get_u32'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_des_ede3_cbc_sha1_tls'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BIO_write_all'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_cleanup'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_STORE_load_locations'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aes_128_cbc'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EC_KEY_new'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_add_u16'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_MUTEX_unlock_write'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_PKEY_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_CIPHER_iv_length'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_MD_type'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_chain_up_ref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_aead_aes_128_gcm_tls12'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `BUF_MEM_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CRYPTO_set_ex_data'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `EVP_sha384'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `ERR_save_state'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `CBB_init_fixed'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_STORE_CTX_cleanup'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_get_subject_name'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `ECDSA_SIG_new'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X25519_keypair'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `X509_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `PEM_read_bio_PrivateKey'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `PEM_read_bio_X509'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../lib64/libssl.so: undefined reference to `SHA256_Update'

后来发现是漏加了 -lcrypto,加了就正常了

gcc -o a.out a.c -lssl -lcrypto

原网站

版权声明
本文为[qq_38781075]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_38781075/article/details/125646532