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

oprofile: fix build with gcc14 #392898

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

ghpzin
Copy link
Contributor

@ghpzin ghpzin commented Mar 24, 2025

oprofile: fix build with gcc14


oprofile: cleanup

  • replace --replace with --replace-fail
  • replace rec with finalAttrs

Fixes build failure of oprofile, fails since 2025-01-14 (update to GCC14 #356812):
https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.oprofile.x86_64-linux
https://hydra.nixos.org/build/293043082

Error log:

checking kernel supports perf_events... no
ERROR: You requested to build oprofile with '--with-kernel=/nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7',
but your kernel does not appear to have the necessary support to run oprofile.
configure: error: Unable to build oprofile. Exiting.

More logs from inside ./configure with set -x:

+ eval test '"x$ac_cv_header__nix_store_js4nk0ps39v0km1c11sprg4wmb57l883_linux_headers_6_12_7_include_linux_perf_event_h"' = xyes
++ test xyes = xyes
+ :
+ PERF_EVENT_H_EXISTS=yes
+ printf '%s\n' 'configure:17211: checking kernel supports perf_events'
+ printf %s 'checking kernel supports perf_events... '
checking kernel supports perf_events... + test yes = yes
+ rm -f test-for-PERF_EVENT_OPEN
+ cat confdefs.h -
+ gcc conftest.c -g -O2 -I/nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7/include -o test-for-PERF_EVENT_OPEN
+ test -f test-for-PERF_EVENT_OPEN
+ printf '%s\n' 'configure:17244: result: no'
+ printf '%s\n' no
no
+ kernel_has_perf_events_support=no
+ rm -f test-for-PERF_EVENT_OPEN
+ test no '!=' yes
+ test /nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7 '!=' ''
+ echo 'ERROR: You requested to build oprofile with '\''--with-kernel=/nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7'\'','
ERROR: You requested to build oprofile with '--with-kernel=/nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7',
+ test -d /nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7
+ test yes '!=' yes
+ echo 'but your kernel does not appear to have the necessary support to run oprofile.'
but your kernel does not appear to have the necessary support to run oprofile.

Line that fails (does not produce output that is checked after):

gcc conftest.c -g -O2 -I/nix/store/js4nk0ps39v0km1c11sprg4wmb57l883-linux-headers-6.12.7/include -o test-for-PERF_EVENT_OPEN

From manual build of C code inside ./configure (same error as in upstream commit message):

conftest.c: In function ‘main’:
conftest.c:14:39: error: implicit declaration of function ‘getpid’ [-Wimplicit-function-declaration]
   14 |                                 pid = getpid();
      |                                       ^~~~~~
conftest.c:15:33: error: implicit declaration of function ‘syscall’ [-Wimplicit-function-declaration]
   15 |                                 syscall(__NR_perf_event_open, &attr, pid, 0, -1, 0);
      |                                 ^~~~~~~

Upstream commit patch is based on:
https://sourceforge.net/p/oprofile/oprofile/ci/b0acf9f0c0aac93bf6f3e196d7a52c9632ff4475
Tracking issue: #388196

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1 10.rebuild-linux: 1-10 labels Mar 24, 2025
@ghpzin
Copy link
Contributor Author

ghpzin commented Mar 24, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 392898


x86_64-linux

✅ 1 package built:
  • oprofile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these solutions way better than just silencing the warnings!

Copy link
Contributor

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please separate commits for each logical change. fixing build by patching in one commit, cleanup in another.

ghpzin added 2 commits March 25, 2025 07:37
- add patch similar to upstream commit
https://sourceforge.net/p/oprofile/oprofile/ci/b0acf9f0c0aac93bf6f3e196d7a52c9632ff4475
patch from commit does not work as is because tarball used for build
has `configure` inside and changes to `configure.ac` do not affect it
- replace `--replace` with `--replace-fail`
- replace `rec` with `finalAttrs`
@ghpzin ghpzin force-pushed the oprofile/fix-build-with-gcc14 branch from 84788a0 to 04f5647 Compare March 25, 2025 04:41
@ghpzin
Copy link
Contributor Author

ghpzin commented Mar 25, 2025

Split into 2 commits:

  • oprofile: fix build with gcc14
  • oprofile: cleanup

@JohnRTitor
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 392898

Logs: https://github.com/JohnRTitor/nixpkgs-review-gha/actions/runs/14052591145


x86_64-linux

✅ 1 package built:
  • oprofile

aarch64-linux

✅ 1 package built:
  • oprofile

@JohnRTitor JohnRTitor merged commit 4828085 into NixOS:master Mar 25, 2025
33 of 37 checks passed
@ghpzin ghpzin deleted the oprofile/fix-build-with-gcc14 branch March 25, 2025 06:18
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: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants