# Linux-defcon: libGL error: unable to load driver



## PacketMan (Dec 23, 2015)

10.2-RELEASE-p7
GNOME3

Installed games/linux-defcon  and selected the NVIDIA option too.  Installed fine, but no launch icon from the desktop so I do this, and get this:


```
/usr/local/bin % ./linux-defcon
Failed to open debug.txt for writing
SDL Version: Compiled against 1.2.11, running with 1.2.14
Failed to open debug.txt for writing
Defcon 1.42 linux built May 14 2007
Parsing archive main.dat...DONE
Client listening on port 5011
Parsing Coastline data (1776 islands) : 24ms
Parsing International data (2753 islands) : 10ms
Parsing City data (2745 cities) : 31ms
libGL error: dlopen /usr/lib/dri/swrast_dri.so failed (libpciaccess.so.0: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error:  BadValue
  Request Major code 153 (GLX)
  Request Minor code 3 ()
  Value 0x0
  Error Serial #30
  Current Serial #31
```


When the port is installing it says it found libGL.  What port contains this driver, and/or what do I need to ensure it loads?


----------



## PacketMan (Dec 24, 2015)

Well, I see that /usr/lib/dri/ doesn't exist on my box.

Hmmmm, did a bit of searching. Does this mean that DRI (Direct Rendering) is not installed on my system? Anyone know if this port needs it?


----------



## PacketMan (Dec 24, 2015)

Hmmm, apparently it is. I'll keep looking.


```
gmake[5]: Leaving directory '/usr/ports/graphics/dri/work/mesa-11.0.7'
gmake[4]: Leaving directory '/usr/ports/graphics/dri/work/mesa-11.0.7'
gmake[3]: Leaving directory '/usr/ports/graphics/dri/work/mesa-11.0.7'
gmake[2]: Leaving directory '/usr/ports/graphics/dri/work/mesa-11.0.7'
====> Compressing man pages (compress-man)
===>  Installing for dri-11.0.7_1,2
===>  Checking if dri already installed
===>  dri-11.0.7_1,2 is already installed
  You may wish to ``make deinstall'' and install this port again
  by ``make reinstall'' to upgrade it properly.
  If you really wish to overwrite the old port of dri
  without deleting it first, set the variable "FORCE_PKG_REGISTER"
  in your environment or the "make install" command line.
*** Error code 1
```


----------



## tobik@ (Dec 24, 2015)

It seems to use linux(4). Do you have the LINUX option enabled in x11/nvidia-drivers?



PacketMan said:


> Well, I see that /usr/lib/dri/ doesn't exist on my box.


You have to look in /compat/linux/usr/lib/dri. But since you have an NVIDIA GPU it shouldn't use DRI at all.


----------



## PacketMan (Dec 28, 2015)

tobik said:


> It seems to use linux(4). Do you have the LINUX option enabled in x11/nvidia-drivers?



No I don't. I didn't enable it when trying to get GNOME3 installation working. I don't remember why, but it was either left out to resolve an install error, or someone led me to think that I did not need it /  or do not enable it. That is vague history in my mind now.



tobik said:


> You have to look in /compat/linux/usr/lib/dri. But since you have an NVIDIA GPU it shouldn't use DRI at all.



I looked in that folder and swrast is there.  Looking at my original error message post it looks like the program is simply looking in the wrong spot.


```
$ ls
i915_dri.so   i965_dri.so   r200_dri.so   r300_dri.so   r600_dri.so   radeon_dri.so   radeonsi_dri.so   swrast_dri.so
$
```

I tried to reinstall the driver, with that option enable just to see (and possibly learn something) but got this error.


```
===>  Installing for nvidia-driver-346.96
===>  Checking if nvidia-driver already installed
===>  Registering installation for nvidia-driver-346.96
Installing nvidia-driver-346.96...
pkg-static: nvidia-driver-346.96 conflicts with linux-c6-dri-10.1_1 (installs files into the same place).  Problematic file: /compat/linux/usr/lib/libGL.so.1
*** Error code 70
```

graphics/linux-c6-dri is a dependency of the games/linux-defcon port installation.  I'm really starting to wonder if this is just a bad port, maybe worked previously but enough has changed now that its 'broken' in at least some environments. Looks like a great strategy game, and would love to see this work with the NVIDIA GPU. Think I will send the porter an email and see what he/she says.


----------



## talsamon (Dec 28, 2015)

The file is on my system in /usr/local/lib/dri/swrast_dri.so - maybe a problem with the path?


----------



## PacketMan (Dec 28, 2015)

Problem with the path?  I just follow the port install process. 

I was wondering if I could create a symlink (I think that is what its called), and if that would work, l but to me this is a band-aid where it should not be required.


----------



## tobik@ (Dec 28, 2015)

PacketMan said:


> graphics/linux-c6-dri is a dependency of the games/linux-defcon port installation.


Only if you don't use the NVIDIA option in that port (https://svnweb.freebsd.org/ports/head/games/linux-defcon/Makefile?revision=362015&view=markup#l28). You say you have it enabled already. Can you double-check that it is enabled and then

 Uninstall graphics/linux-c6-dri and games/linux-defcon
 reinstall x11/nvidia-driver with the LINUX option,
 and reinstall games/linux-defcon with the NVIDIA option?

Another thing you can try before all of that (if you're ok with swrast i.e. no hardware acceleration) is installing devel/linux-c6-libpciaccess (because swrast_dri.so is complaining that it can't find libpciaccess.so.0).


----------



## PacketMan (Dec 28, 2015)

I wanted hardware acceleration so I did the steps. It worked. Thanks.

Its very clear to me that for 2016 I have to try to learn all the bits n pieces of FreeBSD and how they interwork. I also need to somehow learn (get it in my head) the dependency structure inside my machines.  I was sure graphics/linux-c6-dri was installed previously for something else, but maybe not. Or maybe I have broken something else now by removing graphics/linux-c6-dri.  Is there a command that I can use referencing a specific port to see what depends on it, so I can see if I will break something by removing it, or if it truly is 'orphaned' alone?


----------



## SirDice (Dec 28, 2015)

PacketMan said:


> Is there a command that I can use referencing a specific port to see what depends on it, so I can see if I will break something by removing it, or if it truly is 'orphaned' alone?


`pkg info -r <package name>`

See pkg-info(8)

A pkg-delete(8) should also warn you if you try to remove a package that's being depended on.


----------

