← Back to team overview

dolfin team mailing list archive

Re: Loading shared libraries

 

On Thu, 2006-02-09 at 14:34 +0100, Johan Jansson wrote:
> On Thu, Feb 09, 2006 at 11:57:36AM +0100, Garth N. Wells wrote:
> > If I add "libtool --mode=link" by hand in the Makefile where executables
> > are made,
> > 
> > $(DEST): $(OBJECTS)
> >          libtool --mode=link $(CXX) -o $@ $(OBJECTS) $(CFLAGS) $(LIBS)
> > 
> > it works. Is there a simpler way? Should the script dolfin-config
> > --compiler by able to return 
> > 
> > libtool --mode=link g++ ?
> > 
> > Garth
> > 
> 
> Ok, I didn't know you could do this.
> 
Nor did I until this morning. I found it on the libtool web page
http://www.gnu.org/software/libtool/manual.html#Linking-executables

> What you usually need to do with shared libraries is to specify for
> the dynamic loader where to look for shared libraries. On Linux you
> can do this by adding paths to /etc/ld.so.conf or by setting the
> environment variable LD_LIBRARY_PATH. You can check which libraries
> are used (or missing) by an executable by: ldd <executable>.
> 

I didn't want to do this as I always have several versions of DOLFIN -
at least one stable version with running models, and at least one
development version. 

> It seems it's also possible to add a path directly in the executable,
> as you have shown above (an -rpath flag is given to the linker).
> 
> I don't see any real disadvantages of doing this, so I think we should
> adopt this. It would also eliminate the hassle of setting the library
> path yourself.
> 

OK, sounds good.

Garth



> By using libtool in dolfin-config we should also be able to create
> shared libraries in a platform-independent way, which is needed for
> the dolfin-swig tool anyway (for generating Python modules from
> forms).
> 
>   Johan
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev




Follow ups

References