Skip to content

v8_3_16_14: fix OS X build by passing deployment version #26772

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

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

robx
Copy link
Contributor

@robx robx commented Jun 22, 2017

Before this, nix-build -A v8_3_16_14 failed with a linking error
... was built for newer OSX version (10.10) than being linked (10.5)
since build/standalone.gypi sets
'mac_deployment_target%': '10.5'

This fixes the build to set the GYP mac deployment target to the nix
default as set in pkgs/stdenv/darwin/default.nix.

Motivation for this change

v8_3_16_4 was failing to build for me:

$ git show
commit 3d52203ab2a2aa31df8ae52efda3b14e75628a57
Author: Joachim Schiele <js@lastlog.de>
Date:   Thu Jun 22 11:50:09 2017 +0200
...
$ uname -a
Darwin aaaa.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
$ nix-build -p v8_3_16_14
...
ld: warning: object file (/nix/store/b70ipgiymp029ggj40hmywg6wswcgrx8-clang-4.0.0/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a(gcc_personality_v0.c.o)) was built for newer OSX version (10.10) than being linked (10.5)
Undefined symbols for architecture x86_64:
  "__Unwind_GetIP", referenced from:
      ___gcc_personality_v0 in libclang_rt.osx.a(gcc_personality_v0.c.o)
  "__Unwind_GetLanguageSpecificData", referenced from:
      ___gcc_personality_v0 in libclang_rt.osx.a(gcc_personality_v0.c.o)
  "__Unwind_GetRegionStart", referenced from:
      ___gcc_personality_v0 in libclang_rt.osx.a(gcc_personality_v0.c.o)
  "__Unwind_SetGR", referenced from:
      ___gcc_personality_v0 in libclang_rt.osx.a(gcc_personality_v0.c.o)
  "__Unwind_SetIP", referenced from:
      ___gcc_personality_v0 in libclang_rt.osx.a(gcc_personality_v0.c.o)
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [tools/gyp/v8.target.mk:162: /private/var/folders/rs/k3cmq1b12238c_kx1xg1pndw0000gn/T/nix-build-v8-3.16.14.11.drv-0/v8-3.16.14.11/out/Release/libv8.dylib] Error 1
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@mention-bot
Copy link

@robx, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pikajude, @cstrahan and @wkennington to be potential reviewers.

@robx
Copy link
Contributor Author

robx commented Jun 22, 2017

(This was initially reported as a comment on the related but different issue #10168.)

@@ -29,6 +29,7 @@ stdenv.mkDerivation rec {
export PATH=$TMPDIR:$PATH
'' + ''
PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
GYP_DEFINES="mac_deployment_target=$MACOSX_DEPLOYMENT_TARGET" \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, clearly this should be darwin only, let me see...

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Jun 22, 2017
@LnL7
Copy link
Member

LnL7 commented Jun 22, 2017

Still fails to build without Xcode, probably just needs the no-xcode.patch

@robx
Copy link
Contributor Author

robx commented Jun 22, 2017

@LnL7 nope, seems that patch doesn't apply... (There's build/gyp/pylib/gyp/xcode_emulation.py instead, but the patch seems not even close to applicable.)

What is that no-xcode problem?

@LnL7
Copy link
Member

LnL7 commented Jun 22, 2017

The issue is that gyp fails if Xcode is not installed, even tho it has a perfectly working version of clang from nix available. So it doesn't work on hydra v8_3_16_14.x86_64-darwin or when sandboxing is enabled.

unpacking sources
unpacking source archive /nix/store/r37hrwd18wq06phzqv2gknlmkdd6rgdz-v8-3.16.14.11.tar.bz2
source root is v8-3.16.14.11
setting SOURCE_DATE_EPOCH to timestamp 1364868733 of file v8-3.16.14.11/build/gyp/tools/pretty_vcproj.py
patching sources
configuring
xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.

@robx
Copy link
Contributor Author

robx commented Jun 23, 2017

This is as far as I get. Next would seem to be using nix-provided libtool, compare https://github.com/robx/nixpkgs/tree/v8-sandbox. But it's not clear at all to me how to get that to work.

@robx
Copy link
Contributor Author

robx commented Jun 26, 2017

@LnL7 Could we consider merging the initial commit as a way to fix the xcode build at least? Changing the build to handle GNU libtool and whatnot may be a worthy goal, but it's certainly out of my reach right now, and the initial commit seems to be a clear improvement of the current state.

@robx
Copy link
Contributor Author

robx commented Jun 26, 2017

Nevermind, might have found a way around (if darwin.cctools is available in a sandbox)

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

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

looks good now! can you squash this?

Issues addressed:
- xcode build failed with
    ... was built for newer OSX version (10.10) than being linked (10.5)
  fixed by setting GYP mac deployment target to the nix value
- a gyp bug when SDKROOT is not set (and removed an orphaned gyp patch
- path to python in generated gyp-mac-tool
- noisy build due to static assert warnings, by silencing warnings
- use of system xcodebuild and libtool replaced by darwin.cctools
@robx
Copy link
Contributor Author

robx commented Jun 27, 2017

@LnL7 done

@LnL7 LnL7 merged commit 5740c9e into NixOS:master Jun 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants