[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LibGL



A Dimecres 28 Febrer 2007 23:06, Lennart Sorensen va escriure:
[....]
>
> libGL.so is for compiling, and since you apparently have the
> libgl1-mesa-dev package installed, then any compiling is done using the
> mesa version of the headers, so libGL.so (used exclusively for
> compiling) links to the mesa version of the library.  If you instead
> installed nvidia-glx-dev, then it would link to the nvidia version,
> since you would be using nvidia's version of those header files.

the problem is that nvidia-glx-dev has a lot of conflicts with many packages 
(qt,vtk, glut) so any application that you want to use have a lot of 
problems. So it's no very practical to use this headers IMHO.

[....]


> > so, if I understand you, if I want to make a program that use libGL
> > accelerated I have to compile it normally, with the libgl1-mesa-dev
> > - then deinstall the libgl1-mesa-dev library
> > - restart the nvidia-glx
>
> Why would you deinstall the development package?  It has _nothing_ to do
> with running the program.  Any program you compiled will use libGL.so.1
> at runtime, which you showed is a link to the nvidia version of libGL.
>
Ok. It was just a test. 

> > and run the program, that will use the libgl of nvidia instead of the
> > libgl.xmesa, no?
>
> It will do so without those two steps.
>
> It is as simple as:
> compile program
> run program
:-)

> It will compile using the mesa headers, and run using the nvidia
> library since they both implement the libGL.so version 1 ABI.
>
> When you compile an opengl program, the linker is told to use libGL
> (-lGL) which it goes looking for.  It find /usr/lib/libGL.so which is a
> symlink to libGL.so.1.2.xlibmesa which is an implementation of libGL,
> shared object, major ABI version 1.  So it writes into the binary that
> it wants libGL.so.1 library loaded dynamically when the program is run.
> It doesn't care who wrote libGL.so.1 as long as it works as the standard
> says it should.  Since both mesa and nvidia implemented the libGL.so
> with the correct ABI, either will work with the resulting program.  When
> you run your program, the loader looks for /usr/lib/libGL.so.1 and finds
> it is a link to libGL.so.1.0.8776 provided by nvidia, and uses that.
> That particular implementation knows how to use an nvidia X server for
> DRI and GLX and hence runs accelerated.  If instead you had a link to
> the mesa version of libGL.so.1 then it would have used that and rendered
> by software (or whatever mesa happens to support on your system).
>
> So the .so is used by linker to find library (name and ABI version) to
> compile for, while at runtime it uses that library name and ABI version
> directly (so in this case libGL.so.1) to load the right library.

Ok, _now_ I understand it. It have been a long thread!!!!

Thank's a lot for your patience.

Leo

-- 
--
Linux User 152692
PGP: 0xF944807E
Catalonia

Attachment: pgpcxU0zhJbqu.pgp
Description: PGP signature


Reply to: