在CentOS 7 x64上编译QT时,如何解决矛盾的库问题



尝试在Linux上进行小型QT程序时。我收到警告为

/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libQt5Network.so, may conflict with libssl.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libQt5Network.so, may conflict with libcrypto.so.1.0.0

如何解决冲突?

基本上是路径上方

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/

=

/usr/lib64

我有Centos 7 x64

[root@ ]# yum list qt*
Loaded plugins: fastestmirror, replace
Loading mirror speeds from cached hostfile
 * epel: mirror.umd.edu
 * webtatic: us-east.repo.webtatic.com
Installed Packages
qt5-qtbase.x86_64           5.6.2-1.el7     @base
qt5-qtbase-common.noarch    5.6.2-1.el7     @base
qt5-qtbase-devel.x86_64     5.6.2-1.el7     @base
qt5-qtbase-gui.x86_64       5.6.2-1.el7     @base
qt5-rpm-macros.noarch       5.6.2-1.el7     @base

ldd MyProgram给出

[root@ ]# ldd MyProgram
        linux-vdso.so.1 =>  (0x00007ffe575d9000)
        libssl.so.1.0.0 => /opt/openssl-1.0.2l/lib/libssl.so.1.0.0 (0x00007f899c9f0000)
        libcrypto.so.1.0.0 => /opt/openssl-1.0.2l/lib/libcrypto.so.1.0.0 (0x00007f899c59e000)
        libQt5Network.so.5 => /lib64/libQt5Network.so.5 (0x00007f899c435000)
        libQt5Core.so.5 => /lib64/libQt5Core.so.5 (0x00007f899bfac000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f899bd8f000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f899ba87000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f899b785000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f899b56e000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f899b1ad000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f899afa9000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f899ad92000)
        libproxy.so.1 => /lib64/libproxy.so.1 (0x00007f899ab71000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007f899a8ff000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f899a49d000)
        libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007f899a09e000)
        libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007f8999d25000)
        libicudata.so.50 => /lib64/libicudata.so.50 (0x00007f8998750000)
        libpcre16.so.0 => /lib64/libpcre16.so.0 (0x00007f89984f8000)
        libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f89982f6000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f8997fbe000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f8997db6000)
        libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007f8997d8e000)
        /lib64/ld-linux-x86-64.so.2 (0x00005594debbe000)
        libmodman.so.1 => /lib64/libmodman.so.1 (0x00007f8997b85000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f8997937000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f8997650000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f899744b000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f8997219000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f8997013000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f8996dec000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f8996bc6000)
        libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007f8996944000)
        libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007f899673f000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f8996525000)
        libdw.so.1 => /lib64/libdw.so.1 (0x00007f89962dc000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f89960cd000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f8995ec9000)
        libattr.so.1 => /lib64/libattr.so.1 (0x00007f8995cc3000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f8995a62000)
        libelf.so.1 => /lib64/libelf.so.1 (0x00007f8995849000)
        libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f8995639000)

edit1:

[root@ lib64]# ls -lah libssl*
-rwxr-xr-x 1 root root 308K May 30 11:31 libssl3.so
lrwxrwxrwx 1 root root   16 Sep 19 07:46 libssl.so -> libssl.so.1.0.2k
lrwxrwxrwx 1 root root   16 Sep 19 07:45 libssl.so.10 -> libssl.so.1.0.2k
-rwxr-xr-x 1 root root 460K Aug  4 02:41 libssl.so.1.0.2k

[root@ lib64]# ls -lah libcrypto*
lrwxrwxrwx 1 root root   19 Sep 19 07:46 libcrypto.so -> libcrypto.so.1.0.2k
lrwxrwxrwx 1 root root   19 Sep 19 07:45 libcrypto.so.10 -> libcrypto.so.1.0.2k
-rwxr-xr-x 1 root root 2.4M Aug  4 02:41 libcrypto.so.1.0.2k

进行一些测试后,我注意到MyProgram使用了来自两个不同位置的库。

1来自

/usr/lib64

2来自

/opt/openssl-1.0.2l/

所以在myprogram.pro文件中,我删除了第二库包含和从标题文件中删除。

然后我做

qmake-qt5
make

一切都很好,没有矛盾的库。

[root@ns540545 ]# ldd MyProgram
        linux-vdso.so.1 =>  (0x00007ffefc9c5000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007fd8dadf7000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fd8da995000)
        libQt5Network.so.5 => /lib64/libQt5Network.so.5 (0x00007fd8da839000)
        libQt5Core.so.5 => /lib64/libQt5Core.so.5 (0x00007fd8da3b0000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd8da193000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd8d9e8b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fd8d9b89000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd8d9972000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fd8d95b1000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fd8d9363000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fd8d907b000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fd8d8e77000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fd8d8c45000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fd8d8a40000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fd8d882a000)
        libproxy.so.1 => /lib64/libproxy.so.1 (0x00007fd8d8609000)
        libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007fd8d8209000)
        libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007fd8d7e90000)
        libicudata.so.50 => /lib64/libicudata.so.50 (0x00007fd8d68bc000)
        libpcre16.so.0 => /lib64/libpcre16.so.0 (0x00007fd8d6663000)
        libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007fd8d6461000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fd8d612a000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fd8d5f21000)
        libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007fd8d5ef9000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555c995cf000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fd8d5ce9000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fd8d5ae5000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fd8d58cb000)
        libmodman.so.1 => /lib64/libmodman.so.1 (0x00007fd8d56c2000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007fd8d54bd000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fd8d5295000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fd8d506f000)
        libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007fd8d4dee000)
        libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007fd8d4be8000)
        libdw.so.1 => /lib64/libdw.so.1 (0x00007fd8d49a0000)
        libattr.so.1 => /lib64/libattr.so.1 (0x00007fd8d479a000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fd8d4539000)
        libelf.so.1 => /lib64/libelf.so.1 (0x00007fd8d4321000)
        libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fd8d4110000)

这就是固定的外观。

相关内容

  • 没有找到相关文章

最新更新