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

Add iOS as a platform #2086

Closed
wants to merge 1 commit into from
Closed

Add iOS as a platform #2086

wants to merge 1 commit into from

Conversation

steeve
Copy link
Contributor

@steeve steeve commented Jun 3, 2019

Opening in draft for now.

iOS is a special variant of GOOS=darwin. In order to support the new
CC toolchain constraints that come with bazel 0.26, we need to propagate
the same OS that what bazel expects, or else CGo won't work because it
can't find a toolchain.

This needs Bazel 0.26.1 as 0.26.0 has a bug regarding this [1].

  1. Fix ios, tvos and watchos arm64 constraints bazel#8522

Also, this might require gazelle to handle the ios case, too.

iOS is a special variant of GOOS=darwin. In order to support the new
CC toolchain constraints that come with bazel 0.26, we need to propagate
the same OS that what bazel expects, or else CGo won't work because it
can't find a toolchain.

This needs Bazel 0.26.1 as 0.26.0 has a bug regarding this [1].

1. bazelbuild/bazel#8522

Fixes #2079

Signed-off-by: Steeve Morin <steeve@zen.ly>
@steeve
Copy link
Contributor Author

steeve commented Jun 3, 2019

I'm wondering is it would be better that GOOS=ios be propagated down to right before Go invocation, maintaining the illusion everywhere.

@steeve
Copy link
Contributor Author

steeve commented Jun 3, 2019

For gazelle, which may be required as now this select doesn't work:

    deps = select({
        "@io_bazel_rules_go//go/platform:darwin": [
            "//vendor/golang.org/x/sys/unix:go_default_library",
        ],

It should be:

    deps = select({
        "@io_bazel_rules_go//go/platform:darwin": [
            "//vendor/golang.org/x/sys/unix:go_default_library",
        ],
        "@io_bazel_rules_go//go/platform:ios": [
            "//vendor/golang.org/x/sys/unix:go_default_library",
        ],

Unless we trick it somehow ?

@jayconrod
Copy link
Contributor

I've started to work on a fix for this. Currently, we have a GOOS_GOARCH table of valid platforms, and everything is generated from that. I'm working on expanding this to be a wider table with struct elements. The GOOS and GOARCH may be independent from the constraint_values.

I'd rather not introduce ios as anything other than a prefix for a few platform and toolchain targets. It's not a real GOOS value. I haven't figured out how "@io_bazel_rules_go//go/platform:darwin" is going to work yet in select. Need to experiment more.

@jayconrod
Copy link
Contributor

Let's discuss on #2079 instead of here.

@steeve
Copy link
Contributor Author

steeve commented Jun 7, 2019

Close in favor of #2090

@steeve steeve closed this Jun 7, 2019
@steeve steeve deleted the steeve/ios branch June 7, 2019 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants