Re: [osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-21 Thread Rafa Gaitan
Hi J-S,

The only that comes to my mind is change all RPATHS on dependent
libraries. This is a little bit complicated, and maybe a "I need to
reinstall OS" :S.

Using "otool -L" you can see all the rpaths associated to a library or
executable in mac.
Using "install_name_tool" you can change a concrete rpath for a
library or executable.

Some preinstalled frameworks and libraries on macosx have their rpaths
prefixed, so doing this you can point all these libraries to your mesa
libraries.

To avoid a complete mess in your system, maybe you can copy all
frameworks and libraries to a dir, and change all rpaths of all these
libraries and your applications. But this is really tricky.

There are also the env var DYLD_FRAMEWORK_PATH, that could help.

Good luck!
Rafa.


2010/9/20 Jean-Sébastien Guay :
> Hi Jordi,
>
>> Did you try LD_PRELOAD? Something like 'export
>> LD_PRELOAD=/usr/lib/mesa/libGL.so'
>> May be it can do the trick..
>
> Seems like the MacOSX version of LD_PRELOAD is DYLD_INSERT_LIBRARIES. So
> having built a recent mesa now, I tried:
>
> DYLD_INSERT_LIBRARIES=...path/to/libGL.dylib osgversion
>
> and I get the same message:
>
> dyld: Symbol not found: _gll_noop
>  Referenced from:
> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
>  Expected in: /sw/lib/mesa/libGL.1.dylib
>  in /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
> Trace/BPT trap
>
> I can run with DYLD_PRINT_LIBRARIES=YES and I see each library that's
> loaded. The problem seems to come from the fact that the QuartzCore library
> (and others) depends on other libraries that are in the OpenGL.framework, so
> it loads that all the time, even if I want to use Mesa in its place.
>
> Seems to me there's too much magic going on behind the scenes for Mesa to be
> usable under MacOS X. Other libraries (including the window system) depend
> on OpenGL and shared libraries are being loaded from other places on the
> system... Unless someone with more knowledge than me in this area could
> help, I'm stuck. :-(
>
> J-S
> --
> __
> Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
http://gvsig3d.blogspot.com
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-20 Thread Jean-Sébastien Guay

Hi Jordi,


Did you try LD_PRELOAD? Something like 'export
LD_PRELOAD=/usr/lib/mesa/libGL.so'
May be it can do the trick..


Seems like the MacOSX version of LD_PRELOAD is DYLD_INSERT_LIBRARIES. So 
having built a recent mesa now, I tried:


DYLD_INSERT_LIBRARIES=...path/to/libGL.dylib osgversion

and I get the same message:

dyld: Symbol not found: _gll_noop
  Referenced from: 
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

  Expected in: /sw/lib/mesa/libGL.1.dylib
 in /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
Trace/BPT trap

I can run with DYLD_PRINT_LIBRARIES=YES and I see each library that's 
loaded. The problem seems to come from the fact that the QuartzCore 
library (and others) depends on other libraries that are in the 
OpenGL.framework, so it loads that all the time, even if I want to use 
Mesa in its place.


Seems to me there's too much magic going on behind the scenes for Mesa 
to be usable under MacOS X. Other libraries (including the window 
system) depend on OpenGL and shared libraries are being loaded from 
other places on the system... Unless someone with more knowledge than me 
in this area could help, I'm stuck. :-(


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-20 Thread Jordi Torres
Hi J-S,

Did you try LD_PRELOAD? Something like 'export
LD_PRELOAD=/usr/lib/mesa/libGL.so'
May be it can do the trick..

Cheers.

2010/9/20 Jean-Sébastien Guay 

> Hi Alberto,
>
>
>  I don't know why is it different on Mac, but on Linux just setting the
>> LD_LIBRARY_PATH as you did is the way to go, since both libraries must
>> have the same ABI. For example, when one installs the nVidia libraries
>> on Linux, the installer just substitutes the old ones (e.g. Mesa) by the
>> new accelerated .so's.
>>
>
> Interesting, good to know. It seemed to work except for the missing symbol,
> so I'm now just trying to compile a more recent Mesa myself to see if that
> will work. I will rebuild OSG with the platform-default OpenGL and try
> changing the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to use Mesa since that's
> supposed to work.
>
> Thanks for the pointers.
>
>
> J-S
> --
> __
> Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
>   http://www.cm-labs.com/
>http://whitestar02.webhop.org/
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-20 Thread Jean-Sébastien Guay

Hi Alberto,


I don't know why is it different on Mac, but on Linux just setting the
LD_LIBRARY_PATH as you did is the way to go, since both libraries must
have the same ABI. For example, when one installs the nVidia libraries
on Linux, the installer just substitutes the old ones (e.g. Mesa) by the
new accelerated .so's.


Interesting, good to know. It seemed to work except for the missing 
symbol, so I'm now just trying to compile a more recent Mesa myself to 
see if that will work. I will rebuild OSG with the platform-default 
OpenGL and try changing the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to use 
Mesa since that's supposed to work.


Thanks for the pointers.

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-20 Thread Alberto Luaces
Jean-Sébastien Guay writes:

> A bit of a general question, does anyone know how to run an OpenGL
> program with mesa instead of the platform's OpenGL driver? Is it
> supposed to require a recompile?

Hi J-S,

I don't know why is it different on Mac, but on Linux just setting the
LD_LIBRARY_PATH as you did is the way to go, since both libraries must
have the same ABI. For example, when one installs the nVidia libraries
on Linux, the installer just substitutes the old ones (e.g. Mesa) by the
new accelerated .so's.

-- 
Alberto

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Running an OpenGL program with mesa instead of the platform's OpenGL driver?

2010-09-20 Thread Jean-Sébastien Guay

Hi all,

A bit of a general question, does anyone know how to run an OpenGL 
program with mesa instead of the platform's OpenGL driver? Is it 
supposed to require a recompile?


I want to run osgviewer using mesa to compare this with my machine's 
OpenGL drivers. I'm doing this on MacOS X, BTW, compiled by configuring 
in CMake to build with makefiles.


I tried two things, without recompiling (i.e. compiling with the 
platform's OpenGL but using mesa at runtime) and recompiling (i.e. using 
mesa both at compilation and at runtime), and I'm getting the same 
results for both...


I set:

$LD_LIBRARY_PATH=(mesa lib path):$LD_LIBRARY_PATH
$DYLD_LIBRARY_PATH=(mesa lib path):$DYLD_LIBRARY_PATH

so that osgviewer finds the mesa .so's first before the 
platform-installed ones, but then I get this message:


$ osgversion
dyld: Symbol not found: _gll_noop
  Referenced from: 
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

  Expected in: /sw/lib/mesa/libGL.1.dylib
 in /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
Trace/BPT trap
$ osgviewer --window 50 50 800 600 cow.osg
dyld: Symbol not found: _gll_noop
  Referenced from: 
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

  Expected in: /sw/lib/mesa/libGL.1.dylib
 in /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
Trace/BPT trap

It looks like the binary is still looking for OpenGL in 
/System/Library/Frameworks/OpenGL.framework (in both cases), which I 
would have thought wouldn't happen if I compile with mesa... And it also 
looks like the mesa lib is missing a symbol...


In the CMake window, I can't see any reference to 
/System/Library/Frameworks/OpenGL.framework (I've replaced all of them 
with the equivalent mesa libs/include paths). I'm pretty novice at 
Linux/Unix development, I'm sure there's a way to check which shared 
libraries an executable will look for at runtime?


Another detail, the mesa I'm using was downloaded with fink, it's 
version 7.0.2-2. It's from November 2007. Perhaps I should uninstall 
that and build mesa 7.8.2 (June 2010) from source? I think I'll do this 
while I wait for a reply on this thread. Nov 2007 seems a really long 
time ago :-)


Has anyone done this? Could anyone offer some guidance?

Thanks,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org