LD_LIBRARY_PATH setting for a typical compiler installation
What is the setting of the LD_LIBRARY_PATH environment variables (all three forms, i.e., including the ones with the _32 and _64 suffix) we can expect on a typical Sun C++ installation on SPARC? Can we expect only LD_LIBRARY_PATH to be set or do the
suffix forms get defined as well (or instead)? We need to know which variable(s) to
modify in our infrastructure and since the suffix forms override the generic one it makes
a difference.
# 1
In theory any combination of those variables can be set
by end users. We recommend against setting those variables
because they shouldn't be needed for a correctly linked program.
But if you are creating an infrastructure tool of some kind,
then you need to be prepared for the user to have any combination
of those variables set. There is no specific combination that's more
common or less common (in my experience).
Well, I guess it's more common to set LD_LIBRARY_PATH and not
set the variations with _32 and _64, but that doesn't mean you don't need
to handle all the combinations.
The best thing is to try to make your software immune to those settings
as much as possible.
# 2
Thanks Chris. I assume that means that the default Sun Studio installation won't have
any of these variables defined in the environment. Is the same true for compilers installed
in non-default locations? We have several versions of the compiler installed on the same
server and I'd like a confirmation that setting any of the variables is unnecessary and
discouraged for these types of setup as well.
# 3
Yup, LD_LIBRARY_PATH is also discouraged for installations in
alternate directories. All the Sun Studio tools themselves will
run just fine without needed any of these variables. But we do
ship with shared libraries for our users to use in their apps.
By default the compilers will add RPATH settings into the exectuables
to find the shared libraries in the compiler install directory
(wherever that happens to be during compile time). But if the
end user doesn't have the same compiler installed in the same place,
then the creator of the executable has to decide how to deal with it.
One choice they have is to tell the end user to install the runtime
libs in an arbitrary spot, and then use LD_LIBRARY_PATH.
We try to discourage that, but we're not in a position to enforce it.
It's better to ship the runtime libs in a fixed position relative to the executable
that you're shipping, and use $ORIGIN in the RPATH setting.
--chris