【爬坑记录】undefined undefined reference to *** openssl 无法链接

爬坑记录1:-undefined undefined reference to *** openssl 无法链接

/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `PKCS12_PBE_add@OPENSSL_1.0.0'                     
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `OCSP_basic_verify@OPENSSL_1.0.0'                  
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `BIO_puts@OPENSSL_1.0.0'                           
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'           
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `BIO_free@OPENSSL_1.0.0'                           
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSLv3_client_method@OPENSSL_1.0.0'                
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ENGINE_get_id@OPENSSL_1.0.0'                      
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `RAND_status@OPENSSL_1.0.0'                        
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `MD5_Final@OPENSSL_1.0.0'                          
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_set_verify@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ASN1_TIME_print@OPENSSL_1.0.0'                    
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ENGINE_ctrl@OPENSSL_1.0.0'                        
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `CONF_modules_free@OPENSSL_1.0.0'                  
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `DES_set_key@OPENSSL_1.0.0'                        
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_set_session@OPENSSL_1.0.0'                    
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `X509_EXTENSION_get_data@OPENSSL_1.0.0'            
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ERR_error_string_n@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `OCSP_cert_status_str@OPENSSL_1.0.0'               
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_free@OPENSSL_1.0.0'                       
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `X509_check_issued@OPENSSL_1.0.0'                  
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_set_default_passwd_cb_userdata@OPENSSL_1.0
.0'                                                                                                             
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `OCSP_RESPONSE_free@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `X509_get_pubkey@OPENSSL_1.0.0'                    
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `CRYPTO_malloc@OPENSSL_1.0.0'                      
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0' 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSLeay@OPENSSL_1.0.0'                             
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `UI_method_get_opener@OPENSSL_1.0.0'               
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `X509_load_crl_file@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ENGINE_free@OPENSSL_1.0.0'                        
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ASN1_STRING_type@OPENSSL_1.0.0'                   
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ASN1_STRING_data@OPENSSL_1.0.0'                   
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `i2t_ASN1_OBJECT@OPENSSL_1.0.0'                    
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'                      
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `X509_NAME_get_entry@OPENSSL_1.0.0'                
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_add_client_CA@OPENSSL_1.0.0'              
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_get_privatekey@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `OPENSSL_load_builtin_modules@OPENSSL_1.0.0'       
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `CRYPTO_free@OPENSSL_1.0.0'                        
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `RAND_add@OPENSSL_1.0.0'                           
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ASN1_STRING_length@OPENSSL_1.0.0'                 
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CIPHER_get_name@OPENSSL_1.0.0'                
/usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `ERR_peek_error@OPENSSL_1.0.0'                     

背景:一个以前可用的项目,然而现在突然无法使用了,编译时报出上述异常信息

  • 出现上述情况的意思很明显,curl库找不到openssl对应得链接库:
  • 0: 第一步,先看下库是否真正找不到
ldd /usr/lib/x86_64-linux-gnu/libcurl.so

然后结果显示:

sbb@uface-gpu-server:~/workspace/ModelServing$ ldd /usr/lib/x86_64-linux-gnu/libcurl.so                         
/usr/lib/x86_64-linux-gnu/libcurl.so: /home/sbb/anaconda2/lib/libssl.so.1.0.0: no version information available 
(required by /usr/lib/x86_64-linux-gnu/libcurl.so)                                                              
/usr/lib/x86_64-linux-gnu/libcurl.so: /home/sbb/anaconda2/lib/libssl.so.1.0.0: no version information available 
(required by /usr/lib/x86_64-linux-gnu/libcurl.so)                                                              
/usr/lib/x86_64-linux-gnu/libcurl.so: /home/sbb/anaconda2/lib/libssl.so.1.0.0: no version information available 
(required by /usr/lib/x86_64-linux-gnu/libcurl.so)                                                              
/usr/lib/x86_64-linux-gnu/libcurl.so: /home/sbb/anaconda2/lib/libcrypto.so.1.0.0: no version information availab
le (required by /usr/lib/x86_64-linux-gnu/libcurl.so)                                                           
        linux-vdso.so.1 =>  (0x00007ffcdc15b000)                                                                
        libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f6305e54000)                             
        librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f6305c38000)                             
        libssl.so.1.0.0 => /home/sbb/anaconda2/lib/libssl.so.1.0.0 (0x00007f63059c2000)                         
        libcrypto.so.1.0.0 => /home/sbb/anaconda2/lib/libcrypto.so.1.0.0 (0x00007f6305582000)                   
        libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f6305338000)               
        liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f6305129000)                     
  • 2:就个人而言,库是能够链接的到,但是可能版本不正确,一种方法是把现在用到的库给卸载了,暂时不用;
  • 3:用了一种比较暴力的方法,将依赖库加上后缀,让链接库找不到这个库,使其默认找系统下的库;
  • 然后就是这种情况了,比较奇怪的是,这两个库有什么区别,不是一样的吗,为什么其中一个就不行
sbb@uface-gpu-server:~/workspace/ModelServing$ ldd /usr/lib/x86_64-linux-gnu/libcurl.so
        linux-vdso.so.1 =>  (0x00007fff32ab5000)
        libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007faec7b1d000)
        librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007faec7901000)
        libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007faec7698000)(找的就是他)
        libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007faec7253000)
        libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007faec7009000)
ps: 如果找不到依赖库,则需要重新安装新库;

参考链接:

  • 1: 无法链接openssl
  • 2:链接库可能问题

你可能感兴趣的:(爬坑记录)