0

我正在尝试从以下网站编译示例: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。

4

2 回答 2

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-devsudo apt-get install ibgl1-mesa-dev* libglu1-mesa-dev* libqt4-opengl-dev* qt-sdk*解决了这个问题。

于 2013-02-22T14:40:53.940 回答
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
于 2013-07-30T09:53:36.723 回答