为什么 /usr/lib/libGL.so.1 总是链接到 libGL.mesa.so?

为什么 /usr/lib/libGL.so.1 总是链接到 libGL.mesa.so?

我使用 nvidia 二进制驱动程序,因此需要 /usr/lib 中的 libGL* 链接指向 /usr/lib/nvidia-current。但每当我安装一些 opengl 相关软件包时,Ubuntu 都会坚持将 libGL.so.1(而不是 libGL.so)指向 libGL.mesa.so。

到目前为止,我总是覆盖错误的链接,对此我并不介意。我真的很想知道如何修复此行为,或者我应该在哪里寻找导致此问题的可能原因。

编辑:也许我应该补充一点,我使用了来自 ubuntu-x-swat ppa 的 nvidia-current:

/u/lib> apt-cache policy nvidia-current
nvidia-current:
  Installed: 275.09.07-0ubuntu1~lucid~xup1
  Candidate: 275.09.07-0ubuntu1~lucid~xup1
  Version table:
 *** 275.09.07-0ubuntu1~lucid~xup1 0
        500 hxxp://ppa.launchpad.net/ubuntu-x-swat/x-updates/ubuntu/lucid/main Packages
        100 /var/lib/dpkg/status
     195.36.24-0ubuntu1~10.04 0
        500 hxxp://de.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Packages
     195.36.15-0ubuntu2 0
        500 hxxp://de.archive.ubuntu.com/ubuntu/ lucid/restricted Packages

我需要这些,因为我的 GTX 460 不受官方 lucid 存储库中的驱动程序支持。

~> update-alternatives --display gl_conf
gl_conf - auto mode
 link currently points to /usr/lib/nvidia-current/ld.so.conf
/usr/lib/mesa/ld.so.conf - priority 500
 slave xorg_extra_modules: /usr/lib/xorg/x11-extra-modules
/usr/lib/nvidia-current/ld.so.conf - priority 9700
 slave libvdpau_nvidia.so: /usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so
 slave libvdpau_nvidia.so.1: /usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so.1
 slave libvdpau_nvidia.so.1_lib32: /usr/lib32/nvidia-current/vdpau/libvdpau_nvidia.so.1
 slave libvdpau_nvidia.so_lib32: /usr/lib32/nvidia-current/vdpau/libvdpau_nvidia.so
 slave man_nvidiaxconfig.gz: /usr/share/man/man1/alt-nvidia-current-xconfig.1.gz
 slave nvidia-autostart.desktop: /usr/share/nvidia-current/nvidia-autostart.desktop
 slave nvidia-smi.1.gz: /usr/share/man/man1/alt-nvidia-current-smi.1.gz
 slave nvidia_bug_report: /usr/lib/nvidia-current/bin/nvidia-bug-report.sh
 slave nvidia_desktop: /usr/share/nvidia-current/ubuntu-nvidia-settings.desktop
 slave nvidia_drv: /usr/lib/nvidia-current/xorg/nvidia_drv.so
 slave nvidia_modconf: /lib/nvidia-current/modprobe.conf
 slave nvidia_smi: /usr/lib/nvidia-current/bin/nvidia-smi
 slave nvidia_xconfig: /usr/lib/nvidia-current/bin/nvidia-xconfig
 slave xorg_extra_modules: /usr/lib/nvidia-current/xorg
 slave xvmcconfig: /usr/lib/nvidia-current/XvMCConfig
