[Bonmin] how to build a completely static version version of bonmin

Jeff Linderoth jtl3 at lehigh.edu
Fri Aug 11 07:14:24 EDT 2006


Hi Andreas,

I just wanted to respond to the list to say "thank you", and also to say
that the combination of 

1) export AM_LDFLAGS='-all-static' 
and
2) ADD_FFLAGS='-static'

were able to get an all-static bonmin built for me.

Thanks again.

Cheers,
-Jeff



On Thu, 2006-08-10 at 17:33 -0400, Andreas Waechter wrote:
> Hi,
> 
> I think the all-static linking issue is still not resolved...
> 
> Just for clarification:
> 
> On systems there the Makefiles can build shared libraries, those are build 
> by default.  If one specifies the --disable-shared flag for configure, no 
> shared libraries are built, and instead static ones are generated.  If one 
> specifies --enable-shared (and no --disable-shared) then both types of 
> libraries are built.  See also 
> https://projects.coin-or.org/BuildTools/wiki/user-configure
> 
> If one wants to build a completely static version of Bonmin, one would 
> have to specify --disable-shared.
> 
> Linking everything static seems to be a bit of a hassle.  I got it to work 
> now on a 64bit Linux machine, but I had to use some tricks.  At some 
> point, we can provide a clean "-enable-all-static-compile" flag for 
> configure, but for now, please try the following:
> 
> 1. Tell the Makefiles, that the '-all-static' flag should be given to 
> libtool for linking.  Since this flag is not understood by the compilers 
> directly, we have to do that with a little detour, namely by setting the 
> environment variable AM_LDFLAGS to that value (which is then picked up 
> directly in the Makefiles, but ignored by configure).
> 
> Set the environment variable
> 
> setenv AM_LDFLAGS '-all-static'  (for [t]csh)
> 
> or
> 
> export AM_LDFLAGS='-all-static'  (for [ba]sh)
> 
> Note, this needs to be done every time in a shell in which 'make' is 
> executed!!!
> 
> 2. Since the configure scripts try to find out the runtime libraries for 
> the Fortran compiler automatically, we need to tell the fortran compiler 
> that we want to generate static linking.  For the GNU compiler, this is 
> done with the '-static' flag.  We can add a flag for the Fortran compiler 
> using the ADD_FFLAGS variable.
> 
> configure --disable-shared ADD_FFLAGS='-static'
> 
> 3. At least on the system I was working on, it seems that the libtool file 
> libstdc++.la sets the dependency of libstdc++.* to include -lgcc_s, but 
> this is incorrect for static linking...  I simply changed the file
> 
> /usr/lib64/libstdc++.la
> 
> so that the line with dependency_libs reads:
> 
> dependency_libs=' -lm -lc'
> 
> I had to be root to do that.  This is of course not nice, but for now 
> it might be a remedy...
> 
> > ../configure -C enable_static=yes enable_shared=no build_old_libs=yes 
> > build_libtool_libs=no
> 
> BTW, I don't think it is a good idea in general to try to overwrite 
> internal configure variables like build_old_libs and build_libtool_libs.
> 
> Please give it a try, and at some point I can implement a better generic 
> flag for configure.
> 
> Hope this helps,
> 
> Andreas
> 
> 
> >
> > followed by make..
> >
> > however, looking at the output of make, it looks like libgfortran.so is being 
> > linked to the solver instead of libgfortran.a:
> >
> > this is part of the last line of make:
> > -L/usr/lib/../lib /usr/lib/libgfortranbegin.a /usr/lib/libgfortran.so -lm 
> > -lgcc_s
> >
> > how can I build a completely static version that has no soft links to any 
> > library build in.. I want to do this because I want to run bonmin on a 
> > different machine where the library libgfortran is not available at exactly 
> > the same place (/usr/lib)
> >
> > any help regarding this will be highly appreciated...
> > thanks..
> > Cheers,
> > Abhishek.
> > _______________________________________________
> > Bonmin mailing list
> > Bonmin at list.coin-or.org
> > http://list.coin-or.org/mailman/listinfo/bonmin
> >
> _______________________________________________
> Bonmin mailing list
> Bonmin at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/bonmin
-- 
------------------------------------------------------------
Jeff Linderoth                               O: 610-758-4879
Asst. Professor                              
Industrial and Systems Engineering           jtl3 at lehigh.edu
Lehigh University                       www.lehigh.edu/~jtl3          



More information about the Bonmin mailing list