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

buildRustCrate: Set target_os to "macos" on darwin #33137

Merged
merged 1 commit into from Jul 2, 2018

Conversation

marsam
Copy link
Contributor

@marsam marsam commented Dec 28, 2017

The rust compiler uses "macos" as "target_os" conditional on Mac OS[1]

[1] https://github.com/rust-lang/rust/blob/8e7a609e635b728eba65d471c985ab462dc4cfc7/src/librustc_back/target/x86_64_apple_darwin.rs#L29

Motivation for this change
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.

@marsam marsam force-pushed the feature/fix-build-rust-create-darwin branch from 34ec24d to 6f40d72 Compare December 28, 2017 14:50
@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Jan 4, 2018
@LnL7
Copy link
Member

LnL7 commented Jan 4, 2018

Could you provide a small example to test this?

@marsam marsam force-pushed the feature/fix-build-rust-create-darwin branch 2 times, most recently from bc52b78 to 405acb7 Compare January 5, 2018 00:41
@marsam
Copy link
Contributor Author

marsam commented Feb 23, 2018

Hi, sorry for the late response

Could you provide a small example to test this?

Sure! but I'm not sure what you might consider a test. CARGO_CFG_TARGET_OS is recommended for writing build.rs scripts and in darwin is set to "macos", there are various examples around

@shlevy
Copy link
Member

shlevy commented Jul 2, 2018

Ack, sorry this was missed. Just hit this myself, I'll verify this fixes my issue (building ring) and apply if so.

@@ -98,7 +98,7 @@ let makeDeps = dependencies:
export CARGO_PKG_AUTHORS="${authors}"

export CARGO_CFG_TARGET_ARCH=${buildPlatform.parsed.cpu.name}
export CARGO_CFG_TARGET_OS=${buildPlatform.parsed.kernel.name}
export CARGO_CFG_TARGET_OS=${if buildPlatform.isDarwin then "macos" else buildPlatform.parsed.kernel.name}
Copy link
Member

Choose a reason for hiding this comment

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

@marsam Can you add a comment with a link to https://github.com/rust-lang-nursery/rust-forge/issues/101 which suggests that the target_os values are as-yet undocumented?

Copy link
Member

Choose a reason for hiding this comment

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

Added in 98ddba1

@shlevy
Copy link
Member

shlevy commented Jul 2, 2018

@GrahamcOfBorg eval

@shlevy shlevy merged commit bdf031d into NixOS:master Jul 2, 2018
@marsam marsam deleted the feature/fix-build-rust-create-darwin branch July 2, 2018 15:46
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.

None yet

4 participants