我正在尝试从以下网站编译示例:http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
起初CMake
无法找到libGL.so,所以我将其指向txt文件中的lib(/usr/lib/x86_64-linux-gnu/mesa/libGL.so)。之后我尝试了make all
,这给了我以下error: /usr/bin/ld: cannot find -lGL
。根据我的发现,这意味着ld无法找到libGL.so,但如果我输入locate libGL
,我会收到以下响应:
/home/jacko/.local/share/Steam/SteamApps/common/Cave Story+/lib/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6.0
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLU.so.1.3.08004
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/share/doc/nvidia-cg-toolkit/examples/Tools/trace/libGL.so.1.gz
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6.0
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLU.so.1.3.08004
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/share/doc/nvidia-cg-toolkit/examples/Tools/trace/libGL.so.1.gz
/opt/cave-story-plus/lib64/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/libGLU.a
/usr/lib/x86_64-linux-gnu/libGLU.so
/usr/lib/x86_64-linux-gnu/libGLU.so.1
/usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0.0
/usr/lib/x86_64-linux-gnu/qtcreator/plugins/Nokia/libGLSLEditor.so
/usr/lib32/libGL.so
在我看来,像libGL一样完全可用。
也:
~$ sudo apt-get install libgl1-mesa-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgl1-mesa-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我正在使用开源AMD驱动程序运行Xubuntu 12.10。
答案 0 :(得分:2)
如果其他人也遇到过这种情况:/usr/lib/x86_64-linux-gnu/libGL.so和/usr/lib/x86_64-linux-gnu/mesa/libGL.so之间的符号链接消失了。我做了sudo apt-get remove --purge libgl1-mesa-dev
和sudo apt-get install ibgl1-mesa-dev* libglu1-mesa-dev* libqt4-opengl-dev* qt-sdk*
来解决这个问题。
答案 1 :(得分:1)
也许这个简单的脚本会帮助某人。 1个答案对我有帮助,但是这个脚本完成了缺失的事情。
#!/bin/bash
DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' libglfw-dev'
DEPENDS+=' g++'
DEPENDS+=' libzip-dev'
DEPENDS+=' libglew*-dev'
MISSING=
echo "Checking for missing packages ..."
for i in $DEPENDS; do
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
MISSING+="$i "
fi
done
if [ -n "$MISSING" ]; then
TXTCOLOR_DEFAULT="\033[0;m"
TXTCOLOR_GREEN="\033[0;32m"
echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT
sudo apt-get --force-yes --yes install $MISSING
fi