W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2001

Re: Compiling Static Binaries with libwww

From: <twm139@its.to>
Date: Sat, 1 Sep 2001 20:41:54 -0600 (MDT)
To: <www-lib@w3.org>
Message-ID: <Pine.LNX.4.33.0109012034330.5005-100000@arnold.its.to>
Yes, replying to my own post, seems the fix was to use the libtool
program.

Here is the commands I use to compile one of the examples.

First++

gcc -DHAVE_CONFIG_H -I/usr/include/w3c-libwww/ -I/usr/include -g -O2 -c
load.c

Then++(All one line)

libtool --mode=link gcc -g -O2  -o load load.o  /usr/lib/libwwwinit.la
/usr/lib/libwwwapp.la     /usr/lib/libwwwxml.la /usr/lib/libxml
parse.la /usr/lib/libxmltok.la /usr/lib/libwwwhtml.la
/usr/lib/libwwwtelnet.la         /usr/lib/libwwwnews.la    /usr/lib/libwww
http.la    /usr/lib/libwwwmime.la    /usr/lib/libwwwgopher.la
/usr/lib/libwwwftp.la    /usr/lib/libwwwdir.la     /usr/lib/libwwwcache.
la   /usr/lib/libwwwstream.la  /usr/lib/libwwwfile.la
/usr/lib/libwwwmux.la     /usr/lib/libwwwtrans.la  /usr/lib/libwwwcore.la
/usr/lib/libwwwutils.la   /usr/lib/libwwwssl.la      -lm
/usr/lib/libwwwzip.la   /usr/lib/libmd5.la -ldl  -lz -L/usr/lib -lssl
-lcrypto

I know, probably old news to most of you, but new to me. :)

Cheers,

Terrence


On Sat, 1 Sep 2001 twm139@its.to wrote:

> I have seen some references to compiling libwww linked programs
> statically, but as with those posts that mention it I get linker errors
> when I try to compile with the -static.
>
> I am trying to compile some of the examples
>
> gcc -o load -static `libwww-config --cflags` load.c `libwww-config --libs`
> /usr/lib/libwwwcore.a(HTWWWStr.o): In function `HTMessageIdStr':
> HTWWWStr.o(.text+0x849): the use of `tmpnam' is dangerous, better use
> `mkstemp'
> /usr/lib/libwwwcore.a(HTInet.o): In function `HTGetTmpFileName':
> HTInet.o(.text+0x8a4): the use of `tempnam' is dangerous, better use
> `mkstemp'
> /usr/lib/libwwwapp.a(HTInit.o): In function `HTConverterInit':
> HTInit.o(.text+0x221): undefined reference to `HTXML_new'
> HTInit.o(.text+0x248): undefined reference to `HTXML_new'
> /usr/lib/libwwwapp.a(HTInit.o): In function `HTTransferEncoderInit':
> HTInit.o(.text+0x472): undefined reference to `HTZLib_inflate'
> /usr/lib/libwwwapp.a(HTInit.o): In function `HTContentEncoderInit':
> HTInit.o(.text+0x4c1): undefined reference to `HTZLib_inflate'
> collect2: ld returned 1 exit status
>
> This is the example that grabs a URL and returns its length. Dynamically
> linked compiles work fine.
>
> The reason I want to be able to compile a static binary is that I want to
> be able to place the program I am writing onto a RO filesystem and not
> depend on any local libraries.
>
> So if anyone has any suggestions I would greatly appreciate it.
>
> Thanks,
>
> Terrence
>
Received on Saturday, 1 September 2001 22:41:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:39 GMT