I would like to provide an additional observation related to the issue I 
previously reported about `max_align_t` not being found during a Canadian Cross 
libstdc++ build.

In my earlier message, I noted that the build succeeds only when I manually add:

    
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/gcc/include

However, I have now confirmed that the problem can also be resolved by 
**removing** the following two `-isystem` include paths:

    -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/include
    -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/sys-include

After removing these two `-isystem` directives, the build succeeds even without 
explicitly adding the GCC include directory.

This suggests that the use of `-isystem` for the target libc headers may be 
suppressing or overriding the expected include search order, preventing 
libstdc++ from seeing the GCC-provided `stddef.h` that defines `max_align_t`.

________________________________
From: coshvji cujmlqef <[email protected]>
Sent: Monday, March 16, 2026 16:37
To: [email protected] <[email protected]>
Subject: Canadian Cross libstdc++ build fails to find `max_align_t` unless GCC 
include path is manually added

Hello,

I am reporting an issue encountered when building libstdc++ in a Canadian Cross 
toolchain configuration. I would like to confirm whether this behavior is 
expected or if it indicates a missing include path during the build.

Some libc implementations (such as DJGPP’s libc) do not provide `max_align_t`. 
Normally this is not a problem, because GCC’s own headers (from libgcc, e.g. 
gcc/include/stddef.h) provide a definition of `max_align_t`. When using the 
newly built cross compiler directly, libstdc++ correctly picks up this header.

However, during a Canadian Cross build, libstdc++ is compiled using the host 
compiler, and it appears that the target GCC include directory:

    $target/lib/gcc/$target/$version/include

is not added to the include search path. As a result, libstdc++ fails to see 
the `max_align_t` definition provided by libgcc, and the build fails with:

    /home/test/toolchains_build/gcc/libstdc++-v3/include/cstddef:66:11: error: 
'max_align_t' has not been declared in '::'
       66 |   using ::max_align_t;
          |           ^~~~~~~~~~~

Below is the failing command (paths unchanged except replacing the username as 
requested):

Failed command:

    i586-msdosdjgpp-c++ -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/include
 -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/sys-include
 \
      -x c++-header -nostdinc++ -g -O2 \
      
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/i586-msdosdjgpp/libstdc++-v3/include/i586-msdosdjgpp
 \
      
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/i586-msdosdjgpp/libstdc++-v3/include
 \
      -I/home/test/toolchains_build/gcc/libstdc++-v3/libsupc++ \
      -I/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/include \
      -O2 -g -std=gnu++0x \
      /home/test/toolchains_build/gcc/libstdc++-v3/include/precompiled/stdc++.h 
\
      -o i586-msdosdjgpp/bits/stdc++.h.gch/O2ggnu++0x.gch

The build succeeds if I manually add the GCC include directory:

Successful command (added GCC include path):

    i586-msdosdjgpp-c++ -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/include
 -isystem 
/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/i586-msdosdjgpp/sys-include
 \
      -x c++-header -nostdinc++ -g -O2 \
      
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/i586-msdosdjgpp/libstdc++-v3/include/i586-msdosdjgpp
 \
      
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/i586-msdosdjgpp/libstdc++-v3/include
 \
      -I/home/test/toolchains_build/gcc/libstdc++-v3/libsupc++ \
      -I/home/test/toolchains/gnu/x86_64-w64-mingw32/i586-msdosdjgpp/include \
      
-I/home/test/toolchains_build/toolchainbuildscripts/gcc/.artifacts/gcc/x86_64-w64-mingw32/i586-msdosdjgpp/gcc/gcc/include
 \
      -O2 -g -std=gnu++0x \
      /home/test/toolchains_build/gcc/libstdc++-v3/include/precompiled/stdc++.h 
\
      -o i586-msdosdjgpp/bits/stdc++.h.gch/O2ggnu++0x.gch

Adding the `gcc/gcc/include` directory resolves the issue.

My question is:

Should the target GCC include directory (e.g. gcc/gcc/include or 
libgcc/include) be automatically added to the include path when building 
libstdc++ in a Canadian Cross environment?

If not, is there a recommended or officially supported way to ensure that 
libstdc++ can see the target GCC headers during a Canadian Cross build, 
especially for platforms whose libc does not provide `max_align_t`?

Thank you for your time. Any guidance on whether this is expected behavior or a 
configuration issue would be appreciated.

Best regards

Reply via email to