Skip to content

Conversation

@trofi
Copy link
Contributor

@trofi trofi commented Jul 24, 2022

It's a follow-up to the breakage caused by 21966e1
("gcc: pass --with-build-sysroot=/"). It caused pkgsLLVM
cross-toolchain bootstrap breakage:

$ nix build --no-link -f. pkgsLLVM.hello
...
failed: /nix/store/...-x86_64-unknown-linux-gnu-stage-static-gcc-13.0.0.drv:
...
configure flags: ... --enable-languages=c --disable-multilib \
  --disable-shared --enable-plugin ... --disable-libssp --disable-nls \
  --without-headers --disable-threads --disable-libgomp --disable-libquadmath \
  --disable-shared --disable-libatomic --disable-decimal-float --disable-libmpx \
  --disable-bootstrap \
  \
  --build=x86_64-unknown-linux-gnu \
  --host=x86_64-unknown-linux-gnu \
  --target=x86_64-unknown-linux-gnu
...
The directory that should contain system headers does not exist:
  /usr/include
make[2]: *** [Makefile:3279: stmp-fixinc] Error 1 shuffle=1658621302
rm gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod gpl.pod cpp.pod gcov.pod lto-dump.pod
make[2]: Leaving directory '/build/build/gcc'

Note: it's a no-libc build. It's not expected to use any libc headers.
But in this case fixincludes tries to run and uses default /usr/include
location.

Fixinsludes is not normally expected to run during cross-compilation
on --without-headers. gcc/configure.ac:

: ${inhibit_libc=false}
if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
       test x$with_newlib = xyes ; } &&
     { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
       inhibit_libc=true
fi

The change explicitly passes inhibit_libc=true to configure to disable
include fixing on such cases.

Fixed nix build --no-link -f. pkgsLLVM.hello toolchain bootstrap.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@trofi trofi requested a review from matthewbauer as a code owner July 24, 2022 07:38
@trofi trofi mentioned this pull request Jul 24, 2022
13 tasks
@trofi trofi marked this pull request as draft July 24, 2022 08:14
@trofi
Copy link
Contributor Author

trofi commented Jul 24, 2022

Will keep in draft until get a few more tests finished.

@trofi trofi force-pushed the fix-non-cross-cross branch from 136e87b to 9d8f8f7 Compare July 24, 2022 08:30
It's a follow-up to the breakage caused by 21966e1
("gcc: pass --with-build-sysroot=/"). It caused `pkgsLLVM`
cross-toolchain bootstrap breakage:

    $ nix build --no-link -f. pkgsLLVM.hello
    ...
    failed: /nix/store/...-x86_64-unknown-linux-gnu-stage-static-gcc-13.0.0.drv:
    ...
    configure flags: ... --enable-languages=c --disable-multilib \
      --disable-shared --enable-plugin ... --disable-libssp --disable-nls \
      --without-headers --disable-threads --disable-libgomp --disable-libquadmath \
      --disable-shared --disable-libatomic --disable-decimal-float --disable-libmpx \
      --disable-bootstrap \
      \
      --build=x86_64-unknown-linux-gnu \
      --host=x86_64-unknown-linux-gnu \
      --target=x86_64-unknown-linux-gnu
    ...
    The directory that should contain system headers does not exist:
      /usr/include
    make[2]: *** [Makefile:3279: stmp-fixinc] Error 1 shuffle=1658621302
    rm gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod gpl.pod cpp.pod gcov.pod lto-dump.pod
    make[2]: Leaving directory '/build/build/gcc'

Note: it's a no-libc build. It's not expected to use any libc headers.
But in this case fixincludes tries to run and uses default /usr/include
location.

Fixinsludes is not normally expected to run during cross-compilation
on --without-headers. gcc/configure.ac:

    : ${inhibit_libc=false}
    if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
           test x$with_newlib = xyes ; } &&
         { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
           inhibit_libc=true
    fi

The change explicitly passes inhibit_libc=true to configure to disable
include fixing on such cases.

Fixed `nix build --no-link -f. pkgsLLVM.hello` toolchain bootstrap.
@trofi trofi force-pushed the fix-non-cross-cross branch from 9d8f8f7 to ea8e124 Compare July 24, 2022 08:55
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels Jul 24, 2022
@trofi
Copy link
Contributor Author

trofi commented Jul 24, 2022

Ready.

Fixed: pkgsLLVM.hello on x86_64-linux.
Tested (still works): hello, pkgsCross.powernv.stdenv.cc, pkgsCross.powernv.gcc, pkgsCross.mingw32.re2c, pkgsCross.or1k.stdenv.cc on x86_64-linux.
Tested (still works): hello, pkgsCross.powernv.stdenv.cc, pkgsCross.powernv.gcc

@trofi trofi marked this pull request as ready for review July 24, 2022 13:45
@trofi
Copy link
Contributor Author

trofi commented Jul 24, 2022

I'll merge it a bit quicker to get pkgsLLVM.* fixed on staging. This is a low risk change.

@trofi trofi merged commit 9e11882 into NixOS:staging Jul 24, 2022
@trofi trofi deleted the fix-non-cross-cross branch July 24, 2022 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant