I'm wondering how to build a static binary.
I tried using:
./configure -disable-shared CCFLAGS=LDFLAGS="-Wl,-static" CFLAGS=-O2
but my program links with libxml2, so when linking I still see:
(notice how libxml2.so is listed)
/bin/sh ../libtool --mode=link gcc -Wall -O2 -Wl,-static -o swish-e swish.o
keychar_out.o dump.o result_output.o libswishindex.la libswish-e.la -lm
gcc -Wall -O2 -Wl,-static -o swish-e swish.o keychar_out.o dump.o result_output.o
./.libs/libswishindex.a /usr/lib/libxml2.so -lpthread ./.libs/libswish-e.a -lz -lm
I assume that .so listing prevents building the binary static. I'm able
to build a static binary by running this directly (notice -lxml2
instead):
gcc -Wall -O2 -Wl,-static -o swish-e swish.o keychar_out.o dump.o result_output.o
./.libs/libswishindex.a -lxml2 -lpthread ./.libs/libswish-e.a -lz -lm
Does libtool deal specially with libxml2? I noticed that xml2-config
has a special option for libtool.
$ xml2-config --libtool-libs
/usr/lib/libxml2.la
I don't really grok libtool well enough to understand why libxml2 is
listed specifically as a .so.
In my configure.in I set:
LIBXML2_LIB="`$XML2_CONFIG --libs`"
LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`"
and in my Makefile.am I use those as:
AM_CPPFLAGS = -Dlibexecdir=\"${libexecdir}\" \
-DPATH_SEPARATOR=\"${PATH_SEPARATOR}\" \
$(Z_CFLAGS) $(PCRE_CFLAGS) $(LIBXML2_CFLAGS) -Ireplace
libswishindex_la_LDFLAGS = $(LIBXML2_LIB) $(Z_LIBS) $(PCRE_LIBS)
libswishindex.la gets generated with this line:
# Libraries that this one depends upon.
dependency_libs=' -L/usr/lib /usr/lib/libxml2.la -lpthread -lz -lm '
I guess what I'd like to be able to do is simply:
./configure --static
Thanks for the pointers,
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool