Skip to content

elfutils: build out of tree on libc++#419451

Merged
vcunat merged 1 commit intoNixOS:masterfrom
trofi:elfutils-fix-on-libcxx
Jun 30, 2025
Merged

elfutils: build out of tree on libc++#419451
vcunat merged 1 commit intoNixOS:masterfrom
trofi:elfutils-fix-on-libcxx

Conversation

@trofi
Copy link
Contributor

@trofi trofi commented Jun 24, 2025

elfutils has a stack binary built in src.

When built in source tree this breaks when
#include <stack> is transitively included in
libc++ via <iostream>.

The trigger set of options is -I $(srcdir) which turns to -I . with ./stack present.

The fix turns the above to -I ../src without
./stack present.

The change is conditional on LLVM to avoid
stdenv rebuild. We will turn it into unconditional in staging once this gets merged.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@trofi trofi mentioned this pull request Jun 24, 2025
13 tasks
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jun 24, 2025
@patryk4815
Copy link
Contributor

    ++ lib.optionals stdenv.cc.isClang [
      "CFLAGS=-Wno-unused-private-field"
      "CXXFLAGS=-Wno-unused-private-field"
    ];

without this lines, it is compiling fine for me, should we remove it?

@trofi trofi force-pushed the elfutils-fix-on-libcxx branch from cb3aa57 to 440384f Compare June 24, 2025 07:41
@trofi
Copy link
Contributor Author

trofi commented Jun 24, 2025

    ++ lib.optionals stdenv.cc.isClang [
      "CFLAGS=-Wno-unused-private-field"
      "CXXFLAGS=-Wno-unused-private-field"
    ];

without this lines, it is compiling fine for me, should we remove it?

Good catch! Removed.

`elfutils` has a `stack` binary built in `src`.

When built in source tree this breaks when `#include <stack>` is
transitively included in
`libc++` via `<iostream>`.

The trigger set of options is `-I $(srcdir)` which turns to `-I .` with
`./stack` present.

The fix turns the above to `-I ../src` without `./stack` present.

The change is conditional on `LLVM` to avoid `stdenv` rebuild. We will
turn it into unconditional in `staging` once this gets merged.

While at it dropped `CFLAGS` / `CXXFLAGS` overrides.
@trofi trofi force-pushed the elfutils-fix-on-libcxx branch from 440384f to 340cc31 Compare June 24, 2025 08:04
@trofi
Copy link
Contributor Author

trofi commented Jun 24, 2025

Added https://sourceware.org/PR33103 bug reference to the source comment

@zowoq zowoq requested a review from r-burns June 26, 2025 23:07
@vcunat vcunat merged commit 429b4bd into NixOS:master Jun 30, 2025
26 of 27 checks passed
@vcunat
Copy link
Member

vcunat commented Jun 30, 2025

Diff on GitHub made unreadable by our formatting requirements again 😢

@trofi trofi deleted the elfutils-fix-on-libcxx branch June 30, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants