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

Samuel Martin s.martin49 at gmail.com
Fri May 9 12:18:19 UTC 2014


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:
---
$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -print-sysroot
$ echo $?
0
$
---

Regards,

-- 
Samuel



More information about the nginx-devel mailing list