static compile of rsync

Lopez David E David.Lopez at freescale.com
Tue Mar 18 23:37:45 GMT 2008


paul

I added the "-static" to my CC environment:
bash> export CC=-static

bash> ./configure; make

here are my last few output lines from make:

gcc -std=gnu99 -I. -I. -static -DHAVE_CONFIG_H -Wall -W  -c
zlib/compress.c -o zlib/compress.o
gcc -std=gnu99 -I. -I. -static -DHAVE_CONFIG_H -Wall -W  -c zlib/crc32.c
-o zlib/crc32.o
gcc -std=gnu99 -static -DHAVE_CONFIG_H -Wall -W  -o rsync flist.o
rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o
main.o checksum.o match.o syscall.o log.o backup.o options.o io.o
compat.o hlink.o token.o uidlist.o socket.o hashtable.o fileio.o batch.o
clientname.o chmod.o acls.o xattrs.o progress.o pipe.o params.o
loadparm.o clientserver.o access.o connection.o authenticate.o
lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o
lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o
lib/getaddrinfo.o zlib/deflate.o zlib/inffast.o zlib/inflate.o
zlib/inftrees.o zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o
zlib/crc32.o  -lpopt -lsec -lsocket -lnsl 
lib/getaddrinfo.o: In function `pg_getaddrinfo':
getaddrinfo.c:(.text+0x8c0): undefined reference to `inet_aton'
/usr/lib/libnsl.a(netdir.o): In function `load_xlate':
netdir.c:(.text+0xe30): undefined reference to `dlopen'
netdir.c:(.text+0xe64): undefined reference to `dlsym'
netdir.c:(.text+0xe98): undefined reference to `dlsym'
netdir.c:(.text+0xecc): undefined reference to `dlsym'
netdir.c:(.text+0xf00): undefined reference to `dlsym'
netdir.c:(.text+0xf34): undefined reference to `dlsym'
netdir.c:(.text+0xfd8): undefined reference to `dlclose'
/usr/lib/libnsl.a(netdir.o): In function `netdir_sperror':
netdir.c:(.text+0x1188): undefined reference to `dlerror'
/usr/lib/libc.a(nss_deffinder.o): In function `SO_per_src_lookup':
nss_deffinder.c:(.text+0x88): undefined reference to `_dlopen'
nss_deffinder.c:(.text+0xb8): undefined reference to `_dlsym'
nss_deffinder.c:(.text+0xcc): undefined reference to `_dlclose'
/usr/lib/libc.a(nss_deffinder.o): In function `SO_per_src_delete':
nss_deffinder.c:(.text+0x104): undefined reference to `_dlclose'
collect2: ld returned 1 exit status
make: *** [rsync] Error 1

just as you say. won't build static compile.

just wondering... what if I create a library directory with all
of the dependences and ship it with rsync. could I just create
a script to set the LD_LIBRARY_PATH env var to that lib prior
to running rsync? would not that work in far away hosts?

david

-----Original Message-----
From: rsync-bounces+r9374c=freescale.com at lists.samba.org
[mailto:rsync-bounces+r9374c=freescale.com at lists.samba.org] On Behalf Of
Paul Slootman
Sent: Tuesday, March 18, 2008 11:38 AM
To: rsync at lists.samba.org
Subject: Re: static compile of rsync

On Tue 18 Mar 2008, Lopez David E wrote:

> I've looked at the last 6 months on the list and did not find any 
> reference on how to static compile of rsync. I looked at the 
> ./configure --help with no luck.
> 
> I'm on solaris 2.8 using gcc 4.1.1. when I run thru the process 
> (./configure; make; make install) and run ldd rsync, I get a list of 
> 10 or so libxxx.so.n. I'm compiling rsync-3.0.0.

You'll have to supply -static as an additional CC flag.
Probably this is possible by calling configure with CC=-static appended
to your list of options (if any).

> I need to distribute the rsync pgm to 25 hosts scattered around the 
> globe. do not want any dependencies.

Be aware that at least when using glibc, a number of things are always
dynamic, e.g the nsswitch stuff (for host lookups etc.) If the targets
are linux systems, then the safest way is to build appropriate
packages...


Paul Slootman
--
To unsubscribe or change options:
https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


More information about the rsync mailing list