我正在尝试使用gDEBugger调试OpenGl项目,但不幸的是,gDEBugger甚至还没有启动:

~/bin/gDEBugger581-x86_64> ./gDEBugger-bin
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
Segmentation fault
~/bin/gDEBugger581-x86_64> LIBGL_DEBUG=verbose ./gDEBugger-bin
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib64/dri/updates/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/updates/swrast_dri.so
libGL error: dlopen /usr/lib64/dri/updates/swrast_dri.so failed (/usr/lib64/dri/updates    /swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL error: dlopen /usr/lib64/dri/swrast_dri.so failed (/usr/lib64/dri/swrast_dri.so:     undefined symbol: _glapi_tls_Dispatch)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Segmentation fault

最新的gremedy版本(5.8.1),最新的AMD版本(6.2.4)和最新的CodeXL版本会发生这种情况(CodeXL不会崩溃,但相同的错误会越来越少,并且调试不会起作用)。

我使用的是OpenSuse 13.1,安装了NVIDIA卡和最新的驱动程序。其他OpenGL程序也可以正常工作。到目前为止,我已经尝试过重新安装NVIDIA驱动程序,重新安装所有MESA软件包,将CUDA从5.5更新到6.5,检查是否已从标准suse repo中安装了所有mesa软件包并运行了ldd:
~/bin/gDEBugger581-x86_64> ldd gDEBugger-bin
    linux-vdso.so.1 (0x00007fffe9ffe000)
    libGRBaseTools.so => ./libGRBaseTools.so (0x00007f41df93e000)
    libGROSWrappers.so => ./libGROSWrappers.so (0x00007f41df6cc000)
    libGRAPIClasses.so => ./libGRAPIClasses.so (0x00007f41df358000)
    libGRProcessDebugger.so => ./libGRProcessDebugger.so (0x00007f41df123000)
    libGRApiFunctions.so => ./libGRApiFunctions.so (0x00007f41deedf000)
    libGRApplicationComponents.so => ./libGRApplicationComponents.so (0x00007f41debce000)
    libgDEBuggerAppCode.so => ./libgDEBuggerAppCode.so (0x00007f41de5b0000)
    libwx_base-2.8.so.0 => ./libwx_base-2.8.so.0 (0x00007f41de29e000)
    libwx_gtk2_core-2.8.so.0 => ./libwx_gtk2_core-2.8.so.0 (0x00007f41ddcd9000)
    libwx_gtk2_html-2.8.so.0 => ./libwx_gtk2_html-2.8.so.0 (0x00007f41dda2f000)
    libwx_gtk2_adv-2.8.so.0 => ./libwx_gtk2_adv-2.8.so.0 (0x00007f41dd753000)
    libwx_gtk2_aui-2.8.so.0 => ./libwx_gtk2_aui-2.8.so.0 (0x00007f41dd4e2000)
    libwx_gtk2_gl-2.8.so.0 => ./libwx_gtk2_gl-2.8.so.0 (0x00007f41dd2d5000)
    libwx_gtk2_stc-2.8.so.0 => ./libwx_gtk2_stc-2.8.so.0 (0x00007f41dcfcb000)
    libfreeimage.so.3 => ./libfreeimage.so.3 (0x00007f41dcc35000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f41dc92d000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f41dc62a000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f41dc413000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f41dc065000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f41dbe61000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f41dbc59000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f41dba3b000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f41db6fd000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f41db4e7000)
    libGL.so.1 => /usr/X11R6/lib64/libGL.so.1 (0x00007f41db19b000)
    libgtk-x11-2.0.so.0 => /usr/lib64/libgtk-x11-2.0.so.0 (0x00007f41dab5c000)
    libgdk-x11-2.0.so.0 => /usr/lib64/libgdk-x11-2.0.so.0 (0x00007f41da8a7000)
    libatk-1.0.so.0 => /usr/lib64/libatk-1.0.so.0 (0x00007f41da683000)
    libgio-2.0.so.0 => /usr/lib64/libgio-2.0.so.0 (0x00007f41da31c000)
    libpangoft2-1.0.so.0 => /usr/lib64/libpangoft2-1.0.so.0 (0x00007f41da108000)
    libgdk_pixbuf-2.0.so.0 => /usr/lib64/libgdk_pixbuf-2.0.so.0 (0x00007f41d9ee7000)
    libpango-1.0.so.0 => /usr/lib64/libpango-1.0.so.0 (0x00007f41d9c9b000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007f41d9a09000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007f41d97cc000)
    libgobject-2.0.so.0 => /usr/lib64/libgobject-2.0.so.0 (0x00007f41d957b000)
    libgmodule-2.0.so.0 => /usr/lib64/libgmodule-2.0.so.0 (0x00007f41d9377000)
    libgthread-2.0.so.0 => /usr/lib64/libgthread-2.0.so.0 (0x00007f41d9175000)
    libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007f41d8e72000)
    libXinerama.so.1 => /usr/lib64/libXinerama.so.1 (0x00007f41d8c6f000)
    libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x00007f41d8a69000)
    libSM.so.6 => /usr/lib64/libSM.so.6 (0x00007f41d8861000)
    libGLU.so.1 => /usr/lib64/libGLU.so.1 (0x00007f41d85e2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f41dfb49000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f41d83c3000)
    libnvidia-tls.so.340.32 => /usr/lib64/tls/libnvidia-tls.so.340.32 (0x00007f41d81c0000)
    libnvidia-glcore.so.340.32 => /usr/lib64/libnvidia-glcore.so.340.32 (0x00007f41d55ad000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f41d539b000)
    libpangocairo-1.0.so.0 => /usr/lib64/libpangocairo-1.0.so.0 (0x00007f41d518e000)
    libXfixes.so.3 => /usr/lib64/libXfixes.so.3 (0x00007f41d4f88000)
    libcairo.so.2 => /usr/lib64/libcairo.so.2 (0x00007f41d4c69000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00007f41d4a5f000)
    libXi.so.6 => /usr/lib64/libXi.so.6 (0x00007f41d484f000)
    libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x00007f41d4645000)
    libXcursor.so.1 => /usr/lib64/libXcursor.so.1 (0x00007f41d443a000)
    libXcomposite.so.1 => /usr/lib64/libXcomposite.so.1 (0x00007f41d4237000)
    libXdamage.so.1 => /usr/lib64/libXdamage.so.1 (0x00007f41d4034000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f41d3e10000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f41d3bf9000)
    libharfbuzz.so.0 => /usr/lib64/libharfbuzz.so.0 (0x00007f41d39a6000)
    libpng16.so.16 => /usr/lib64/libpng16.so.16 (0x00007f41d3769000)
    libexpat.so.1 => /usr/lib64/libexpat.so.1 (0x00007f41d353f000)
    libffi.so.4 => /usr/lib64/libffi.so.4 (0x00007f41d3337000)
    libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f41d30d1000)
    libICE.so.6 => /usr/lib64/libICE.so.6 (0x00007f41d2eb5000)
    libuuid.so.1 => /usr/lib64/libuuid.so.1 (0x00007f41d2cb0000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f41d2aac000)
    libpixman-1.so.0 => /usr/lib64/libpixman-1.so.0 (0x00007f41d2803000)
    libEGL.so.1 => /usr/X11R6/lib64/libEGL.so.1 (0x00007f41d24fa000)
    libxcb-shm.so.0 => /usr/lib64/libxcb-shm.so.0 (0x00007f41d22f7000)
    libxcb-render.so.0 => /usr/lib64/libxcb-render.so.0 (0x00007f41d20ed000)
    libgraphite2.so.3 => /usr/lib64/libgraphite2.so.3 (0x00007f41d1ed1000)
    libnvidia-glsi.so.340.32 => /usr/lib64/libnvidia-glsi.so.340.32 (0x00007f41d1c49000)

