# swrast_dri.so _glapi_tls_Dispatch only with CodeXL

## newin

Hi,

I am currently writing an OpenGL program and when I tried to debug the GPU side using CodeXL and gDebugger I get:

```
newin@legion ~ %  codeXL                   

libGL error: unable to load driver: swrast_dri.so

libGL error: failed to load driver: swrast
```

in verbose:

```
newin@legion ~ % LIBGL_DEBUG=verbose codeXL

libGL: screen 0 does not appear to be DRI2 capable

libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so

libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so

libGL: 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

function is no-op

ukiDynamicMajor: found major device number 250

ukiDynamicMajor: found major device number 250

ukiDynamicMajor: found major device number 250

....

```

where is get's interesting/strange it's when I search the symbol using readelf:

```
newin@legion ~ % readelf -Ws /usr/lib64/dri/swrast_dri.so | grep _glapi_tls_Dispatch

    35: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND _glapi_tls_Dispatch
```

So the symbol is here but "UND" so I naively try to LD_PRELOAD something that have it

after some violent readelf * I found that /usr/lib/libglapi.so seems to have the symbol so I LD_PRELOAD with it and I get:

```
newin@legion lib % LIBGL_DEBUG=verbose LD_PRELOAD=/usr/lib/libglapi.so codeXL        

libGL: screen 0 does not appear to be DRI2 capable

libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so

libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so

libGL: Can't open configuration file /home/newin/.drirc: No such file or directory.

libGL: Can't open configuration file /home/newin/.drirc: No such file or directory.

libGL error: No matching fbConfigs or visuals found

libGL error: failed to load driver: swrast

function is no-op

ukiDynamicMajor: found major device number 250

ukiDynamicMajor: found major device number 250

ukiDynamicMajor: found major device number 250
```

the symbol error seems to have disapeared but it still cannot load swrast so I think that was not a good strategy.

The last thing that come to my mind is a 32/64bit problem but codeXL/gDebugger are both in ELF64 and my drivers are also in ELF64

Even stranger CodeXL and gDebugger actually run (every other similar problem that I found on internet the program crash at startup). It run but when I start to debug my OpenGL program I get a SIGSEGV at the first OpenGL call that need more than OGL1.4 which does not happen when I run my program without it.

From here I'm lost I don't know what to try or what happen  :Sad: 

I use fglrx-15.9-r1/Xorg-1.17.4 with a M370X (I also have an intel card but I did not even install the driver) on gentoo-4.4.6, my drivers are working really well (I run Unreal Engine 4 nearly everyday)

----------

## newin

CodeXL 2.2 has just been released and my Code does not SIGSEGV anymore with it but I still get the wierd "libGL error: unable to load driver: swrast_dri.so " message so the SIGSEGV and this "swrast" message seems unrelated...

This made this problem far less important but I'm still really curious about what is the problem...

In any case the kernel 4.8 is released with the support of GCN 1.0 in amd_gpu driver (My card is a GCN 1.0 CapeVerde) so I will switch to this new driver and see what happen

----------

## ct85711

I found thing forum thread that seems it may be similar to the same issue you are encountering.  This may give you something to look into on the cause

https://bbs.archlinux.org/viewtopic.php?id=193802

----------

