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 commented Aug 3, 2020

I guess patch itself should be dropped too.

@sikmir
Copy link
Member

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 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
Copy link
Contributor Author

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
@marsam marsam mentioned this pull request Aug 4, 2020
@wjlroe wjlroe deleted the fix-zig-0.6.0 branch August 4, 2020 09:18
@happysalada happysalada mentioned this pull request Apr 4, 2021
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.

4 participants