FFI/linux dynamic library load order?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

FFI/linux dynamic library load order?

Hans-Martin Mosner
Hello,
after some wasted hours tracking down why my OpenGL code does not work at all, I found that Squeak probably loaded the
wrong GL.so library - instead of /usr/lib/nvidia-current/libGL.so it loaded /usr/lib/i386-linux-gnu/mesa/libGL.so.

C programs compiled with -lGL use the correct library, of course. Does anyone have an idea what causes this confusing
behavior, and what can be done to fix it? BTW, my VM is the Cog 3.9-7 VM - when I try the 4.0-2522 Cog VM, the module
"X11" can't be found, possibly because naming conventions changed somewhere?

Cheers,
Hans-Martin


Reply | Threaded
Open this post in threaded view
|

Re: FFI/linux dynamic library load order?

laza
Hans-Martin,

this might be almost the same thing as I've seen here (there is also a link to what I got looking for the OpenGL library):

http://forum.world.st/Re-Pharo-project-External-web-browser-tc4224837.html

Alex

2012/1/5 Hans-Martin Mosner <[hidden email]>
Hello,
after some wasted hours tracking down why my OpenGL code does not work at all, I found that Squeak probably loaded the
wrong GL.so library - instead of /usr/lib/nvidia-current/libGL.so it loaded /usr/lib/i386-linux-gnu/mesa/libGL.so.

C programs compiled with -lGL use the correct library, of course. Does anyone have an idea what causes this confusing
behavior, and what can be done to fix it? BTW, my VM is the Cog 3.9-7 VM - when I try the 4.0-2522 Cog VM, the module
"X11" can't be found, possibly because naming conventions changed somewhere?

Cheers,
Hans-Martin





Reply | Threaded
Open this post in threaded view
|

Re: FFI/linux dynamic library load order?

Hans-Martin Mosner
Am 05.01.2012 16:29, schrieb Alexander Lazarević:
> Hans-Martin,
>
> this might be almost the same thing as I've seen here (there is also a link
> to what I got looking for the OpenGL library):
>
> http://forum.world.st/Re-Pharo-project-External-web-browser-tc4224837.html
>
> Alex
>
Thanks for the pointer! In the meantime, I found another discussion thread (sorry, didn't follow the mailing list
closely during that time) which is also related to OpenGL: http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html

Probably a good approach would be to drop the VM-level directory searching stuff altogether and rely on ld.so
exclusively. Maybe add some niceness by searching for 'libXX.so' as well when 'XX' was specified as the module.
For now, I'll probably hack some image-level stuff to make it work.

Cheers,
Hans-Martin

Reply | Threaded
Open this post in threaded view
|

Re: FFI/linux dynamic library load order?

Levente Uzonyi-2
On Thu, 5 Jan 2012, Hans-Martin Mosner wrote:

> Am 05.01.2012 16:29, schrieb Alexander Lazarević:
>> Hans-Martin,
>>
>> this might be almost the same thing as I've seen here (there is also a link
>> to what I got looking for the OpenGL library):
>>
>> http://forum.world.st/Re-Pharo-project-External-web-browser-tc4224837.html
>>
>> Alex
>>
> Thanks for the pointer! In the meantime, I found another discussion thread (sorry, didn't follow the mailing list
> closely during that time) which is also related to OpenGL: http://forum.world.st/OpenGL-in-4-1-or-later-td3794639.html
>
> Probably a good approach would be to drop the VM-level directory searching stuff altogether and rely on ld.so
> exclusively. Maybe add some niceness by searching for 'libXX.so' as well when 'XX' was specified as the module.
> For now, I'll probably hack some image-level stuff to make it work.
Automatically finding the "right" OpenGL library is kinda impossible IMHO,
even Blender ships with its own OpenGL libraries IIRC. The best solution
is to set the proper path manually.


Levente

>
> Cheers,
> Hans-Martin
>
>

Reply | Threaded
Open this post in threaded view
|

Re: FFI/linux dynamic library load order?

Eliot Miranda-2
In reply to this post by Hans-Martin Mosner


On Thu, Jan 5, 2012 at 6:27 AM, Hans-Martin Mosner <[hidden email]> wrote:
Hello,
after some wasted hours tracking down why my OpenGL code does not work at all, I found that Squeak probably loaded the
wrong GL.so library - instead of /usr/lib/nvidia-current/libGL.so it loaded /usr/lib/i386-linux-gnu/mesa/libGL.so.

C programs compiled with -lGL use the correct library, of course. Does anyone have an idea what causes this confusing
behavior, and what can be done to fix it? BTW, my VM is the Cog 3.9-7 VM - when I try the 4.0-2522 Cog VM, the module
"X11" can't be found, possibly because naming conventions changed somewhere?

All I can say is that one must set LD_LIBRARY_PATH appropriately so that the VM will pick things up from the right places.  You can use ldd to find out what the VM is linked against.  e.g.

bash-2.05b$ ldd cogvm/4.0-2518/vm-display-X11 
        libGL.so.1 => /usr/lib/libGL.so.1 (0x4002e000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40093000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x400a1000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x400a9000)
        libdl.so.2 => /lib/libdl.so.2 (0x400c0000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x400c3000)
        libm.so.6 => /lib/tls/libm.so.6 (0x400d4000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x400f6000)
        libuuid.so.1 => /lib/libuuid.so.1 (0x4010b000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4010e000)
        libc.so.6 => /lib/tls/libc.so.6 (0x401ed000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Then from the libGL info one can craft a suitable LD_LIBRARY_PATH, e.g. one with the directory containing the libGL.so.N the VM is linked against first.  So in your example above

LD_LIBRARY_PATH=/usr/lib/nvidia-current:$LD_LIBRARY_PATH cogvm/squeak myimage.im

HTH
Eliot
 

Cheers,
Hans-Martin





--
best,
Eliot