The libs private to one application, where to put them?
Thanks.
> I think the global lib directories is not so good, because it should be for
> public libs.
>
> The libs private to one application, where to put them?
>
>
/usr/local/lib ?
/usr/local/lib/appname ?
In which case it would be up to the app to know where to find its libs.
Not PREFIX-safe, hence not allowed in ports unless there is no other
solution.
DES
--
Dag-Erling Smørgrav - d...@des.no
The canonical location for ports is ${LIBDIR}/${PORTNAME}, but remember
that unless these are run-time loadable modules, this directory must be
in the library search path when you run the app. This means that you
either have to ldconfig the directory using an rc_subr script (which
defeats the purpose of having a private library directory) or install a
wrapper that sets LD_LIBRARY_PATH before execing the real binary.
DES
You can also compile in a search path.
Eh? It doesn't need to be an absolute path.
To follow up on this for you Ronald, to compile in a PREFIX-safe
relative library path, you need to pass -z origin -rpath
$ORIGIN/../lib/pkgname to the linker... that is a literal $ so assuming
you're using regular make files and gcc as the linker, you would add
this line:
LDFLAGS += -Wl,-z,origin,-rpath,\$$ORIGIN/../lib/$(PORTNAME)
You need to double the $ so that make doesn't expand $ORIGIN for you and
the \ is for the shell. The command line would be something like this:
cc -O2 -pipe -march=pentium4 -Wl,-z,origin,-rpath,\$ORIGIN/../lib/test
test.c -L. -ltest -o test
You may need to fiddle around to get the literal $ in there, a strings
on the compiled binary would include ``$ORIGIN/../lib/test'' (without
the quotes of course).
The reason you *need* to use $ORIGIN is that if you don't the relative
path will be to whatever the pwd is when the process is started making
them effectively random.
Have fun!