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

zig: fix build #94559

Merged
merged 1 commit into from Aug 4, 2020
Merged

zig: fix build #94559

merged 1 commit into from Aug 4, 2020

Conversation

@wjlroe
Copy link
Contributor

@wjlroe wjlroe commented Aug 2, 2020

Motivation for this change

It looks like #88248 broke the
build for zig.

The error you get when building zig on the current master branch is:

Scanning dependencies of target zig_build_libstage2
: CommandLine Error: Option 'polly' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
make[2]: *** [CMakeFiles/zig_build_libstage2.dir/build.make:77: CMakeFiles/zig_build_libstage2] Error 1
make[1]: *** [CMakeFiles/Makefile2:252: CMakeFiles/zig_build_libstage2.dir/all] Error 2
make: *** [Makefile:150: all] Error 2

The patch that added polly into some build args was likely necessary
only for LLVM 10.0.0 and when that was updated to 10.0.1 it stopped
working or became unnecessary. With this patch removed, zig builds fine
and passes the tests.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@KAction
Copy link
Contributor

@KAction KAction commented Aug 3, 2020

I guess patch itself should be dropped too.

@sikmir
Copy link
Member

@sikmir sikmir commented Aug 3, 2020

Failed on darwin:

  [ 96%] Building CXX object CMakeFiles/zigcompiler.dir/src/os.cpp.o
  /private/var/folders/wf/qxrs82v946n91pb5s71n3dy80000gp/T/nix-build-zig-0.6.0.drv-0/source/src/os.cpp:1105:9: error: use of undeclared identifier 'futimens'
      if (futimens(file, times) == -1) {
          ^
  1 error generated.
  make[2]: *** [CMakeFiles/zigcompiler.dir/build.make:304: CMakeFiles/zigcompiler.dir/src/os.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:225: CMakeFiles/zigcompiler.dir/all] Error 2
  make: *** [Makefile:150: all] Error 2
cannot build derivation '/nix/store/7yngkkv0hszyjkqg4c7ahzbqga6wl9m7-env.drv': 1 dependencies couldn't be built
@wjlroe
Copy link
Contributor Author

@wjlroe wjlroe commented Aug 3, 2020

Failed on darwin:

  [ 96%] Building CXX object CMakeFiles/zigcompiler.dir/src/os.cpp.o
  /private/var/folders/wf/qxrs82v946n91pb5s71n3dy80000gp/T/nix-build-zig-0.6.0.drv-0/source/src/os.cpp:1105:9: error: use of undeclared identifier 'futimens'
      if (futimens(file, times) == -1) {
          ^
  1 error generated.
  make[2]: *** [CMakeFiles/zigcompiler.dir/build.make:304: CMakeFiles/zigcompiler.dir/src/os.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:225: CMakeFiles/zigcompiler.dir/all] Error 2
  make: *** [Makefile:150: all] Error 2
cannot build derivation '/nix/store/7yngkkv0hszyjkqg4c7ahzbqga6wl9m7-env.drv': 1 dependencies couldn't be built

Building zig on darwin looks like it'll remain broken until libSystem is updated and packages are built for a newer base system than macOS 10.12 (zig requires at least 10.13). So even on new macOSes, nixpkgs is building everything against an old libSystem I think. Details here: #86299

This PR won't affect darwin's build of Zig, it was broken before this and also broken before the update to LLVM 10.0.1

It looks like #88248 broke the
build for zig.

The error you get when building zig on the current master branch is:

```
Scanning dependencies of target zig_build_libstage2
: CommandLine Error: Option 'polly' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
make[2]: *** [CMakeFiles/zig_build_libstage2.dir/build.make:77: CMakeFiles/zig_build_libstage2] Error 1
make[1]: *** [CMakeFiles/Makefile2:252: CMakeFiles/zig_build_libstage2.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
```

The patch that added polly into some build args was likely necessary
only for LLVM 10.0.0 and when that was updated to 10.0.1 it stopped
working or became unnecessary. With this patch removed, zig builds fine
and passes the tests.
@wjlroe wjlroe force-pushed the wjlroe:fix-zig-0.6.0 branch from 2aff903 to d51340f Aug 3, 2020
@wjlroe
Copy link
Contributor Author

@wjlroe wjlroe commented Aug 3, 2020

I guess patch itself should be dropped too.

Good point, I've deleted it, thanks

@marsam marsam merged commit c2a3988 into NixOS:master Aug 4, 2020
18 checks passed
18 checks passed
tests tests
Details
tests
Details
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="d51340f"; rev="d51340f27f2e411a18e9fe775bc9e3150244c4e3"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
zig, zig.passthru.tests on aarch64-linux Success
Details
zig, zig.passthru.tests on x86_64-linux Success
Details
@marsam marsam mentioned this pull request Aug 4, 2020
@wjlroe wjlroe deleted the wjlroe:fix-zig-0.6.0 branch Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.