Bug ID 1206107
Summary i686-w64-mingw32-g++ and x86_64-w64-mingw32-g++ reporting incorrect default include paths for C++
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Major
Priority P5 - None
Component Development
Assignee screening-team-bugs@suse.de
Reporter spartanj@gmail.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/108.0.0.0 Safari/537.36
Build Identifier: 

Hi.
I usually cross-build an application with mingw32 and mingw64 and have no
problems, but since a couple of weeks ago I'm not able to build the application
because any standard library include in my C++ code will produce errors.
The error seems to be that the compiler is looking in the wrong places to build
the code. I always get a similar error like:

x86_64-w64-mingw32-g++ -O2 -g -pipe -Wall -fexceptions
--param=ssp-buffer-size=4 -mms-bitfields  -MD -MP -DDEBUG -DEE_DEBUG
-DEE_MEMORY_MANAGER  -m64 -g -B /usr/bin/x86_64-w64-mingw32- -Wall  -o
"../../obj/windows/x86_64/debug/pugixml-static/pugixml.o" -MF
"../../obj/windows/x86_64/debug/pugixml-static/pugixml.d" -c
"../../src/thirdparty/pugixml/pugixml.cpp"
In file included from /usr/include/c++/12/exception:37,
                 from ../../src/thirdparty/pugixml/pugixml.hpp:31,
                 from ../../src/thirdparty/pugixml/pugixml.cpp:17:
/usr/include/c++/12/x86_64-suse-linux/bits/c++config.h:3:10: fatal error:
bits/wordsize.h: No such file or directory
    3 | #include <bits/wordsize.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.



Looking into the include paths I get these:
prognoz@makyo /h/p/e/m/windows> echo | x86_64-w64-mingw32-g++ -xc++ -E -v -
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin
--includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib64
--mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
--build=x86_64-suse-linux-gnu --host=x86_64-suse-linux-gnu
--target=x86_64-w64-mingw32 --with-gnu-as --with-gnu-ld --verbose
--without-newlib --disable-multilib --enable-shared --disable-plugin
--with-system-zlib --disable-nls --without-included-gettext
--disable-win32-registry --enable-threads=posix
--enable-version-specific-runtime-libs
--with-sysroot=/usr/x86_64-w64-mingw32/sys-root
--enable-languages=c,c++,fortran,objc,obj-c++ --without-x
--enable-hash-synchronization --enable-fully-dynamic-string --enable-libgomp
--enable-linker-build-id --disable-vtable-verify --with-pkgversion='SUSE Linux'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (SUSE Linux)
COLLECT_GCC_OPTIONS='-E' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/cc1plus -E -quiet -v -D_REENTRANT -
-mtune=generic -march=x86-64 -dumpbase -
ignoring nonexistent directory
"/usr/x86_64-w64-mingw32/sys-root/usr/local/include"
ignoring nonexistent directory
"/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/12/
 /usr/include/c++/12/x86_64-suse-linux/
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++/x86_64-w64-mingw32
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include
 /usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include-fixed
 /usr/x86_64-w64-mingw32/sys-root/mingw/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
COMPILER_PATH=/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/:/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/:/usr/lib64/gcc/x86_64-w64-mingw32/:/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/:/usr/lib64/gcc/x86_64-w64-mingw32/
LIBRARY_PATH=/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/
COLLECT_GCC_OPTIONS='-E' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
prognoz@makyo /h/p/e/m/windows> echo | i686-w64-mingw32-g++ -xc++ -E -v -
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
Target: i686-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin
--includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib64
--mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
--build=x86_64-suse-linux-gnu --host=x86_64-suse-linux-gnu
--target=i686-w64-mingw32 --with-gnu-as --with-gnu-ld --verbose
--without-newlib --disable-multilib --enable-shared --disable-plugin
--with-system-zlib --disable-nls --without-included-gettext
--disable-win32-registry --enable-threads=posix
--enable-version-specific-runtime-libs
--with-sysroot=/usr/i686-w64-mingw32/sys-root
--enable-languages=c,c++,fortran,objc,obj-c++ --without-x
--enable-hash-synchronization --enable-fully-dynamic-string --enable-libgomp
--enable-linker-build-id --disable-vtable-verify --with-pkgversion='SUSE Linux'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (SUSE Linux)
COLLECT_GCC_OPTIONS='-E' '-v' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/cc1plus -E -quiet -v -D_REENTRANT -
-mtune=generic -march=pentiumpro -dumpbase -
ignoring nonexistent directory
"/usr/i686-w64-mingw32/sys-root/usr/local/include"
ignoring nonexistent directory
"/usr/lib64/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/12/
 /usr/include/c++/12/x86_64-suse-linux/
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/include/c++
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/include/c++/i686-w64-mingw32
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/include/c++/backward
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/include
 /usr/lib64/gcc/i686-w64-mingw32/12.2.0/include-fixed
 /usr/i686-w64-mingw32/sys-root/mingw/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
COMPILER_PATH=/usr/lib64/gcc/i686-w64-mingw32/12.2.0/:/usr/lib64/gcc/i686-w64-mingw32/12.2.0/:/usr/lib64/gcc/i686-w64-mingw32/:/usr/lib64/gcc/i686-w64-mingw32/12.2.0/:/usr/lib64/gcc/i686-w64-mingw32/
LIBRARY_PATH=/usr/lib64/gcc/i686-w64-mingw32/12.2.0/:/usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/i686-w64-mingw32/sys-root/mingw/lib/
COLLECT_GCC_OPTIONS='-E' '-v' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'

I seems that both compilers are getting the headers files from:
 /usr/include/c++/12/
 /usr/include/c++/12/x86_64-suse-linux/

I don't think that it's correct, it should be looking in the MinGW include
paths.

I can confirm that removing both incorrect include paths compilation works:
prognoz@makyo /h/p/e/m/windows [2]> x86_64-w64-mingw32-g++ -nostdinc
-nostdinc++ -I/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++
-I/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++/x86_64-w64-mingw32
-I/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward
-I/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include
-I/usr/lib64/gcc/x86_64-w64-mingw32/12.2.0/include-fixed
-I/usr/x86_64-w64-mingw32/sys-root/mingw/include -O2 -g -pipe -Wall
-fexceptions --param=ssp-buffer-size=4 -mms-bitfields  -MD -MP -DDEBUG
-DEE_DEBUG -DEE_MEMORY_MANAGER  -m64 -g -B /usr/bin/x86_64-w64-mingw32- -Wall 
-o "../../obj/windows/x86_64/debug/pugixml-static/pugixml.o" -MF
"../../obj/windows/x86_64/debug/pugixml-static/pugixml.d" -c
"../../src/thirdparty/pugixml/pugixml.cpp"

Also parameter:
-B /usr/bin/x86_64-w64-mingw32-
or
-B /usr/bin/i686-mingw32-

Must be passed in order to be able to build anything. This was not the case a
few months ago.

Reproducible: Always

Steps to Reproduce:
1. Try to cross-compile any C++ file with mingw32 or mingw64
Actual Results:  
Include file error

Expected Results:  
Successful compilation


You are receiving this mail because: