Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: switching drivers for development

  1. #1
    Intern Contributor
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC
    Posts
    62

    switching drivers for development

    My Linux kung fu is rusty. Is there a safe, semi-convenient way to switch back and forth between a production and a beta driver? I don't want to clobber my production system with a beta driver. Last time I did that, I ended up losing the system and had to spend a few days reinstalling. I don't really want to have to reboot into a completely separate system all the time either. I'm thinking, something like an installation with multiple X servers or something like that? Then I could use all the same kernel, apps, libs, paths, etc. and it's just the X server that changes.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,099
    That depends obn which driver you're talking about.

  3. #3
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    407
    Do you want to substitute a particular library? LD_PRELOAD can be used for that purpose as follows. Say you have libraries in fullpath1 and fullpath2 each with different library versions and your executable requires libraries -lFOO and -lBAR. To link at runtime and use library set "1"

    Code :
    LD_PRELOAD="<fullpath1>/libFOO.so <fullpath1>/libBAR.so" ./your_executable

    Similarly, to link at runtime and use library set "2"

    Code :
    LD_PRELOAD="<fullpath2>/libFOO.so <fullpath2>/libBAR.so" ./your_executable

  4. #4
    Intern Contributor
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC
    Posts
    62
    That library trick is interesting, but I want to substitute entire NVIDIA proprietary drivers.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,099
    Normally, there shouldn't be any problem with a new NVIDIA blob - it's mostly the other way around, i.e. if you upgrade to a newer X.Org version and the blob doesn't support the new ABI (which happens with almost every new X.Org release). It may also occur that some packages are dependent on stable, pre-packaged repository versions of the drivers (like Ubuntu's nvidia-current) so when removing these you'll also have to struggle with unfulfilled dependencies. What distro are you using?

  6. #6
    Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    407
    I use the LD_PRELOAD to substitute temporarily from commandline the mesa3D for nvidia drivers as follows
    Code :
    Mesa-8.0.4$ LD_PRELOAD="lib/gallium/libGL.so lib/libGLU.so" ldd my_executable

    ldd shows that the relative path ie mesa3d opengl libraries are used
    Code :
            lib/gallium/libGL.so (0x00007fc051bf4000)
            lib/libGLU.so (0x00007fc051981000)

    in contrast without using LD_PRELOAD the default system library is used (in my case that is the nvidia driver)
    Code :
    ldd my_executable
     
            libGL.so.1 => /usr/lib/nvidia-current/libGL.so.1 (0x00007f8c6f15c000)
            libnvidia-tls.so.295.40 => /usr/lib/nvidia-current/tls/libnvidia-tls.so.295.40 (0x00007f8c6d725000)
            libnvidia-glcore.so.295.40 => /usr/lib/nvidia-current/libnvidia-glcore.so.295.40 (0x00007f8c6b400000)

    ps once satisfied that the library is as expected just remove ldd so your_executable will run with the library you chose.

  7. #7
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,126
    Quote Originally Posted by marshats View Post
    I use the LD_PRELOAD to substitute temporarily from commandline the mesa3D for nvidia drivers as follows
    Code :
    Mesa-8.0.4$ LD_PRELOAD="lib/gallium/libGL.so lib/libGLU.so" ldd my_executable
    FWIW, to make this work with any shell, not just sh-style shells, prefix with "env":

    Code :
    env LD_PRELOAD="lib/gallium/libGL.so lib/libGLU.so" ldd my_executable

  8. #8
    Intern Contributor
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC
    Posts
    62
    Quote Originally Posted by thokra View Post
    Normally, there shouldn't be any problem with a new NVIDIA blob - it's mostly the other way around, i.e. if you upgrade to a newer X.Org version and the blob doesn't support the new ABI (which happens with almost every new X.Org release). It may also occur that some packages are dependent on stable, pre-packaged repository versions of the drivers (like Ubuntu's nvidia-current) so when removing these you'll also have to struggle with unfulfilled dependencies. What distro are you using?
    Well, the point is I don't want to deal with whether uninstalling / reinstalling drivers "just works" or not. I don't want to do that at all, as last time around it did not "just work". I want to keep several installations in parallel and switch between them. Maybe hoping that the packages won't clobber each other is unrealistic. I'm using Lubuntu 12.04.

    I will investigate the LD_PRELOAD trick to the extent I can make use of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •