Android

nginx on Android!

I have finally got nginx statically compiled for ARMv5 platforms (version 0.7.69).

It was difficult because linking with libz statically posed some issues and also because it needs large file system support which my toolchain did not have.

One observation: nginx doesn’t want to start without /etc/passwd and /etc/group and without strace – it was easy to spot that the error is the same unless both the files are there:

[root@arc]/usr/local/nginx/conf# nginx
[emerg]: getpwnam("nobody") failed (2: No such file or directory)

1. readelf 2.20.1.20100303 output:

[root@arc]/system/xbin# readelf -A nginx
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "XSCALE"
  Tag_CPU_arch: v5TE
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align8_needed: Yes
  Tag_ABI_enum_size: int

2. ldd reports it as static:

[root@arc]/system/xbin# ldd nginx
        not a dynamic executable

For now I can only see the error page since I did not yet configure it with PHP-CGI:

nginx on Android

nginx on Android

The more the merrier !

7 Comments

  1. –enable-fpm

  2. sti

    very nice! have you gotten PHP to work since then? also, any chance of this working on non-rooted devices?

  3. give me files plese

  4. gabin

    Can you provide more detailed instruction for compling nginx under arm?

  5. Shushant

    i have successfully cross compile nginx but when ever i try to run the nginx socket operation is getting blocked can you please provide me information about what portion i need to patch

  6. Comment by post author

    I would need more details on what that blocking means, do you have an error message ?

  7. Shushant

    well, here is the nginx binary https://drive.google.com/uc?export=download&id=0B1YIxncPig-AQTRQeUpWMGhBU3M which is cross compiled with following patch https://github.com/kitech/android-nmp/blob/master/nginx-1.4.1-android.patch without (src/core/glob.c, src/core/crypt.c, src/core/md5.c, src/core/des.c) as it is not required in glibc still i am uanble to debug it with socat or strace

Leave a Reply