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

Cross-compile from Linux to macOS? #24740

Open
SimonSapin opened this issue Nov 14, 2019 · 2 comments
Open

Cross-compile from Linux to macOS? #24740

SimonSapin opened this issue Nov 14, 2019 · 2 comments
Labels

Comments

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Nov 14, 2019

RustAudio/coreaudio-sys#28 does it for a smaller Rust project. This would likely involve non-trivial work in the build.rs file of each dependency that compiles non-Rust code.

On CI we may want to keep some build tasks on macOS to check that they keep working, but switching at least the release build used for WPT to be compiled on Linux with many more CPU cores could help significantly reduce Homu’s cycle time.

@SimonSapin
Copy link
Member Author

@SimonSapin SimonSapin commented Nov 23, 2019

likely involve non-trivial work in the build.rs file of each dependency that compiles non-Rust code.

Maybe it’s not too terrible. This was enough to successfully cross-compile the tinyfiledialogs crate with CC=clang:

--- build.rs
+++ build.rs
@@ -12,6 +12,8 @@ fn main() {
     cc::Build::new()
         .file("libtinyfiledialogs/tinyfiledialogs.c")
         .flag("-v")
+        .flag("-isysroot")
+        .flag("/home/simon/tmp/macos-sdk/MacOSX10.13.sdk")
         .compile("libtinyfiledialogs.a");
 
     if target.contains("windows") {

Of course when doing this "for real" we’d make it conditional on $TARGET and probably pass the SDK path through an environment variable. And maybe we could do it in the cc crate, so that tinyfiledialogs and other crates that use cc in a "simple enough" way might not need any change.

But there’s significant of variety in build script in all of Servo’s recursive dependencies, many compile C or C++ code without the cc crate and would need individual changes to pass the SDK path. So completing this would still take spending time adapting multiple build system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.