Current `best' version is /usr/lib/nvidia-current/ld.so.conf.
~> ls -la /etc/alternatives/gl_conf 
lrwxrwxrwx 1 root root 34 2010-09-08 18:51 /etc/alternatives/gl_conf -> /usr/lib/nvidia-current/ld.so.conf
~> cat /usr/lib/nvidia-current/ld.so.conf 
/usr/lib/nvidia-current
/usr/lib32/nvidia-current
~>

当一切正常工作时,这是 /usr/lib/libGL 符号链接的布局:

~> ls -la /usr/lib/libGL*
-rw-r--r-- 1 root root 487480 2010-01-17 08:07 /usr/lib/libGLEW.a
lrwxrwxrwx 1 root root     16 2010-05-02 05:25 /usr/lib/libGLEW.so -> libGLEW.so.1.5.2
lrwxrwxrwx 1 root root     16 2010-05-02 05:22 /usr/lib/libGLEW.so.1.5 -> libGLEW.so.1.5.2
-rw-r--r-- 1 root root 358456 2010-01-17 08:07 /usr/lib/libGLEW.so.1.5.2
lrwxrwxrwx 1 root root     13 2010-09-08 18:25 /usr/lib/libGL.mesa.so -> mesa/libGL.so
lrwxrwxrwx 1 root root     32 2011-07-15 23:34 /usr/lib/libGL.so -> /usr/lib/nvidia-current/libGL.so
lrwxrwxrwx 1 root root     34 2011-07-16 19:01 /usr/lib/libGL.so.1 -> /usr/lib/nvidia-current/libGL.so.1
-rw-r--r-- 1 root root 929838 2010-04-29 07:54 /usr/lib/libGLU.a
lrwxrwxrwx 1 root root     11 2010-05-16 18:38 /usr/lib/libGLU.so -> libGLU.so.1
lrwxrwxrwx 1 root root     20 2010-05-16 18:38 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.070701
-rw-r--r-- 1 root root 461488 2010-04-29 07:54 /usr/lib/libGLU.so.1.3.070701

例如,当我删除并安装 libglfw2 时,只有 libGL.so.1 链接更改为指向 libGL.mesa.so:

~> sudo apt-get remove libglfw2; sudo apt-get install libglfw-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libglfw-dev libglfw2
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
[...]
The following extra packages will be installed:
  libglfw2
The following NEW packages will be installed:
  libglfw-dev libglfw2
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/86.6kB of archives.
After this operation, 360kB of additional disk space will be used.
Selecting previously deselected package libglfw2.
(Reading database ... 727685 files and directories currently installed.)
Unpacking libglfw2 (from .../libglfw2_2.6-2_amd64.deb) ...
Selecting previously deselected package libglfw-dev.
Unpacking libglfw-dev (from .../libglfw-dev_2.6-2_amd64.deb) ...
Setting up libglfw2 (2.6-2) ...

Setting up libglfw-dev (2.6-2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
~>

之后这是 /usr/lib/libGL* 布局:

~> ls -la /usr/lib/libGL*
-rw-r--r-- 1 root root 487480 2010-01-17 08:07 /usr/lib/libGLEW.a
lrwxrwxrwx 1 root root     16 2010-05-02 05:25 /usr/lib/libGLEW.so -> libGLEW.so.1.5.2
lrwxrwxrwx 1 root root     16 2010-05-02 05:22 /usr/lib/libGLEW.so.1.5 -> libGLEW.so.1.5.2
-rw-r--r-- 1 root root 358456 2010-01-17 08:07 /usr/lib/libGLEW.so.1.5.2
lrwxrwxrwx 1 root root     13 2010-09-08 18:25 /usr/lib/libGL.mesa.so -> mesa/libGL.so
lrwxrwxrwx 1 root root     32 2011-07-15 23:34 /usr/lib/libGL.so -> /usr/lib/nvidia-current/libGL.so
lrwxrwxrwx 1 root root     13 2011-07-16 20:15 /usr/lib/libGL.so.1 -> libGL.mesa.so
-rw-r--r-- 1 root root 929838 2010-04-29 07:54 /usr/lib/libGLU.a
lrwxrwxrwx 1 root root     11 2010-05-16 18:38 /usr/lib/libGLU.so -> libGLU.so.1
lrwxrwxrwx 1 root root     20 2010-05-16 18:38 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.070701
-rw-r--r-- 1 root root 461488 2010-04-29 07:54 /usr/lib/libGLU.so.1.3.070701
~>

答案1

我正在回答这个问题,如果您还有任何问题,请发表评论,我会删除它。

删除这些符号链接:

/usr/lib/libGL.mesa.so
/usr/lib/libGL.so
/usr/lib/libGL.so.1

据我所知,这些链接不应该默认存在,“替代系统”应该负责处理使用哪些 libGL 文件。

相关内容