-
Notifications
You must be signed in to change notification settings - Fork 249
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
fix linux cross compiling on macos #1062
fix linux cross compiling on macos #1062
Conversation
Same as bazel-contrib#997 but for linux instead of android.
|
||
_TARGET_ARCH_PARAMS = { | ||
"aarch64": { | ||
"CMAKE_SYSTEM_PROCESSOR": "aarch64", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a little more nuance to it than this (mostly on mac) but I think this is a good enough start.
nice, looks reasonable to me, I don't have access here tho, @jsharpe I think is the right contact |
# by setting CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR, | ||
# see https://github.com/bazelbuild/rules_foreign_cc/issues/289, | ||
# and https://github.com/bazelbuild/rules_foreign_cc/pull/1062 | ||
if target_os != host_os and target_os != "unknown": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's more to it than this (i.e. linux-x86_64 -> linux-aarch64).
Probably should be a function like is_cross_compilation
and handle this more rigorously.
This is on my radar to review - will try to take a look at some point this week! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fixes cross-compiling from macos to linux.
see #997 for background.
I had to make a couple of extra changes to support this:
CMAKE_SYSTEM_NAME
manually causesCMAKE_SYSTEM_PROCESSOR
to not be set. This breaks some builds that expect this variable to be set like libjpeg-turbo.rules_foreign_cc
only takes on responsibility of setting them when necessary.