/usr/bin./ld: cannot find -l

      在用qmake编译qcad工程时,遇到/usr/bin/ld: cannot find -lQtWebkit。以下是解决办法:

      在ubuntu主机上输入以下命令:

ld -lQtWebKit --verbose

端口打印如下:

==================================================
attempt to open /usr/x86_64-linux-gnu/lib64/libQtWebKit.so failed
attempt to open /usr/x86_64-linux-gnu/lib64/libQtWebKit.a failed
attempt to open /usr/local/lib64/libQtWebKit.so failed
attempt to open /usr/local/lib64/llibQtWebKit.a failed
attempt to open /lib64/libQtWebKit.so failed
attempt to open /lib64/libQtWebKit.a failed
attempt to open /usr/lib64/libQtWebKit.so failed
attempt to open /usr/lib64/libQtWebKit.a failed
attempt to open /usr/x86_64-linux-gnu/lib/libQtWebKit.so failed
attempt to open /usr/x86_64-linux-gnu/lib/libQtWebKit.a failed
attempt to open /usr/local/lib/libQtWebKit.so failed
attempt to open /usr/local/lib/libQtWebKit.a failed
attempt to open /lib/libQtWebKit.so failed
attempt to open /lib/libQtWebKit.a failed
attempt to open /usr/lib/libQtWebKit.so failed
attempt to open /usr/lib/libQtWebKit.a failed
/usr/bin/ld.bfd.real: cannot find -libQtWebKit

如何到相应的目录下找相应的库:比如笔者在/usr/lib/x86_64-linux-gnu/下发现:

 ls -sl libQtWebKit.
libQtWebKit.prl              libQtWebKit.so.4       libQtWebKit.so.4.10    libQtWebKit.so.4.10.2

重新链接:

sudo ln -s libQtWebKit.so.4.10.2 libQtWebKit.so

然后重新输入ld -lQtWebKit --verbose:

