Skip to content

python-modules/protobuf: fix darwin build by passing C++ includes exp… #26709

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 21, 2017

Conversation

robx
Copy link
Contributor

@robx robx commented Jun 19, 2017

…licitly

Fixes #26531.

Copies the matplotlib solution, as mentioned by @knedlsepp.

Motivation for this change

To fix the python-protobuf build on darwin. Obsoletes #26606.

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.

…licitly

Fixes NixOS#26531.

Copies the matplotlib solution, as mentioned by @knedlsepp.
@mention-bot
Copy link

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

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Jun 21, 2017
@LnL7 LnL7 merged commit 031d26e into NixOS:master Jun 21, 2017
@@ -8,6 +8,9 @@ buildPythonPackage rec {
inherit (protobuf) name src;
inherit disabled doCheck;

# work around python distutils compiling C++ with $CC
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
Copy link
Member

Choose a reason for hiding this comment

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

I have hit this in a few places now (and this does indeed fix it). But, this is so weird that it only happens on Darwin. Could it be an LLVM thing? Maybe we could do this globally in LLVM's flags so that we don't have to hack around it so much.

/cc @LnL7 @Ericson2314

Copy link
Member

Choose a reason for hiding this comment

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

This only works because stdc++ and gcc are in the same package, so it knows where to look as a fallback if the stdenv doesn't add it explicitly because $CC is used. On darwin (and any other clangStdenv) libcxx and clang are separate packages, so even if clang has the same fallback it won't find anything on it's own.

But I'm not sure how this relates to #19585, I'd expect that one would be enough. (#42074 (comment))

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.

building python3Packages.protobuf3_2 on OS X fails due to string include
4 participants