我注意到,当使用LIBGL_DEBUG=verbose运行我自己的程序时,根本没有libGL输出。我正在使用glfw 2.7和gleww 1.9(如果很重要)。 glut应用程序正常工作。

我想gDEBugger有另一种查找和加载libGL的方式,并且某种程度上它最终使用的是台面平台而不是nvidia平台。但是我对mesa和nvidia驱动程序及其运作的了解非常有限。

编辑:
新讯息:
strace -e open ./gDEBugger-bin 2>&1 | grep libGL.so
open("./tls/x86_64/libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("./tls/libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("./x86_64/libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("./libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib64/mpi/gcc/openmpi/lib64/libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/damdam/bin/pgmodeler/libGL.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/X11R6/lib64/libGL.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/X11R6/lib64/libGL.so.340.32", O_RDONLY) = 3
open("/usr/X11R6/lib64/libGL.so.340.32", O_RDONLY) = 3
open("/usr/X11R6/lib64/libGL.so.340.32", O_RDONLY) = 4
open("/usr/lib64/libGL.so.1", O_RDONLY|O_CLOEXEC) = 7
open("/usr/X11R6/lib64/libGL.so.340.32", O_RDONLY) = 7
open("/usr/lib64/libGL.so.1", O_RDONLY) = 7

为了进行比较,对于一个工作程序,这是相同的:http://paste.opensuse.org/76645738
这是完整的输出(没有grep):http://paste.opensuse.org/8336779

我试图在/usr/lib64/中设置以下链接:
 libGLESv1_CM.so -> /usr/X11R6/lib64/libGLES
 libGLESv1_CM.so.1 -> /usr/X11R6/lib64/libGL
 libGLESv1_CM.so.1.1.0 -> /usr/X11R6/lib64/l
 libGLESv2.so -> /usr/X11R6/lib64/libGLESv2.
 libGLESv2.so.2 -> /usr/X11R6/lib64/libGLESv
 libGLESv2.so.2.0.0 -> /usr/X11R6/lib64/libG
 libGL.so -> /usr/X11R6/lib64/libGL.so
 libGL.so.1 -> /usr/X11R6/lib64/libGL.so
 libGL.so.1.2 -> /usr/X11R6/lib64/libGL.so
 libGL.so.1.2.0 -> /usr/X11R6/lib64/libGL.so

之后,行为改变了,程序崩溃并出现段错误,并且不打印任何内容。

编辑:
新讯息
gremedy gDEBugger(5.8.1)不再加载/usr/lib64/libGL.so
 export LIBGL_DRIVERS_PATH="/usr/X11R6/lib64/"

它只是崩溃。所以我现在的猜测是,它一直都知道正确的libGL,但是无法加载它。我的系统是否有些奇怪,或者我是有关此问题的第一份报告。

最佳答案

我在相同的发行版,相同的发行版中遇到了相同的问题。最终,我将其追溯到环境变量LD_LIBRARY_PATH

我已将/usr/lib//usr/lib64/添加到LD_LIBRARY_PATH中,以尝试解决链接问题。似乎将这些目录包括在LD_LIBRARY_PATH中意味着从包Mesa-libGL1中的/usr/lib64/libGL.so.1隐藏了从包/usr/X11R6/lib64/libGL.so.1中的x11-video-nvidiaG02

在没有这两个目录的情况下重新导出LD_LIBRARY_PATH时,libGL已被整理并再次运行。

10-07 16:26