[Spread-users] use a static lib, get rid of .so?

Theo Schlossnagle jesus at omniti.com
Fri Feb 9 09:13:01 EST 2007


You are getting the shared library as that is your linkers default.   
Pretty much all modern OSs prefer shared linkage over static.  This  
provides powerful ways to reduce memory usage in highly concurrent  
systems and most package maintainers and operators find it _easier_  
to manage application roll out to hundreds or thousands of nodes  
using the "current practice" for their OS.  So, if they are on Linux  
and pretty much everything shipped with Linux has shared  
dependencies, they roll their packages that way too.  Consistency is  
king.

A few solutions to your problem:

(1) Hard code the run-time library search path into your app.
       if you install spread libs in: /opt/myapp/3rdParty/lib
       Add -Wl,-rpath=/opt/myapp/3rdParty/lib to your gcc link line.

(2) When you link your app, use the .a file directly: /opt/myapp/ 
3rdParty/lib/libspread.a (instead of -lspread)

(3) link your all static with -Bstatic when building your  
application.  This is generally a bad idea.  As your linux  
distribution fixes bugs and provides those fixes to you (in glibc, or  
other libs you depend on) you will not benefit as you statically  
pulled the needed symbols from those libs at compile time.


We have several apps on our systems that utilize Spread.  And when I  
roll a new release of the Spread libraries onto the system (to fix a  
bug to compatibility issues) I _do not_ want to have to recompile  
every single app that links against it.  I just roll out new libs and  
everyone can use them.

On Feb 9, 2007, at 8:44 AM, Allen Brunson wrote:

> hello spread users,
>
> i casually looked through the mailing list archives, but didn't see  
> any questions like this.
>
> i am evaluating spread for potential use in a project.  i wrote a  
> bunch of test code on macosx to figure out the api.  so far, so  
> good.  but actual full-scale deployment would take place on linux  
> machines, so i tried recompiling my code over there.  it builds  
> okay, but when i try to run the resultant program, this is the  
> message i get:
>
>   error while loading shared libraries: libspread.so: cannot open  
> shared object file:
>   No such file or directory
>
> i suppose i could figure out why the program can't find  
> libspread.so, but i don't want to do that.  i'd rather build a  
> program that links against libspread.a and does not require any  
> shared objects at all.  if we end up using spread, it will be  
> deployed on hundreds of linux machines.  i don't want to have to  
> install libraries on all those machines.  that's how i *thought*  
> i'd built the program, but apparently not.  i just used -lspread on  
> the link line, and there is a libspread.a available, so i figured  
> that's what it would link against.
>
> i built spread 4.0.0 from source and installed it on a suse linux  
> box myself.  can anybody tell me how to either a) build it only as  
> a .a lib, rather than a .so lib, or b) how to link my program so  
> that it doesn't require the .so?
>
> thanks,
> allen
>
>
> ********************************************
> This message is intended only for the use of the Addressee and
> may contain information that is PRIVILEGED and CONFIDENTIAL.
>
> If you are not the intended recipient, you are hereby notified
> that any dissemination of this communication is strictly prohibited.
>
> If you have received this communication in error, please erase
> all copies of the message and its attachments and notify us
> immediately.
>
> Thank you.
> ********************************************
>
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users

// Theo Schlossnagle
// Principal at OmniTI: http://omniti.com
// Esoteric Curio: http://www.lethargy.org/~jesus/





More information about the Spread-users mailing list