help-gplusplus
[Top][All Lists]
Advanced

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

Re: .so and .a libraries


From: Morusaka
Subject: Re: .so and .a libraries
Date: Thu, 12 Aug 2004 05:12:15 GMT

Ok, thank you so much for your reply!!!!!

Grazie, Morusaka!!


"Paul Pluzhnikov" <ppluzhnikov-nsp@charter.net> ha scritto nel messaggio
m3pt5x3wpy.fsf@salmon.parasoft.com">news:m3pt5x3wpy.fsf@salmon.parasoft.com...
> Robert Heller <heller@deepsoft.com> writes:
>
> >   "Morusaka" <morusaka@inwind.it>,
>
> > "> g++ -IpathDirectory -LlibraryDirectory -llibraryName
sourcefilename.cpp
>
> This command-line is "backwards"; libraries should always *follow*
> objects and sources, never preceed them:
>
>   g++ -IpathDirectory source.cpp -L... -l...
>
> > You have two options:
>
> Five options:
>
> > 1) Embed the libraryDirectory in your executable:
> >
> >
g++ -IpathDirectory -LlibraryDirectory -Lrpath=libraryDirectory -llibraryNam
e sourcefilename.cpp
>
> Correction: make that
>
>   g++ -IpathDirectory source.cpp -Wl,-rpath=libraryDirectory -L... -l...
>
> > 2) Use the LD_LIBRARY_PATH environment variable:
>
> 3) Add libraryDirectory to the /etc/ld.so.conf and run /sbin/ldconfig.
>
> 4) Link against the archive version of the library:
>
>   g++ -I... source.cpp /path/to/library.a
> or
>   g++ -I... source.cpp -L/path/to -Wl,-Bstatic -llibraryName -Wl,-Bdynamic
>
> > "> How can I link to my executable the ".a" library files?
>
> See the 2 commands above.
>
> > g++ -static -IpathDirectory -LlibraryDirectory -llibraryName
sourcefilename.cpp
>
> The above -- linking completely static executable -- is extremely bad
idea(TM).
>
> > I think.  I am not sure if you really want to do this -- you will likely
> > get a *huge* executable, since it is likely to link ALL of the system
> > libraries statically.
>
> Not only that, but your executable will likely break if/when you
> move it to machines with newer versions of glibc [dynamically-linked
> executables generally continue to work fine under these conditions].
>
> 5)
> > Oh, you *could* also copy the .so file to /usr/local/lib and make sure
> > /usr/local/lib is in /etc/ld.so.conf and re-run /sbin/ldconfig (as
> > root).  This will make the .so file visible to the run-time loader,
> > automagically.
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]