Skip to content

squeak: fix build with LLVM 16#268227

Merged
Artturin merged 1 commit intoNixOS:masterfrom
philiptaron:fix-squeak-build
Nov 19, 2023
Merged

squeak: fix build with LLVM 16#268227
Artturin merged 1 commit intoNixOS:masterfrom
philiptaron:fix-squeak-build

Conversation

@philiptaron
Copy link
Contributor

Description of changes

Part of ZHF (#265948) for 23.11: https://hydra.nixos.org/build/241300457

I bisected this failure to this first bad commit: [9ed7bfe] llvmPackages: 11 -> 16 on Linux, then looked around for other repairs made to assuage LLVM's errors. This appears to be the pattern.

To fit the lib.optionals stdenv.cc.isClang check, I passed clangStdenv in all-packages.nix instead of the previous pattern of putting clang in nativeBuildInputs.

I also took this moment to make the long list of dependencies be formatted one-per-line, as per nixpkgs-fmt style. And as I added another use of toString, I added it to the list of things brought in from builtins.

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

Part of ZHF for 23.11: https://hydra.nixos.org/build/241300457

I bisected this failure to this first bad commit: [9ed7bfe] llvmPackages: 11 -> 16 on Linux,
then looked around for other repairs made to assuage LLVM's errors. This appears to be the pattern.
@philiptaron philiptaron requested review from a user and bb010g November 18, 2023 04:43
@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 18, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Nov 18, 2023

squeak = callPackage ../development/compilers/squeak { };
squeak = callPackage ../development/compilers/squeak {
stdenv = clangStdenv;
Copy link

Choose a reason for hiding this comment

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

Does this need to be clangStdenv other than for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When omitted, nix-build -A squeak errors as follows:

Configuring Squeak 5.0-202003021730 (5.3-19459-64bit) for x86_64-pc-linux-gnu

checking whether make sets $(MAKE)... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/build/source/build.linux64x64/squeak.cog.spur/build':
configure: error: C compiler cannot create executables
See `config.log' for more details

I don't know why, in the default stdenv, it detects clang, as it's no longer passed into the environment. If I pass in gccStdenv, clang is still detected.

So, yes, I think this does have to be clangStdenv.

"-Wno-error=implicit-function-declaration"
"-Wno-error=incompatible-function-pointer-types"
])
);
Copy link

Choose a reason for hiding this comment

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

I would prefer this to be a list at NIX_CFLAGS_COMPILE rather than a string at env.NIX_CFLAGS_COMPILE, unless we have a policy of using env.«…» that I don't know about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

env.NIX_CFLAGS_COMPILE is definitely the majority. I also prefer NIX_CFLAGS_COMPILE, and I'll change it to that form as it works just fine.

$ rg env.NIX_CFLAGS_COMPILE | wc -l
816

$ rg NIX_CFLAGS_COMPILE | rg -v env | wc -l
236

Copy link
Member

Choose a reason for hiding this comment

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

No, please don't. Moving environmental variables to env is a step towards __structuredAttrs support, see #263773.

Copy link
Member

@wegank wegank Nov 18, 2023

Choose a reason for hiding this comment

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

> $ rg NIX_CFLAGS_COMPILE | rg -v env | wc -l
> 236

We've just done #217206 this year, it's unbelievable there are still that many instances of NIX_CFLAGS_COMPILE. Does the command count patterns like the following?

  env = {
    NIX_CFLAGS_COMPILE = "...";
  };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would count those, yes. There's likely quite a few false positives.

Copy link

Choose a reason for hiding this comment

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

Believe it because it's an undocumented practice - https://nixos.org/manual/nixpkgs/unstable/.

@philiptaron philiptaron requested a review from a user November 18, 2023 17:48
@philiptaron
Copy link
Contributor Author

Based on @wegank's clarifications, I've reverted the changes I made based on @ehmry's feedback. I believe this is ready for merging.

@philiptaron philiptaron added the 0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign label Nov 18, 2023
@Artturin Artturin merged commit 38b1656 into NixOS:master Nov 19, 2023
@philiptaron philiptaron deleted the fix-squeak-build branch November 20, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants