Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] statically linked versions of samba and cups

On 06/28/04 22:56, Shaun Oliver wrote:
does anyone know where I can get some static binaries of smbd, nmbd, and cupsd,

Pete's 10 second guide to building static binaries:

Download and extract source tarball.
$ export CFLAGS=-static
$ export LDFLAGS=-static
Follow the package directions for compiling source.

This should work for any package that uses autoconf (and luckily both samba and CUPS do :-D). If you run a ./configure script as part of the build process, you should be sweet. The environment variables define options to add to the compiler and linker command lines respectively. I'm not sure if you need to set the CFLAGS - that's just how I've been doing it. Certainly doesn't do any harm. :-)

It's worthwhile running file(1) on the executables you end up building. It'll tell you if they really did end up static. Then strip(1) them, and you're ready to clag them wherever they need to be.

If file says the binary is dynamically linked, or if your source package doesn't recognise the environment variables, then you may need to manually edit makefiles and add -static to the linker command line.