Cross compilation support for nginx

Daniele Salvatore Albano - Lavoro info at
Tue Mar 1 17:41:57 MSK 2011

Hi to all,

this is my first message here  :)

I love this webserver and i'm trying to get it running on an x86 
embedded system, an alix 2d13. I've built my system using crosstools-ng, 
buildroot with some own patches and a really recent kernel, version 2.6.37.

My appliance need to handle a lot of http connection to serve static 
pages and, while using lighttpd i got good results, i want more so i'm 
trying to switch to nginx!

The main problem is that nginx uses a (really nice) hand-made configure 
script (or it seems to be this at me) that natively doesn't support 
cross compilation.

My objective is to let nginx to be built using a cross compiler on 
linux, actually for x86/32bit.

To do this i patched the configure system to don't run features that 
doesn't need to be run and to skip features that need to be run.
Values features, as types size, have been replaced using predefined 
values (this could give strange problems in some cases i think, for 
example for NGX_SYS_NERR).

I've done really few tests because my toolchain was compiled with uClibc 
and the AIO support isn't there (well, this is weird ... i've compiled 
it but it isn't there) so i'm switcing to eglibc (not much a problem).
I got nginx compiled, but i didn't test it yet: well it started on the 
build machine without segfaulting (my build system uses eglibc 2.11 
while i used eglibc 2.12 for the target machine so no much difference).

Modifications are done on 0.9.5 and not on git, but this stuff isn't 
directly related to sources so should be ininfluent (i think). Attached 
there is a preliminary test patch.

Someone can give a shot to the attached patch, please :)

I've some questions:
- i've seen that ngx_error.c need to get max error messages count, i've 
workaraounded the problem manually adding it to the configure script but 
it's an hack but really i didn't have any idea on how to resolve it;
- i've used NGX_PLATFORM and crossbuild to define a crossbuild setting 
it to cross-linux-32, is this fine?
- mmap(MAP_ANON|MAP_SHARED) and mmap("/dev/zero", MAP_SHARED) features 
can't be tested because need to run, must them be dropped or must be 
enabled by default?

I've compiled it using
./configure --with-poll_module --with-file-aio --with-ipv6 
--with-http_flv_module --with-http_gzip_static_module --without-pcre 
--without-http_gzip_module --without-http-cache 
--without-http_rewrite_module --without-http_uwsgi_module 
  --with-cpu-opt="pentium" --crossbuild=cross-linux-32

Attached there are configure and make output too.

Best regards,

Daniele Salvatore Albano
Daniele Salvatore Albano                | web site:
  IT Consultant                          |
  Website Design and Development         |
  Software Engineer and Developer        | e-mail:
  Linux Servers SetUp And Administration | info at
  Embedded Network Solutions             | d.albano at

Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in 
questo messaggio sono riservate ed a uso esclusivo del destinatario. 
Qualora il messaggio in parola Le fosse pervenuto per errore, La 
invitiamo ad eliminarlo senza copiarlo e a non inoltrarlo a terzi, 
dandocene gentilmente comunicazione. Grazie.
Pursuant to Legislative Decree No. 196/2003, you are hereby informed 
that this message contains confidential information intended only for 
the use of the addressee. If you are not the addressee, and have 
received this message by mistake, please delete it and immediately 
notify us. You may not copy or disseminate this message to anyone. Thank 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nginx-0.9.5-crosscompile.patch
URL: <>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nginx-configure-output
URL: <>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nginx-make-output
URL: <>

More information about the nginx-devel mailing list