Hi all,

I would like to discuss how ELF RPATH (that specifies in which directories an ELF executable or shared library searches for other shared libraries it depends on) is set in the (Unix ELF, e.g., unxlngi6, unxsoli4, unxsols4) executables and shared libraries we build. Work on OOo-wo-URE (<http://wiki.services.openoffice.org/wiki/ODF_Toolkit/Efforts/OOo_without_URE>) makes it necessary to re-think the current approach.

Current (SRC680m214) situation:

- LINKFLAGSRUNPATH in solenv/inc/<platform>.mk specifis RPATH=$ORIGIN.

- Some makefile.mk explicitly override this:

  - vcl/util/makefile.mk:1.91 adds /usr/sfw/lib on Solaris.

- cpputools/source/registercomponent/makefile.mk:1.17, cpputools/source/unoexe/makefilem.mk:1.13, jvmfwk/plugins/sunmajor/javaenvsetup/makefile.mk:1.5, registry/tools/makefile.mk add $ORIGIN/../lib so that the regcomp, uno, javaldx, regmerge, regview executables within the URE bin directory find the needed shared libraries in the URE lib directory (due to the way this is done, the regcompare, checksingleton executables are also---harmlessly---affected).

OOo-wo-URE situation:

- Three different settings for RPATH needed:

- Shared libraries in the URE lib directory need to find shared libraries in the URE lib directory: RPATH=$ORIGIN.

- Executables in the URE bin directory need to find shared libraries in the URE lib directory: RPATH=$ORIGIN/../lib. Currently, some of those executables (javaldx, uno) are also used in the program directory of plain OOo and thus for now need RPATH=$ORIGIN:$ORIGIN/../lib instead.

- Executables and shared libraries in the OOo-wo-URE program directory need to find shared libraries in the OOo-wo-URE program directory and the URE lib directory: RPATH=$ORIGIN:$ORIGIN/../ure-link/lib.

- Plus, those one-off cases like adding /usr/sfw/lib (see above).

Three different ways to achieve that:

- Stay with a single global setting of LINKFLAGSRUNPATH to the combined RPATH=$ORIGIN:$ORIGIN/../lib:$ORIGIN/../ure-link/lib. Has the advantage of simplicity in the source code. Has the disadvantages of potential inefficiency (when loaders repeatedly check for non-existing directories), increased potential for failure (when an unintended RPATH element *does* find an unintended version of a library), and of being aesthetically dissatisfying.

- Add some APPnRPATH and SHLnRPATH makefile variables with (for now) three possible values, like "urelib" (expands to RPATH=$ORIGIN), "urebin" (expands to RPATH=$ORIGIN:$ORIGIN/../lib), "ooo" (expands to RPATH=$ORIGIN:$ORIGIN/../ure-link/lib). With a sensibly chosen default (i.e., {APP|SHL}nRPATH="ooo"), not much existing code needs to be adapted. Has the advantage of being explicit (except for the default thing) and specific, and the disadvantage of potential for failures on the side of the code writers (copying SHL1RPATH="urelib" from sal/util/makefile.mk when creating a new non-URE shared library).

- Automatically compute RPATH from other information. For example, somehow know whether a shared library will be part of URE or OOo-wo-URE, and if it has $(SALLIB) on its SHLnSTDLIBS that implies that it needs $ORIGIN (if it itself is part of URE) or $ORIGIN/../ure-link/ (if it itself is part of OOo-wo-URE) included in its RPATH. Looks rather complicated...

I personally favor the second approach.  Any comments?

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to