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

MacOS support for gn and v8_6_x #30419

Closed
wants to merge 4 commits into from
Closed

MacOS support for gn and v8_6_x #30419

wants to merge 4 commits into from

Conversation

stesie
Copy link
Member

@stesie stesie commented Oct 14, 2017

Motivation for this change

With #29726 I introduced a new package v8_6_x which repackaged V8 on GN build system, yet for Linux only. This PR adds support for MacOS/darwin

Also updates gn to current Git master and V8 6.2.414.30

The added patch file pkgs/development/tools/build-managers/gn/apple_apsl.patch actually adds "sources" needed for the MacOS build. I preferred adding a patch since it only needs a very small number of files, which are otherwise part of "third party" Git repository with 2,5GB download size. Downloading that for just a few kB didn't feel right to me.

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
    • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -1,4 +1,4 @@
{ stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig
{ stdenv, lib, cctools, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig
Copy link
Member

Choose a reason for hiding this comment

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

Curious what you need cctools for here, since most of its tools should be in scope already from the stdenv. Not saying you don't but it surprises me!

Copy link
Member Author

@stesie stesie Oct 14, 2017

Choose a reason for hiding this comment

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

It contains libtool which interestingly isn't in scope otherwise.

Maybe I should name the argument here accordingly and do the rename in all-packages.nix!?

Copy link
Member

Choose a reason for hiding this comment

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

I overhear people talk about this Darwin vs GNU libtool a lot (or is it just a really old version?). Maybe there is an attributes already?

Copy link
Member Author

Choose a reason for hiding this comment

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

so after you've mentioned it I've tried again with GNU libtool, this is how the build fails then:

[27/1119] LIBTOOL-STATIC obj/build/config/sanitizers/liboptions_sources.a
FAILED: obj/build/config/sanitizers/liboptions_sources.a 
rm -f obj/build/config/sanitizers/liboptions_sources.a && TOOL_VERSION=1508177652 python ../../build/toolchain/mac/filter_libtool.py libtool -static  -o obj/build/config/sanitizers/liboptions_sources.a obj/build/config/sanitizers/options_sources/sanitizer_options.o
Usage: /nix/store/y9f4wn79hrhdly3yb5766byrd7h398yy-libtool-2.4.6/bin/libtool [OPTION]... [MODE-ARG]...
Try 'libtool --help' for more information.
libtool:   error: unrecognised option: '-static'

IMHO this is because V8's build system assumes it's using darwin's libtool which behaves differently. As it probably doesn't make sense to patch V8's build system to use GNU's libtool (actually I don't now if that's feasible at all) I'd vote to just stick with darwin's version!?

Copy link
Member

Choose a reason for hiding this comment

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

Oh sure, I meant maybe there was like a darwin.libtool or something, not that you should shoehorn in GNU's libtool.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed it to libtoolin the argument list and do the aliasing in all-packages.nix file

@@ -11,6 +11,9 @@ let
else if stdenv.is64bit
then"x64"
else "ia32";

librarySuffix = if stdenv.isDarwin then "dylib" else "so";
Copy link
Member

Choose a reason for hiding this comment

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

@Ericson2314 was kind enough to put this knowledge into the stdenv for us! Try stdenv.hostPlatform.extensions.sharedLibrary. Note that that one gives you the period as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, thanks for pointing this out :) wasn't yet aware

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Oct 15, 2017
@@ -0,0 +1,786 @@
diff -uNr a.orig/third_party/apple_apsl/CFBase.h a/third_party/apple_apsl/CFBase.h
Copy link
Member

@Mic92 Mic92 Oct 17, 2017

Choose a reason for hiding this comment

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

Is it possible to use fetchpatch here? This patch is quite big.

Copy link
Member Author

@stesie stesie Oct 17, 2017

Choose a reason for hiding this comment

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

well, generally yes.

After all the patch is actually sources from Google's third_party repository. The problem with the repository is that it's currently ~2,5GB in size.

So I see three, maybe four options:

  • just clone the repository and ignore the traffic
  • use patch included with nixpkgs (like currently done)
  • host patch somewhere else and use fetchpatch (question is where to host)
  • create new github repo and put that stuff there

Problem with the latter two is that I'd have to put that stuff somewhere and link to there. I don't expect many changes to those, yet I'd have to update the resources ... or someone else host them at yet another place

I'm uncertain what the best option is ...

Copy link
Member

@Mic92 Mic92 Oct 17, 2017

Choose a reason for hiding this comment

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

Do they support a svn checkout of just the subdirectory? I looked to me like svn.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

neat ... I've changed it to fetchurl from that url. Thanks :)

@Ericson2314
Copy link
Member

Is this good now?

@stesie
Copy link
Member Author

stesie commented Dec 9, 2017

unfortunately not, initially I didn't notice the build failed ... and lately haven't got time to get it fixed.

The problem is the sha256 of the apple_apsl dependency, which is now downloaded from dynamic svn tarball as suggested by @Mic92 above. Yet the sha256 differs every now and then as the tarball is created with "current" timestamps, not original ones. Hence it's different even though the content is unchanged.

A solution might be to just fetch the content of those two or three files needed.
But haven't yet found the time to do so (as I'm not normally on a Mac)

@matthewbauer
Copy link
Member

Hi! Sorry I didn't see this and part of this was merged in 04e13de. Definitely still want to merge the remaining parts of this though.

@mmahut
Copy link
Member

mmahut commented Aug 12, 2019

Are there any updates on this pull request, please?

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@veprbl veprbl closed this Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants