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

cmake: add check-pc-files hook to check broken pc files #172347

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

Artturin
Copy link
Member

see #172150

test by building seexpr

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.05 Release Notes (or backporting 21.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.

@Artturin Artturin changed the base branch from master to staging May 10, 2022 14:54
@Artturin
Copy link
Member Author

@alexshpilkin please create a issue here with instructions on how to fix and then i'll link to it instead of the pr

@SuperSandro2000
Copy link
Member

@ofborg eval

@Artturin Artturin force-pushed the checkpcfilehook branch 2 times, most recently from 9750a12 to b36f742 Compare September 8, 2022 15:16
@ofborg ofborg bot requested a review from ftrvxmtrx September 8, 2022 16:55
setupHook = ./setup-hook.sh;
setupHooks = [
./setup-hook.sh
./check-pc-files.sh
Copy link
Member

Choose a reason for hiding this comment

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

Can we put everything in the main setup hook? It's much easier to browse all the stdenv magic in one predictable place.

Copy link
Member Author

Choose a reason for hiding this comment

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

we can but i want to keep them separate

I've renamed the hook to check-pc-files-hook.sh

Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member

Choose a reason for hiding this comment

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

because it is a hook and hooks mostly end in -hook.sh

Copy link
Member

Choose a reason for hiding this comment

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

That's not the question. Why @Artturin wants a separate file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its a separate hook and there's no reason to keep them in the same file

all hooks can be found with fd --type f "hook.sh"

@ofborg ofborg bot requested review from cpcloud and veprbl September 8, 2022 18:59
@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Sep 8, 2022
@Artturin Artturin merged commit 1aed78e into NixOS:staging Sep 9, 2022
@Artturin Artturin deleted the checkpcfilehook branch September 9, 2022 21:31
@trofi
Copy link
Contributor

trofi commented Sep 10, 2022

Bisect claims b1149dc cmake: add check-pc-files hook to check broken pc files broke glslang build on staging:

$ nix build -f. -L glslang
...
glslang> checking for references to /build/ in /nix/store/a7g64d1ghjr5qxvrvmp11dna9cf29nvs-glslang-1.3.224.1...
glslang> Broken paths found in a .pc file! /nix/store/a7g64d1ghjr5qxvrvmp11dna9cf29nvs-glslang-1.3.224.1/lib/pkgconfig/SPIRV-Tools.pc
glslang> The following lines have issues (specifically '//' in paths).
glslang> 3:libdir=${prefix}//nix/store/a7g64d1ghjr5qxvrvmp11dna9cf29nvs-glslang-1.3.224.1/lib
glslang> 4:includedir=${prefix}//nix/store/a7g64d1ghjr5qxvrvmp11dna9cf29nvs-glslang-1.3.224.1/include
glslang> It is very likely that paths are being joined improperly.
glslang> ex: "${prefix}/@CMAKE_INSTALL_LIBDIR@" should be "@CMAKE_INSTALL_FULL_LIBDIR@"
glslang> Please see https://github.com/NixOS/nixpkgs/issues/144170 for more details.

@alexshpilkin
Copy link
Member

@Artturin @trofi

Right, I’m sorry for falling of the face of the Earth and thank you for picking up the work, but that is why the .pc file of a vendored library is relevant: glslang bundles (an older version of) spirv-headers and installs its .pc file, which consequently trips this check. Per my notes, the same applies to shaderc. Both need the same patch as in spirv-headers applied somewhere inside their source tree.

My notes also show gromacs and valhalla as unfixed, but I honestly don’t remember what was difficult to fix about them. That should be it (as of May, don’t know about now).

@jtojnar
Copy link
Member

jtojnar commented Sep 10, 2022

Then that is a bug in the build script – vendored dependencies should not install .pc files.

@vcunat
Copy link
Member

vcunat commented Sep 17, 2022

So I at least unblocked glslang by fixing those files in a1bad74. The libraries are installed, so at a quick glance I can't see if they're used by another package. Certainly feel free to improve this; overall the contents of output didn't seem very... "clean".

@vcunat
Copy link
Member

vcunat commented Sep 28, 2022

This was quite impactful. I fixed this in more than a dozen packages myself and others fixed some, too.

@edrex edrex mentioned this pull request Mar 4, 2023
7 tasks
@Artturin
Copy link
Member Author

Also check .cmake files #247474

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

Successfully merging this pull request may close these issues.

9 participants