build failed on Linux with x32 ABI

Maxim Dounin mdounin at mdounin.ru
Mon Jun 24 15:36:08 UTC 2013


Hello!

On Mon, Jun 24, 2013 at 04:01:33PM +0300, Serguei I. Ivantsov wrote:

> Hi,
> 
> Nginx failed to build on Linux with x32 ABI.
> 
> >In file included from /usr/include/sys/sysctl.h:63:0,
> >                 from src/os/unix/ngx_linux_config.h:54,
> >                 from src/core/ngx_config.h:26,
> >                 from src/core/nginx.c:8:
> >/usr/include/bits/sysctl.h:19:3: error: #error "sysctl system call is
> >unsupported in x32 kernel"
> > # error "sysctl system call is unsupported in x32 kernel"
> 
> sysctl() is only used within RTSIG module, but included anyway in
> ngx_linux_config.h.
> 
> Please find the patch attached to address the issue.
> 
> --
>  Serguei I. Ivantsov

> diff -ru a/auto/os/linux b/auto/os/linux
> --- a/auto/os/linux	2013-06-04 16:21:53.000000000 +0300
> +++ b/auto/os/linux	2013-06-24 15:40:14.519059918 +0300
> @@ -28,7 +28,17 @@
>  
>  # enable the rt signals on Linux between 2.2.19 and 2.6.17
>  
> -if [ \( $version -ge 131603 -a $version -lt 132626 \) -o $EVENT_RTSIG = YES ]
> +ngx_feature="sysctl"
> +ngx_feature_name="NGX_HAVE_SYSCTL"
> +ngx_feature_run=yes
> +ngx_feature_incs="#include <sys/sysctl.h>"
> +ngx_feature_path=
> +ngx_feature_libs=
> +ngx_feature_test=
> +
> +. auto/feature
> +
> +if [ $ngx_found = yes -a \( \( $version -ge 131603 -a $version -lt 132626 \) -o $EVENT_RTSIG = YES \) ]
>  then
>      echo " + rt signals found"
>      have=NGX_HAVE_RTSIG . auto/have

This part looks unneeded.  We are probably ok with a build failure 
without sysctl() if rtsig was explicitly requested.

> diff -ru a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
> --- a/src/os/unix/ngx_linux_config.h	2013-06-04 16:21:53.000000000 +0300
> +++ b/src/os/unix/ngx_linux_config.h	2013-06-24 15:38:47.689061321 +0300
> @@ -51,13 +51,16 @@
>  #include <malloc.h>             /* memalign() */
>  #include <limits.h>             /* IOV_MAX */
>  #include <sys/ioctl.h>
> -#include <sys/sysctl.h>
>  #include <crypt.h>
>  #include <sys/utsname.h>        /* uname() */
>  
>  
>  #include <ngx_auto_config.h>
>  
> +#if (NGX_HAVE_RTSIG)
> +#include <sys/sysctl.h>
> +#endif
> +
>  
>  #if (NGX_HAVE_POSIX_SEM)
>  #include <semaphore.h>

This probably needs to be moved to other event method related 
conditional includes (and needs another empty line to match style).

See also here for some basic tips about submitting patches:

http://nginx.org/en/docs/contributing_changes.html

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list