tech-pkg archive

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

GRASS: setting RPATH correctly



I am working on a package for the GRASS GIS package
(http://grass.osgeo.org/) and am having trouble getting the RPATH set
correctly.  This package builds some libraries in ${WRKSRC}, links
programs to those libraries, then during installation copies both
the libraries and the programs to a target directory. The main
commands are like the following:

        cc -shared \
        -o ${WRKSRC}/lib/libXXX.so \
        -L${WRKSRC}/lib \
        -L/usr/pkg/lib -Wl,-R/usr/pkg/lib \
        -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib \
        -L/usr/lib -Wl,-R/usr/lib \
        -L/usr/pkg/grass-6.4.2/lib -Wl,-rpath,/usr/pkg/grass-6.4.2/lib \
        -export-dynamic \
        < list of *.o object files >

        cc \
        -L${WRKSRC}/.../lib \
        -L/usr/pkg/lib -Wl,-R/usr/pkg/lib \
        -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib \
        -L/usr/lib -Wl,-R/usr/lib \
        -L/usr/pkg/grass-6.4.2 -Wl,-rpath,/usr/pkg/grass-6.4.2 \
        -export-dynamic \
        -o ${WRKSRC}/.../bin/program \
        OBJ.i386--netbsdelf/main.o \
        -lXXX \
        < long list of additional -l options >

During the linking of programs via commands like the second one above,
all the GRASS-specific libraries are in the first directory listed with
-L (i.e., within ${WRKSRC}); once installed, those same libraries will
be under ${PREFIX} (i.e., /usr/pkg/grass-6.4.2 above).

The problem is that neither the installed libraries nor the
installed programs end up including the ${PREFIX} directories in the
RPATH and so the libraries are not found.

- How can this be handled correctly within pkgsrc?

- Is it possible to force a directory to be included in RPATH or does
  the compiler only use ones that are required to find the objects it
  specifically needs at link time?

Suggestions are welcome, as this has been a problem with getting a good
GRASS package for a long time.

Thanks for your help.

Cheers,
Brook


Home | Main Index | Thread Index | Old Index