[PATCH 3 of 3] auto/lib/*: prepend include location with sysroot path

Maxim Dounin mdounin at mdounin.ru
Tue May 13 18:12:21 UTC 2014


Hello!

On Fri, May 09, 2014 at 02:18:19PM +0200, Samuel Martin wrote:

> Hi Maxim, all,
> 
> On Fri, May 9, 2014 at 5:55 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Hello!
> >
> > On Sun, May 04, 2014 at 09:33:55PM +0200, Samuel Martin wrote:
> >
> >> # HG changeset patch
> >> # User Samuel Martin <s.martin49 at gmail.com>
> >> # Date 1399231473 -7200
> >> #      Sun May 04 21:24:33 2014 +0200
> >> # Node ID b9787fdc8bac3559fd9da679dc04e8fc50cb74f3
> >> # Parent  03617a96c528d1f02abf829df964fcb29b06c942
> >> auto/lib/*: prepend include location with sysroot path
> >>
> >> This patch introduce a new NGX_SYSROOT variable used when
> >> cross-compiling with gcc.
> >>
> >> When cross-compiling nginx, the gcc-based cross-compiler will
> >> automatically set the NGX_SYSROOT value to the right value. This
> >> variable remains empty if not cross-compiling or no gcc compiler is
> >> detected.
> >> This NGX_SYSROOT is prepended to the ngx_feature_path content when
> >> additional location should be added to the include directory list.
> >>
> >> This is necessary to prevent gcc from complaining about unsafe include
> >> location for cross-compilation (-Wpoision-system-directories), currently
> >> only triggered by libxslt.
> >>
> >> diff -r 03617a96c528 -r b9787fdc8bac auto/cc/gcc
> >> --- a/auto/cc/gcc     Sun May 04 00:40:49 2014 +0200
> >> +++ b/auto/cc/gcc     Sun May 04 21:24:33 2014 +0200
> >> @@ -15,6 +15,10 @@
> >>
> >>  have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
> >>
> >> +# set sysroot in case of cross-compilation
> >> +if [ x$NGX_CROSSBUILD = xcrossbuild ]; then
> >> +    NGX_SYSROOT=`$CC -print-sysroot`
> >> +fi
> >
> > $ gcc -print-sysroot
> > gcc: unrecognized option '-print-sysroot'
> > gcc: No input files specified
> 
> Is this printed in stderr or stdout?
> 
> What gcc version are you using? on what distro?
> Even on a old debian squeeze, gcc 4.4.5 supports this option and
> answers nothing in stdout:

This comment is not about gcc version I'm using, this is about the 
fact that "-print-sysroot" doesn't work with all gcc versions.  
And nginx supports gcc starting with at least 2.95 (and you can 
even see code about gcc 2.7 in cc/gcc).

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list