[cgma-dev] Linking to iGeom
Jed Brown
jed at 59A2.org
Tue Jan 12 14:40:18 CST 2010
On Tue, 12 Jan 2010 14:21:39 -0600, Jason Kraftcheck <kraftche at cae.wisc.edu> wrote:
> Jed Brown wrote:
> > Note that overlinking should be avoided when working with shared libs,
> > e.g. link with *only* -L/path/to/lib -liMesh (with
> > -Wl,-rpath=/path/to/lib when you want it). With static libs, you have
> > no choice but to link the recursive dependencies, but then RPATH is
> > irrelevant. It would be nice to have a MOAB/CGM configure option to
> > install with RPATH, there is probably a way to have autotools do the
> > RPATH rewriting (so they work from the build directory too).
> >
>
> Does it not do this now? It should happen automatically for a shared
> library version of MOAB and for the installed utility programs. There is no
> concept of an RPATH for a static library. The only way to associate an
> RPATH in that case is to use some other file format (e.g. the libtool
> wrapper libraries suffixed with .la).
My opencascade is in a system path, but they are not rpath'd into
libiGeom.so/libcgm.so. In the (dysfunctional for other reasons) Cubit
build, configure gives this warning
configure: WARNING: Linking against Cubit-based CGM; you'll need to add Cubit's 'bin' directory
to your LD_LIBRARY_PATH before linking, or add -R (linux) or equivalent
(non-linux) to your link statement to link applications.
and ldd confirms that it cannot be found unless I set LD_LIBRARY_PATH.
Jed
> > On my system, IGEOM_LDFLAGS includes lots of system paths which can
> > cause order dependence and breakage (because these paths should be
> > searched last, but will be searched earlier when given explicitly).
>
> It isn't supposed to. Are you specifying system paths to the configure
> script? For example, if hdf5 is installed in /usr or /usr/local, then it
> should be sufficient to specify:
> ./configure
> If you were to specify:
> ./configure --with-hdf5=/usr
> then you will end up with the specified paths reflected in the resulting
> makefiles.
I configured with
../configure --prefix=/home/jed/usr --enable-debug --enable-shared --with-mpi=/usr --with-occ=/opt/opencascade CC=mpicc CXX=mpicxx FC= F77=
and get
IGEOM_LDFLAGS = $(IGEOM_CXX_LDFLAGS) -L/opt/opencascade/lib -L/usr/lib/openmpi -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../..
which is not quite optimal.
Jed
More information about the cgma-dev
mailing list