It may seem that this line is sane:
C:/MinGW/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/../../../../i686-w64-mingw32/include

To confirm it is:
find
"C:/MinGW/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/../../../../i686-w64-mingw32/include"
-name "stdlib.h" -print

If it prints out the correct file, then you know your include line is sane.

If it isn't there, then find it and then you have two choices:
1)add the location where that stdlib.h file is to your compile flags as
another -IextrapathTostdlibhdir

2)modify C:/MinGW/mingw32/include/c++/6.1.1/cstdlib
to explicitly include
"C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/include/stdlib.h"
without any relative path nonsense.
i.e.
#include
"C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/include/stdlib.h"

The include path order is sane though.  C headers first then c++ headers
follow.

On 04/28/2016 09:54 PM, lh_mouse wrote:
> 0) There was no Makefile. My testcase contained only one line of commands:
>    echo '#include <cstdio>' | g++ -v -x c++ -
> 1) The output of g++ -v could be found here: http://paste.ubuntu.com/16095300/
>      I don't think the linker had something to do with it because it was the 
> preprocessor that failed.
> 2) Before the test, all environment variables were cleared, including PATH. 
> Then an absolute path designating the 'bin' directory where gcc resided was 
> added to PATH.
>    It was the only envvar there.
> 
> N.B. This problem isn't reproducible on gcc-5-branch.
> 
> ------------------                             
> Best regards,
> lh_mouse
> 2016-04-29
> 
> -------------------------------------------------------------
> 发件人:David Marceau <[email protected]>
> 发送日期:2016-04-29 05:59
> 收件人:msys2-users
> 抄送:
> 主题:Re: [Msys2-users] Hard-coded C++ paths and reloation problem on
>  Windows
> 
> Please provide a specific Makefile that you used for the build where you
> are getting this error.
> The other things that could help isolate the source of the issue:
> -"make -d" for verbose
> -gcc -v for verbose
> -set the linker to verbose within gcc also.
> -output for the "set" command itself showing all the environment
> variables you have currently for the PATH and INCLUDE, LD_LIBRARY_PATH
> and anything that resembles these that GCC might be using.
> 
> My hunch is the gcc-6 headers and libs are at the end of the environment
> variable AFTER the gcc 5.3 headers and libs.
> 
> Manually tweak those environment variables to reverse the order...look
> in gcc6 headers first and then gcc5 headers if it can't find them.
> Ditto for the libs.
> 
> On 04/28/2016 11:25 AM, lh_mouse wrote:
>> Hi all.
>>
>> I have built GCC from gcc-6-branch in MSYS2 with mingw-w64 CRT on Windows 
>> today.
>> Now I have a relocation problem:
>>
>> Assuming mingw-w64 headers are located in the follow directory,which is, the 
>> native_system_header_dir:
>>> C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/include
>> I have built GCC and it has that hard-coded path.
>> When I compile something using g++ -v, the headers are searched in the 
>> following paths:
>> ```
>> ignoring nonexistent directory "/mingw32/include"
>> ignoring duplicate directory 
>> "C:/MinGW/MSYS2/mingw32/i686-w64-mingw32/include"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  C:/MinGW/MSYS2/mingw32/include/c++/6.1.1
>>  C:/MinGW/MSYS2/mingw32/include/c++/6.1.1/i686-w64-mingw32
>>  C:/MinGW/MSYS2/mingw32/include/c++/6.1.1/backward
>>  C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/include
>>  C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/../../../../include
>>  C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/include-fixed
>>  
>> C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.1.1/../../../../i686-w64-mingw32/include
>> End of search list.
>> ```
>> The C++ headers are searched before any mingw-w64 headers, which is just 
>> fine.
>>
>> However, if I move gcc to another directory, let's say, 
>> C:/this_is_a_new_directory/mingw32/,
>> then re-compile the same program with g++ -v, the headers are searched in 
>> the following paths:
>> ```
>> ignoring duplicate directory 
>> "C:/this_is_a_new_directory/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/6.1.1/include"
>> ignoring nonexistent directory "C:/MinGW/MSYS2/mingw32/include"
>> ignoring nonexistent directory "/mingw32/include"
>> ignoring duplicate directory 
>> "C:/this_is_a_new_directory/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/6.1.1/include-fixed"
>> ignoring duplicate directory 
>> "C:/this_is_a_new_directory/mingw32/lib/gcc/../../lib/gcc/i686-w64-mingw32/6.1.1/../../../../i686-w64-mingw32/include"
>> ignoring nonexistent directory 
>> "C:/MinGW/MSYS2/mingw32/i686-w64-mingw32/include"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  
>> C:/this_is_a_new_directory/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/include
>>  
>> C:/this_is_a_new_directory/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/../../../../include
>>  
>> C:/this_is_a_new_directory/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/include-fixed
>>  
>> C:/this_is_a_new_directory/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.1/../../../../i686-w64-mingw32/include
>>  C:/this_is_a_new_directory/mingw32/lib/gcc/../../include/c++/6.1.1
>>  
>> C:/this_is_a_new_directory/mingw32/lib/gcc/../../include/c++/6.1.1/i686-w64-mingw32
>>  C:/this_is_a_new_directory/mingw32/lib/gcc/../../include/c++/6.1.1/backward
>> End of search list.
>> ```
>> This time the C++ headers are searched after mingw-w64 headers, which causes 
>> the following error:
>> ```
>> In file included from 
>> C:/MinGW/mingw32/include/c++/6.1.1/ext/string_conversions.h:41:0,
>>                  from 
>> C:/MinGW/mingw32/include/c++/6.1.1/bits/basic_string.h:5402,
>>                  from C:/MinGW/mingw32/include/c++/6.1.1/string:52,
>>                  from 
>> C:/MinGW/mingw32/include/c++/6.1.1/bits/locale_classes.h:40,
>>                  from C:/MinGW/mingw32/include/c++/6.1.1/bits/ios_base.h:41,
>>                  from C:/MinGW/mingw32/include/c++/6.1.1/ios:42,
>>                  from C:/MinGW/mingw32/include/c++/6.1.1/ostream:38,
>>                  from C:/MinGW/mingw32/include/c++/6.1.1/iostream:39,
>>                  from test.cpp:1:
>> C:/MinGW/mingw32/include/c++/6.1.1/cstdlib:75:25: fatal error: stdlib.h: No 
>> such file or directory
>>  #include_next <stdlib.h>
>>                          ^
>> compilation terminated.
>> ```
>>
>> Do you know how to solve this problem (modifications to gcc source code are 
>> expected)?
>> Thanks in advance.
>>
>>
>>
>>                              
>> --------------
>> Best regards,
>> lh_mouse
>> 2016-04-28
>>
>>
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> _______________________________________________
>> Msys2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/msys2-users
>>
> 
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> Msys2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/msys2-users
> 
> 


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Msys2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to