Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-support/cc-wrapper: revert "pass in non-existent --sysroot= to … #213185

Merged
merged 6 commits into from
Jan 29, 2023

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Jan 28, 2023

…untangle from libc"

This reverts commit 8c80bd0 ("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle from libc").

This change was good in spirit: we caught a few genuine problems with scons based packages (godot, fluxus) and unexpected -idirafter includes in various boot loadres (ipxe, wimboot`):

https://github.com/NixOS/nixpkgs/pull/210004#issuecomment-1407162693

Unfortunately --sysroot= also has a negative impact on libary search order for DT_NEEDED libraries and RUNPATHs of linked libraries. This unexpectedly broke dmd, d-seams, llvmPackages_rocm.compiler-rt).

An interesting case of unexpected breakage is usbmuxd2 where the bug exposed incomplete library move on libstdc++fs in gcc.

The library breakage is very non-intuitive (on top of already unusual layout of cc-wrapper driver). Let's revert this change for now.

Once it lands we can undo --sysroot=/ workarounds merged for staging-next.

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/)
  • 23.05 Release Notes (or backporting 22.11 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.

…untangle from libc"

This reverts commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc").

This change was good in spirit: we caught a few genuine problems with
`scons` based packages (`godot`, `fluxus`) and unexpected `-idirafter`
includes in various boot loadres (`ipxe`, wimboot`):

    NixOS#210004 (comment)

Unfortunately `--sysroot=` also has a negative impact on libary search
order for DT_NEEDED libraries and RUNPATHs of linked libraries. This
unexpectedly broke `dmd`, `d-seams`, `llvmPackages_rocm.compiler-rt`).

An interesting case of unexpected breakage is `usbmuxd2` where the bug
exposed incomplete library move on `libstdc++fs` in `gcc`.

The library breakage is very non-intuitive (on top of already unusual
layout of `cc-wrapper` driver). Let's revert this change for now.

Once it lands we can undo `--sysroot=/` workarounds merged for
`staging-next`.
This reverts commit 1ad0b9a.

commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc") was reverted. We can drop the workaround.
This reverts commit 7c73d1e.

commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc") was reverted. We can drop the workaround.
This reverts commit 8b3a31f.

commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc") was reverted. We can drop the workaround.
This reverts commit a9e6a5c.

commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc") was reverted. We can drop the workaround.
This reverts commit f4a78e4.

commit 8c80bd0
("build-support/cc-wrapper: pass in non-existent --sysroot= to untangle
from libc") was reverted. We can drop the workaround.
@trofi
Copy link
Contributor Author

trofi commented Jan 29, 2023

Validated that wimboot dmd ubootTools ipxe mesa still build after the reverts.

@trofi trofi merged commit f54fac6 into NixOS:staging Jan 29, 2023
@trofi trofi deleted the revert-sysroot-hack branch January 29, 2023 12:02
@trofi trofi mentioned this pull request Jan 29, 2023
4 tasks
@ghost
Copy link

ghost commented Jan 31, 2023

Did anybody review this PR before it was merged?

@trofi
Copy link
Contributor Author

trofi commented Jan 31, 2023

staging-next started accumulating a bunch of failures caused by the blanket --sysroot= as you might have noticed in series of the reverts. To prevent further data I merged it faster into staging. Original change certainly did more than originally intended.

@ghost
Copy link

ghost commented Feb 1, 2023

Do you also need to revert

?

If not, the comment it added needs to be updated. It is no longer correct.

@ghost
Copy link

ghost commented Feb 1, 2023

# cc-wrappers uses --sysroot=/nix/store/does/not/exist as a way to
# drop default sysheaders search path. Unfortunately that switches

@trofi
Copy link
Contributor Author

trofi commented Feb 1, 2023

I would say the change does not hurt if we are to allow any other value or --sysroot= and still expect gcc libraries to be found. I'm also fine with reverting it. But the comment could be better in any case, yes.

@trofi
Copy link
Contributor Author

trofi commented Feb 1, 2023

Proposed full revert as #213929

@trofi trofi linked an issue Feb 4, 2023 that may be closed by this pull request
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/libssl-so-3-not-found-when-compiling-rust/25213/2

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/so-dependencies-of-gd-library-have-undefined-reference-errors/25800/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment