Bug 70766 - Run-time link error in swrast_dri.so
Summary: Run-time link error in swrast_dri.so
Status: RESOLVED DUPLICATE of bug 81785
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-22 14:53 UTC by Andreas Hartmetz
Modified: 2014-09-22 19:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Andreas Hartmetz 2013-10-22 14:53:01 UTC
I actually have a card supported by the radeonsi driver, but, probably due to the error reported here, hardware-supported 3D is not available under X. I think the error here would also apply to radeonsi if Mesa attempted to load it.

When I run glxinfo, I get:

name of display: :0
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /opt/xorg/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /opt/xorg/lib/dri/swrast_dri.so
libGL error: dlopen /opt/xorg/lib/dri/swrast_dri.so failed (/opt/xorg/lib/dri/swrast_dri.so: undefined symbol: _ZTIN4llvm11raw_ostreamE)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  0
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  33
  Current serial number in output stream:  33


The demangled name of "_ZTIN4llvm11raw_ostreamE" is "typeinfo for llvm::raw_ostream". LLVM is compiled without RTTI. Mesa has a class that inherits llvm::raw_ostream and is compiled without -fno-rtti. That might be the code that triggers the problem:

src/gallium/auxiliary/gallivm/lp_bld_debug.cpp:
class raw_debug_ostream :
   public llvm::raw_ostream
{


I experimentally patched Mesa like so:

mesa$ git diff
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index 2d2d8d4..d961243 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -10,7 +10,7 @@ AM_CFLAGS = \
        $(GALLIUM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) -fno-rtti 
 
 libgallium_la_SOURCES = \
        $(C_SOURCES) \
@@ -23,7 +23,7 @@ AM_CFLAGS += \
 
 AM_CXXFLAGS += \
        $(GALLIUM_CFLAGS) \
-       $(LLVM_CXXFLAGS)
+       $(LLVM_CXXFLAGS) -fno-rtti 
 
 libgallium_la_SOURCES += \
        $(GALLIVM_SOURCES) \

and recompiled.
That seemed to fix the problem for me:

$ glxinfo
name of display: :0
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /opt/xorg/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /opt/xorg/lib/dri/swrast_dri.so
libGL: Can't open configuration file /home/horst/.drirc: No such file or directory.
libGL: Can't open configuration file /home/horst/.drirc: No such file or directory.
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, 
    GLX_OML_swap_method, GLX_SGIS_multisample, GLX_SGIX_fbconfig, 
    GLX_SGIX_pbuffer, GLX_SGI_make_current_read
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
(...)


My configure invocation, extracted from config.status, is:

'./configure'  '--prefix=/opt/xorg' '--with-egl-platforms=x11,drm' '--enable-gbm' '--enable-shared-glapi' '--enable-glx-tls' '--enable-gles1' '--enable-gles2' '-disable-xvmc' '--with-gallium-drivers=r300,r600,svga,swrast,radeonsi' 'PKG_CONFIG_PATH=/opt/xorg/share/pkgconfig:/opt/xorg/lib/pkgconfig:/opt/kde4/lib/x86_64-linux-gnu/pkgconfig:/opt/kde4/lib/pkgconfig'


Both LLVM and Mesa versions are very current, maybe two hours old at the time of this writing.
Comment 1 octoploid 2013-11-19 09:11:30 UTC
Similar thing here:
 (EE) AIGLX error: dlopen of /usr/lib64/dri/r600_dri.so failed (/usr/lib64/dri/r600_dri.so: undefined symbol: _ZTIN4llvm18format_object_baseE)
 (EE) AIGLX error: dlopen of /usr/lib64/dri/swrast_dri.so failed (/usr/lib64/dri/swrast_dri.so: undefined symbol: _ZTIN4llvm18format_object_baseE) 

 % c++filt _ZTIN4llvm18format_object_baseE
typeinfo for llvm::format_object_base

Your patch to src/gallium/auxiliary/Makefile.am fixes the issue.

Please note that:
 % llvm-config --cxxflags
-I/usr/local/include  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -O3 -DNDEBUG -pipe  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
doesn't include -fno-rtti for llvm 3.4 even when llvm was build without
run-time type information (the default).
Comment 2 Jan Vesely 2013-11-19 15:55:54 UTC
did you use cmake to compile llvm?
Comment 3 Jan Vesely 2013-11-19 15:57:27 UTC
(In reply to comment #2)
> did you use cmake to compile llvm?

check this patch:
http://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg45916.html
Comment 4 Andreas Hartmetz 2013-11-27 22:24:35 UTC
The LLVM patch does the trick for me.  With the patch, llvm-config --cxxflags output contains -fno-rtti (at the very end) and Mesa drivers radeonsi and swrast can be loaded.
Comment 5 Andreas Hartmetz 2013-12-04 16:30:01 UTC
For completeness because I forgot to say it explicitly: Yes, I'm using cmake.
Also hello LLVM, if anybody sees this... that patch is important.
Comment 6 Emil Velikov 2014-09-22 19:14:51 UTC
Marking this as a duplicate of 81785 which has a lot more information + including a link to the actual llvm/cmake fix. Now all we need is to convince the llvm people to actually push it (or equivalent fix of course) :P

*** This bug has been marked as a duplicate of bug 81785 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.