Cross Compiling Nginx

Maxim Dounin mdounin at mdounin.ru
Wed Dec 28 17:40:25 UTC 2011


Hello!

On Wed, Dec 28, 2011 at 07:46:05AM -0800, Doug Kehn wrote:

> Hi All,
> 
> I'm cross compiling Nginx for an ARM Cortex A8 processor.  
> Attached is a patch for review which allows Nginx to be cross 
> compiled.  I believe the patch is generic enough to allow Nginx 
> to be cross compiled in any cross compile environment.  I also 
> don't believe that I've broken any existing functionality.  
> After applying the patch, Nginx can be cross compiled with:
> 
> ./configure \--prefix= \
> 
> --crossbuild=Linux:$(ARCH) \
> --with-cc-opt="$(CFLAGS)" \
> --with-ld-opt="$(LDFLAGS)" \
> --with-endian=$(ENDIAN) \
> --with-int=4 \
> --with-long=4 \
> --with-long-long=8 \
> --with-ptr-size=4 \
> --with-sig-atomic-t=4 \
> --with-size-t=4 \
> --with-off-t=4 \
> --with-time-t=4 \
> --with-sys-nerr=132
> make
> 
> In my case $(ARCH) = arm, $(ENDIAN) = little, and 
> $(CFLAGS)/$(LDFLAGS) are set according to my environment.  The 
> variable sizes were determined empirically by cross compiling a 
> simple program and executing on the target.

I would like to support cross-compilation of nginx, but I would 
like to see something more extensible, not configure arguments to 
specify anything.  I.e. some configuration file and/or defaults 
for type sizes, ngx_feature_run=yes tests and so on.

First step would probably be to audit ngx_feature_run=yes tests 
and remove "yes" in cases where it's not needed/can be handled at 
runtime.

Maxim Dounin



More information about the nginx-devel mailing list