[NCLUG] Static compiles

Gabriel L Somlo somlo at CS.ColoState.EDU
Fri May 31 14:20:17 MDT 2002


I don't know for sure, but the '-static' linker option may be case
sensitive, and it always worked for me in lowercase... :)

What I do when I want static binaries, is to simply build the whole
thing, and *before* doing a make install, do the following:

	find the newly built binary, and REMOVE it.

	run make again, and watch what for that gcc line where it
	 the binary together.

	run the same gcc line manually, but add  the  -static  flag.

	strip the resulting static binary if you want to squeeze its
	   size down a little.

Good luck,

Gabriel



-- 
-----------------------------------------------------------------------
     Gabriel L.  Somlo                   Assistant System Administrator
Computer Science Department
 Colorado State University               e-mail: somlo at cs.colostate.edu
  601 Howes St. 2nd Floor                 phone: +1 (970) 491-5305
  Fort Collins,  CO 80523
-----------------------------------------------------------------------

On Fri, 31 May 2002, Michael Dwyer wrote:

> Joshua SS Miller wrote:
> > I am looking to compile static versions of php and apache, but
> > not being a programmer I need a little help.  What I need to end
> > up with is a Apache and php module that do not depend on any thing
> > else on the box.  I want to be able to move it to another Linux box
> > and it just runs, no complaining "*lib not found".  All boxes will
> > be x86 running the Linux kernel, so I know that much, other then that I
> > can not say how much they will diff.
> 
> I've always compiled my PHP static /into/ Apache.  This means that you
> don't need a php library stuck on the outside.  The directions for this
> are in the PHP documentation.  In general, it is something like:
> 
>    ./configure --with-apache=../apache-1.3
> 
> ...though, you actually have to run it twice... See the readme's to see
> what I mean.
> 
> As for getting the rest of Apache to compile static... uh... yikes.  It
> is going to be HUGE, I hope you are aware...  I believe that you can add
> the -STATIC option to the compiler/linker arguments in the makefiles.
> 
> Possibly a better alternative is to carefully craft your Apache/PHP
> binary so that it doesn't include any strange libraries that you don't
> need.  PHP has a LOT of compilation options.  But if you decide that,
> for instance, you don't need the GD functionality, you can leave off a
> LOT of extra libraries -- like libtiff and libpng and libjpeg.  If you
> aren't going to be running a webmail system, you can leave off the IMAP
> stuff. 
> 
> This might be a better way to do it.  I consider myself a
> built-in-to-Apache-static PHP compiling ninja, so I might be able to
> help you chose which options you want...
> _______________________________________________
> NCLUG mailing list       NCLUG at nclug.org
> 
> To unsubscribe, subscribe, or modify your settings, go to:
> http://www.nclug.org/mailman/listinfo/nclug
> 




More information about the NCLUG mailing list