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

swift: fix cflags for finding C++ headers #94160

Merged
merged 1 commit into from Aug 3, 2020
Merged

swift: fix cflags for finding C++ headers #94160

merged 1 commit into from Aug 3, 2020

Conversation

mroi
Copy link
Contributor

@mroi mroi commented Jul 29, 2020

As reported in #93919, the swift package currently fails to build. This was fallout from f3f7612, which this PR intends to fix.

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.

@vcunat
Copy link
Member

vcunat commented Jul 29, 2020

When you want to build with clang, generally it seems good to use overrideCC stdenv clang instead of the gcc stdenv. At least for my use cases it removed the need for hacks like these

# This compiler is not using the Nix wrappers, so it needs some help to find things.

@mroi
Copy link
Contributor Author

mroi commented Jul 29, 2020

I see, but I think the situation is different here. Swift is largely built by gcc I believe. But while building Swift, its build system also compiles modified versions of LLVM and clang, which it later also runs during the build. For this local clang, these hacks are needed.

@vcunat
Copy link
Member

vcunat commented Jul 29, 2020

I don't know, but I had checked that it is using clang from nixpkgs in some way, too. EDIT: in particular

    # However, we want to use the wrapped compiler whenever possible.
    export CC="${clang}/bin/clang"

@mroi
Copy link
Contributor Author

mroi commented Jul 29, 2020

Yes. I must admit I do not really understand where and how that passed-in clang is used. I have been trying to update to Swift 5.2.4. I have to change things there anyways, so I can try your suggestion as well.

@Ericson2314
Copy link
Member

@vcunat yeah by all accounts the thing is a mess, I just was trying to find the quickest way to keep the mess working, and have things be cleaned up later.

@Ericson2314
Copy link
Member

Should we just merge this, then?

@vcunat vcunat linked an issue Aug 3, 2020 that may be closed by this pull request
Copy link
Member

@vcunat vcunat left a comment

Choose a reason for hiding this comment

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

Yes, why not. Until someone finds a nicer way. I confirm the build gets fixed by this.

@vcunat vcunat merged commit 460b2b8 into NixOS:master Aug 3, 2020
@mroi mroi deleted the patch-swift-cflags branch August 3, 2020 07:09
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.

building swift fails
3 participants