guanzhi / GmSSL

支持国密SM2/SM3/SM4/SM9/SSL的密码工具箱
http://gmssl.org
Apache License 2.0
5.24k stars 1.67k forks source link

error while loading shared libraries: libgmssl.so.3 cannot open shared object file: No such file or directory #1291

Open bluefin1986 opened 2 years ago

bluefin1986 commented 2 years ago

make 成功过一两次,大部分都是不成功的,怎解?

/usr/local/lib 目录下确定存在 libgmssl.so.3 、libgmssl.so.3.0、 libgmssl.so

Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libgmssl.so.3.0
-- Installing: /usr/local/lib/libgmssl.so.3
-- Installing: /usr/local/lib/libgmssl.so
-- Installing: /usr/local/include/gmssl
-- Installing: /usr/local/include/gmssl/sm2.h
-- Installing: /usr/local/include/gmssl/rand.h
-- Installing: /usr/local/include/gmssl/hkdf.h
-- Installing: /usr/local/include/gmssl/x509_crl.h
-- Installing: /usr/local/include/gmssl/skf.h
-- Installing: /usr/local/include/gmssl/mem.h
-- Installing: /usr/local/include/gmssl/chacha20.h
-- Installing: /usr/local/include/gmssl/x509_alg.h
-- Installing: /usr/local/include/gmssl/sm3.h
-- Installing: /usr/local/include/gmssl/des.h
-- Installing: /usr/local/include/gmssl/version.h
-- Installing: /usr/local/include/gmssl/md5.h
-- Installing: /usr/local/include/gmssl/x509_ext.h
-- Installing: /usr/local/include/gmssl/oid.h
-- Installing: /usr/local/include/gmssl/rc4.h
-- Installing: /usr/local/include/gmssl/pem.h
-- Installing: /usr/local/include/gmssl/gcm.h
-- Installing: /usr/local/include/gmssl/hex.h
-- Installing: /usr/local/include/gmssl/aes.h
-- Installing: /usr/local/include/gmssl/sm9.h
-- Installing: /usr/local/include/gmssl/x509_req.h
-- Installing: /usr/local/include/gmssl/rsa.h
-- Installing: /usr/local/include/gmssl/x509_str.h
-- Installing: /usr/local/include/gmssl/x509_oid.h
-- Installing: /usr/local/include/gmssl/zuc.h
-- Installing: /usr/local/include/gmssl/block_cipher.h
-- Installing: /usr/local/include/gmssl/sm4.h
-- Installing: /usr/local/include/gmssl/base64.h
-- Installing: /usr/local/include/gmssl/asn1.h
-- Installing: /usr/local/include/gmssl/cms.h
-- Installing: /usr/local/include/gmssl/tls.h
-- Installing: /usr/local/include/gmssl/digest.h
-- Installing: /usr/local/include/gmssl/ec.h
-- Installing: /usr/local/include/gmssl/sdf.h
-- Installing: /usr/local/include/gmssl/gf128.h
-- Installing: /usr/local/include/gmssl/hash_drbg.h
-- Installing: /usr/local/include/gmssl/hmac.h
-- Installing: /usr/local/include/gmssl/sha3.h
-- Installing: /usr/local/include/gmssl/endian.h
-- Installing: /usr/local/include/gmssl/error.h
-- Installing: /usr/local/include/gmssl/sha2.h
-- Installing: /usr/local/include/gmssl/x509.h
-- Installing: /usr/local/include/gmssl/pbkdf2.h
-- Installing: /usr/local/include/gmssl/sha1.h
-- Installing: /usr/local/include/gmssl/pkcs8.h
-- Installing: /usr/local/bin/gmssl
-- Set runtime path of "/usr/local/bin/gmssl" to ""
root@d21c9e37bf1e:/GmSSL/build# gmssl
gmssl: error while loading shared libraries: libgmssl.so.3: cannot open shared object file: No such file or directory
841194253 commented 2 years ago

lib路径的设置问题,如果想要测试gmssl的话可以直接cd到安装路径下用export命令暂时添加lib路径进行测试,如果想要一直可以访问到的话,可以把这些lib文件copy到/usr/lib下,也可以修改/etc/ld.so.conf文件添加相应的路径,然后执行ldconfig命令再进行测试,如果我的意思没有表达清楚的话,可以参考这这个链接https://blog.csdn.net/feikudai8460/article/details/119991974

bluefin1986 commented 2 years ago

lib路径的设置问题,如果想要测试gmssl的话可以直接cd到安装路径下用export命令暂时添加lib路径进行测试,如果想要一直可以访问到的话,可以把这些lib文件copy到/usr/lib下,也可以修改/etc/ld.so.conf文件添加相应的路径,然后执行ldconfig命令再进行测试,如果我的意思没有表达清楚的话,可以参考这这个链接https://blog.csdn.net/feikudai8460/article/details/119991974

可以了,感谢!

但是,为什么我曾经成功过几次呢?

841194253 commented 2 years ago

lib路径的设置问题,如果想要测试gmssl的话可以直接cd到安装路径下用export命令暂时添加lib路径进行测试,如果想要一直可以访问到的话,可以把这些lib文件copy到/usr/lib下,也可以修改/etc/ld.so.conf文件添加相应的路径,然后执行ldconfig命令再进行测试,如果我的意思没有表达清楚的话,可以参考这这个链接https://blog.csdn.net/feikudai8460/article/details/119991974

可以了,感谢!

但是,为什么我曾经成功过几次呢?

很抱歉,我才疏学浅,这个原因我就不清楚了,需要具体情况具体分析的。

NekoCompiler commented 1 year ago

楼上说的什么*玩意 cp /usr/local/lib/libgmssl.so.3 /usr/lib64

[root@localhost lib]# gmssl version
GmSSL 3.0.0
NekoCompiler commented 1 year ago

楼上说的什么*玩意 cp /usr/local/lib/libgmssl.so.3 /usr/lib64

[root@localhost lib]# gmssl version
GmSSL 3.0.0

楼主看完可以close了

tangjpA1 commented 1 year ago

楼主英明,但是为什么他自己生成的路径不直接生成到/usr/lib64这里面呢?还需要我copy一把

windqyoung commented 1 year ago

ln -s /usr/local/lib/libgmssl.so.3 /usr/lib/libgmssl.so.3 ln -s /usr/local/lib/libgmssl.so.3 /usr/lib64/libgmssl.so.3

做了两个软链, 正确运行了.

希望安装脚本能改一下, 主动把软链接做好.

PikaByter commented 3 months ago

楼主英明,但是为什么他自己生成的路径不直接生成到/usr/lib64这里面呢?还需要我copy一把

最正确的办法是 ldconfig,让系统重新加载lib,系统不会时时监控lib目录的,你需要手动刷新,这命令类似于source .bashrc

goudan8484 commented 5 days ago

在linux下,我遇到的情况是:基于debian的系统,比如ubuntu,正常安装完,ldconfig一下就可以直接gmssl命令;但是在centos下,需要手动把生成的so copy到/usr/lib64下。也就是目录的不同。