一个Qt的应用,我的pro中的LIBS += -L./ -Wl,-rpath=/usr/lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
编译后ldd -r 结果如下:
linux-gate.so.1 => (0xb7750000)
libhcnetsdk.so => /usr/lib/libhcnetsdk.so (0xb6e26000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0xb6303000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0xb601b000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb5f25000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb5f07000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb5d5d000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb5d54000)
libhpr.so => /usr/lib/libhpr.so (0xb5b31000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb5b2c000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb5b26000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb5b0b000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb5adf000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb5adb000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb59e2000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb59b8000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb59a2000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb5908000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb58b8000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb58af000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb5895000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb588b000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb5857000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb5844000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb5710000)
/lib/ld-linux.so.2 (0xb7751000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb56d4000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb56cd000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb56a2000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb5681000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb567d000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb5676000)
可见 -lhcnetsdk链接正常,但是 -lPlayCtrl -lMPCtrl却没有链接进去,也没有报错
运行时能正常启动。但是某些功能缺因为没有PlayCtrl无法用
------解决思路----------------------
没看明白,既然你的程序没有这两个库也能运行,足以说明链接时没有外部符号依赖这两个库了吧。链接器为什么要链接没用到的库呢?