Official method for determining modular X module path?
Mike A. Harris
mharris at mharris.ca
Fri Dec 2 22:53:38 PST 2005
Aric Cyr wrote:
> Is /usr/lib/xorg/ spec'ed out somewhere to be the defacto
> location for the modules directory? Seems like Gentoo and Ubuntu
> agree that it is the right spot, but if other distros don't know that
> your above heuristic would fail if neither of those locations were
> valid. This is the sort of info that should be (at least) in the wiki,
> if it's not already. I couldn't find any relevant docs on the issue
> from a quick search (other than a #define in a header file that obviously
> defined the default module path as /usr/lib/xorg/modules).
Hard coding things to expect to be in one single directory is
IMHO a very bad idea all around. Systems change over time, and
just like X.Org modularization is moving things out of the
/usr/X11R6 hierarchy, who knows what might happen in 5 years
down the road. Maybe we'll all want to make things reside
in some other location which is determined more sensible
then, which we can't forsee with our crystal balls in 2005.
Right now, the modules are installed into "moduledir", which
is a variable. This variable does not default to /usr/lib,
and so hard coding /usr/lib would be a big mistake.
It defaults to "libdir", which is /usr/lib on most 32bit
Linux systems, some 64bit Linux systems, but is /usr/lib64
on AMD64, PPC64, and s390x. Granted, most 3rd party driver
vendors are not shipping PPC64 or s390x drivers and wont
likely be doing so in the forseeable future. ;o) However,
I believe that Nvidia at least does have a 64bit AMD64
driver, and I would suspect that other hardware vendors
have them, or will have them in the future as well. So,
you don't want to hard code /usr/lib. You also do not
want to hard code /usr/lib64 either, because there is no
guarantee that the drivers will be in *either* location.
The reason for the X server's SDK defining the 'moduledir'
variable is to inform driver packagers and vendors, where
the drivers are located on the system *at compile time*.
If all driver vendors and packagers out there use this
variable mandatorily in their packaging, then their driver
packages automatically will adjust to wherever the drivers
might be on a given system should there ever be any reason
for that location to change.
Keep in mind that another reason moduledir is a variable,
is that you might be doing development and want to install
a test version in some other location such as /opt/xorg-test,
or /usr/local or somewhere. If moduledir is honoured
universally by everyone out there, and read by using pkg-config,
then everything remains automatic, and "just works".
When people hard code paths, it just makes life painful for
everyone down the road.
 /lib64 and /usr/lib64 are the official standard location
for 64bit libraries on AMD64 ABI, however I believe that some
distributions have chosen to implement their AMD64 release
without following the AMD64 ABI, and have chosen to install the
64bit libraries into /lib and /usr/lib instead. So relying on
any specific behaviour will fail if different distributions do
things in their own special way. Again, relying on moduledir
however should "do the right thing", modulo bugs.
More information about the xorg