==================================================
attempt to open //usr/local/lib/x86_64-linux-gnu/libQtWebKit.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libQtWebKit.a failed
attempt to open //lib/x86_64-linux-gnu/libQtWebKit.so failed
attempt to open //lib/x86_64-linux-gnu/libQtWebKit.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libQtWebKit.so succeeded
-lQtWebKit (//usr/lib/x86_64-linux-gnu/libQtWebKit.so)
libz.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libz.so.1 at //lib/x86_64-linux-gnu/libz.so.1
libXrender.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libXrender.so.1 at //usr/lib/x86_64-linux-gnu/libXrender.so.1
libjpeg.so.8 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libjpeg.so.8 at //usr/lib/x86_64-linux-gnu/libjpeg.so.8
libpng12.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libpng12.so.0 at //lib/x86_64-linux-gnu/libpng12.so.0
libxslt.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libxslt.so.1 at //usr/lib/x86_64-linux-gnu/libxslt.so.1
libxml2.so.2 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libxml2.so.2 at //usr/lib/x86_64-linux-gnu/libxml2.so.2
libgstapp-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstapp-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstapp-1.0.so.0
libgstpbutils-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstpbutils-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0
libgstvideo-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstvideo-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0
libgstaudio-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstaudio-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0
libgstbase-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstbase-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0
libgstreamer-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgstreamer-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
libgobject-2.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgobject-2.0.so.0 at //usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
libglib-2.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libglib-2.0.so.0 at //lib/x86_64-linux-gnu/libglib-2.0.so.0
libsqlite3.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libsqlite3.so.0 at //usr/lib/x86_64-linux-gnu/libsqlite3.so.0
libfontconfig.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libfontconfig.so.1 at //usr/lib/x86_64-linux-gnu/libfontconfig.so.1
libQtOpenGL.so.4 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libQtOpenGL.so.4 at //usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4
libQtGui.so.4 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libQtGui.so.4 at //usr/lib/x86_64-linux-gnu/libQtGui.so.4
libQtNetwork.so.4 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libQtNetwork.so.4 at //usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
libQtCore.so.4 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libQtCore.so.4 at //usr/lib/x86_64-linux-gnu/libQtCore.so.4
libGL.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libGL.so.1 at //usr/lib/nvidia-384/libGL.so.1
libpthread.so.0 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libpthread.so.0 at //lib/x86_64-linux-gnu/libpthread.so.0
libX11.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libX11.so.6 at //usr/lib/x86_64-linux-gnu/libX11.so.6
libstdc++.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libstdc++.so.6 at //usr/lib/x86_64-linux-gnu/libstdc++.so.6
libm.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libm.so.6 at //lib/x86_64-linux-gnu/libm.so.6
libgcc_s.so.1 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libgcc_s.so.1 at //lib/x86_64-linux-gnu/libgcc_s.so.1
libc.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtWebKit.so
found libc.so.6 at //lib/x86_64-linux-gnu/libc.so.6
libdl.so.2 needed by //usr/lib/x86_64-linux-gnu/libxml2.so.2
found libdl.so.2 at //lib/x86_64-linux-gnu/libdl.so.2
libicuuc.so.55 needed by //usr/lib/x86_64-linux-gnu/libxml2.so.2
found libicuuc.so.55 at //usr/lib/x86_64-linux-gnu/libicuuc.so.55
liblzma.so.5 needed by //usr/lib/x86_64-linux-gnu/libxml2.so.2
found liblzma.so.5 at //lib/x86_64-linux-gnu/liblzma.so.5
libgsttag-1.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libgstpbutils-1.0.so.0
found libgsttag-1.0.so.0 at //usr/lib/x86_64-linux-gnu/libgsttag-1.0.so.0
liborc-0.4.so.0 needed by //usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0
found liborc-0.4.so.0 at //usr/lib/x86_64-linux-gnu/liborc-0.4.so.0
libgmodule-2.0.so.0 needed by //usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
found libgmodule-2.0.so.0 at //usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0
librt.so.1 needed by //usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
found librt.so.1 at //lib/x86_64-linux-gnu/librt.so.1
libffi.so.6 needed by //usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
found libffi.so.6 at //usr/lib/x86_64-linux-gnu/libffi.so.6
libpcre.so.3 needed by //lib/x86_64-linux-gnu/libglib-2.0.so.0
found libpcre.so.3 at //lib/x86_64-linux-gnu/libpcre.so.3
libfreetype.so.6 needed by //usr/lib/x86_64-linux-gnu/libfontconfig.so.1
found libfreetype.so.6 at //usr/lib/x86_64-linux-gnu/libfreetype.so.6
libexpat.so.1 needed by //usr/lib/x86_64-linux-gnu/libfontconfig.so.1
found libexpat.so.1 at //lib/x86_64-linux-gnu/libexpat.so.1
libaudio.so.2 needed by //usr/lib/x86_64-linux-gnu/libQtGui.so.4
found libaudio.so.2 at //usr/lib/x86_64-linux-gnu/libaudio.so.2
libSM.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtGui.so.4
found libSM.so.6 at //usr/lib/x86_64-linux-gnu/libSM.so.6
libICE.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtGui.so.4
found libICE.so.6 at //usr/lib/x86_64-linux-gnu/libICE.so.6
libXi.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtGui.so.4
found libXi.so.6 at //usr/lib/x86_64-linux-gnu/libXi.so.6
libXext.so.6 needed by //usr/lib/x86_64-linux-gnu/libQtGui.so.4
found libXext.so.6 at //usr/lib/x86_64-linux-gnu/libXext.so.6
ld-linux-x86-64.so.2 needed by //usr/lib/x86_64-linux-gnu/libQtCore.so.4
found ld-linux-x86-64.so.2 at //lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
libnvidia-tls.so.384.130 needed by //usr/lib/nvidia-384/libGL.so.1
found libnvidia-tls.so.384.130 at //usr/lib/nvidia-384/libnvidia-tls.so.384.130
libnvidia-glcore.so.384.130 needed by //usr/lib/nvidia-384/libGL.so.1
found libnvidia-glcore.so.384.130 at //usr/lib/nvidia-384/libnvidia-glcore.so.384.130
libxcb.so.1 needed by //usr/lib/x86_64-linux-gnu/libX11.so.6
found libxcb.so.1 at //usr/lib/x86_64-linux-gnu/libxcb.so.1
libicudata.so.55 needed by //usr/lib/x86_64-linux-gnu/libicuuc.so.55
found libicudata.so.55 at //usr/lib/x86_64-linux-gnu/libicudata.so.55
libXt.so.6 needed by //usr/lib/x86_64-linux-gnu/libaudio.so.2
found libXt.so.6 at //usr/lib/x86_64-linux-gnu/libXt.so.6
libXau.so.6 needed by //usr/lib/x86_64-linux-gnu/libaudio.so.2
found libXau.so.6 at //usr/lib/x86_64-linux-gnu/libXau.so.6
libuuid.so.1 needed by //usr/lib/x86_64-linux-gnu/libSM.so.6
found libuuid.so.1 at //lib/x86_64-linux-gnu/libuuid.so.1
libXdmcp.so.6 needed by //usr/lib/x86_64-linux-gnu/libxcb.so.1
found libXdmcp.so.6 at //usr/lib/x86_64-linux-gnu/libXdmcp.so.6
ld: warning: cannot find entry symbol _start; not setting start address

这时,链接问题就解决了。

你可能感兴趣的:(tools,ubuntu,usr/bin/ld)