Merge pull request #219811 from trofi/gcc-cross-no-sys-includes

gcc: do not install sys-include headers for cross-compilers.
This commit is contained in:
Sergei Trofimovich 2023-03-11 20:49:25 +00:00 committed by GitHub
commit d65d457f68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -250,6 +250,17 @@ postInstall() {
done
fi
# Cross-compiler specific:
# --with-headers=$dir option triggers gcc to make a private copy
# of $dir headers and use it later as `-isysroot`. This prevents
# cc-wrapper from overriding libc headers with `-idirafter`.
# It should be safe to drop it and rely solely on the cc-wrapper.
local sysinc_dir=$out/${targetConfig+$targetConfig/}sys-include
if [ -d "$sysinc_dir" ]; then
chmod -R u+w "$out/${targetConfig+$targetConfig/}sys-include"
rm -rfv "$out/${targetConfig+$targetConfig/}sys-include"
fi
# Get rid of some "fixed" header files
rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux}