[OpendTect_Developers] help with static libs

Marcio Weck marcio.weck at gmail.com
Tue Mar 22 21:46:34 CET 2011


Hello,

thank you, Bert, using:
 EXTRALIBSFORSHLIB := newmat MiniSicres
my compilation worked, but when I try to load the plugin I get an error (
saying that my functions from MiniSicres are undefined ).
I put libMiniSicres.a on:
.../ODWork/lib/lux64
.../opendtect-4.0.1/plugins/lux64/libs/
.../opendtect-4.0.1/lib/lux64/G

and newmat:
/usr/include/newmat

my Makefile:

*SRC.cc := predtools.cc \
          sicrespi.cc

PLUGIN := yes
MODDEP := AttributeEngine EarthModel Well

include make.od.Defaults
OWNC++FLAGS := -I"msicres"
EXTRALIBSFORSHLIB := newmat MiniSicres
include make.Targets*

where "msicres" is the folder where headers from MiniSicres are.
I think newmat can be the problem, because this is a static lib, compiled
with MiniSicres sources to generate libMiniSicres.a.

I tried to use as a shared lib, but without success.

Thank you in advance.

On Fri, Mar 18, 2011 at 7:35 AM, Bert Bril <bert at opendtect.org> wrote:

> Marcio:
>
>
> > OWNC++FLAGS := lib/libMiniSicres.a
>
> The key to getting this right is to try 'make -n' and see what commands
> make comes up with. You'll see that the C++FLAGS are put before the link
> libs, and I guess that's the problem here (the linker is not smart enough).
>
> But even if you get the compilation working, loading into OpendTect
> requires that the object code is available. This is not a shared lib but
> an archive, which is not an executable unit, but just a collection of
> objects. It needs to be included fully in the plugin's output shared
> lib. By far the easiest is to use:
>
> EXTRALIBSFORSHLIB := MiniSicres
>
> That only requires that you put the libMiniSicres.a (or a link to it) in
> lib/$(binsubdir)/G (or if you don't have $DEBUG set, 'O' at the end). If
> you don't do that you'll get a message from the linker telling you that
> BTW.
>
>
> In general, for archives (.a on Linux and Mac, .lib on Windows), use
> EXTRALIBSFORSHLIB. For shared libs (.so (Linux), .dylib (Mac) and .dll
> (Windows)) use EXTRALDLIBS.
>
>
>
> /Bert
>
> --
> -- Bert Bril / OpendTect developer at dGB
> -- mailto:Bert.Bril at opendtect.org , http://opendtect.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20110322/969adef4/attachment.html>


More information about the Developers mailing list