automake
[Top][All Lists]
Advanced

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

Re: Compiling statically


From: Ralf Wildenhues
Subject: Re: Compiling statically
Date: Sun, 6 Jul 2008 10:42:47 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Paulo,

* Paulo J. Matos wrote on Thu, Jun 26, 2008 at 02:34:50PM CEST:
> To compile a program fully-statically I do:
> ./configure CPPFLAGS="-DNDEBUG -I../../libfileIO-0.2.3/src"
> CXXFLAGS="-O3" LDFLAGS="-static-libgcc -static -Wl,-Bstatic
> -L../../libfileIO-0.2.3/src"

You can try something like
 
  ./configure CPPFLAGS="-DNDEBUG -I../../libfileIO-0.2.3/src" CXXFLAGS="-O3" 
LDFLAGS="-static-libgcc -L../../libfileIO-0.2.3/src" --disable-shared
  make LDFLAGS="-static-libgcc -L../../libfileIO-0.2.3/src -all-static"

(one problem is that the link tests in configure don't use libtool to
link, thus you can't use -all-static there).

> In the linking phase things go wrong:
> /bin/sh ../libtool --tag=CXX   --mode=link g++ -Wall -std=c++98 -ggdb
> -O3 ../ubcsat/libubcsat.la -lfileio -static-libgcc -static
> -Wl,-Bstatic -L../../libfileIO-0.2.3/src -o maxsatzilla.bin
> maxsatzilla_bin-main.o maxsatzilla_bin-MaxSatInstance.o
> maxsatzilla_bin-argumentsparser.o  -lz -lm -lgslcblas -lgsl -lgmp
> -lcblas -lblas
> 
> libtool: link: g++ -Wall -std=c++98 -ggdb -O3 -static-libgcc
> -Wl,-Bstatic -o maxsatzilla.bin maxsatzilla_bin-main.o
> maxsatzilla_bin-MaxSatInstance.o maxsatzilla_bin-argumentsparser.o
> ../ubcsat/.libs/libubcsat.a
> -L/home/pmatos/software/maxsatzilla/tags/libfileIO-0.2.3/src
> /home/pmatos/software/maxsatzilla/tags/libfileIO-0.2.3/src/.libs/libfileio.a
> -lz /usr/lib64/libgsl.so /usr/lib64/libgslcblas.so -lm
> /usr/lib64/libgmp.so -lcblas -lblas
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/../../../../x86_64-pc-linux-gnu/bin/ld:
> attempted static link of dynamic object `/usr/lib64/libgsl.so'
> 
> Why is -lgsl converted to /usr/lib64/libgsl.so instead of the static
> archive?

Because to libtool, -static means to link uninstalled libtool libs
statically, not all libs.

> and the same with gmp and gslcblas? And by the way, why is
> -lcblas and -lblas not expanded?

Probably because there are no libcblas.la and libblas.la files
installed.

Hope that helps.

Cheers,
Ralf




reply via email to

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