Navigation Menu

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

x/mobile/cmd/gomobile: Go1.15beta1 cannot generate Objective-c bindings because hardcoded GOARCH=arm configuration is used to load packages #39575

Closed
libnat opened this issue Jun 13, 2020 · 26 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done. OS-Darwin
Milestone

Comments

@libnat
Copy link

libnat commented Jun 13, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15beta1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="darwin"

What did you do?

Tried three ways, all failed with the same error
gomobile bind -v -target=ios .
gomobile bind -v -target=ios/arm64 .
GOARCH=arm64 gomobile bind -v -target=ios .

What did you expect to see?

Generate objective-c framework

What did you see instead?

gomobile: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -tags=ios -- mypkg]: exit status 2: cmd/go: unsupported GOOS/GOARCH pair darwin/arm

@davecheney
Copy link
Contributor

Go 1.15 has removed support for darwin/arm. Please see the draft release nots

@libnat
Copy link
Author

libnat commented Jun 13, 2020

@davecheney Thanks for your reply. The previous title didn't describe the issue properly. I just tried to generate objective-c bindings.
The error is the same even arch arm64 is specified like:

  1. gomobile bind -v -target=ios/arm64
  2. GOARCH=arm64 gomobile bind -v -target=ios

@libnat libnat changed the title [gomobile] unsupported GOOS/GOARCH pair darwin/arm [gomobile] cannot generate objective-c bindings Jun 13, 2020
@libnat
Copy link
Author

libnat commented Jun 13, 2020

@davecheney Could you help to review this issue again? I didn't mean it should support darwin/arm. It's just an error message. Now I have changed the issue title. Thanks

@davecheney
Copy link
Contributor

Please reopen the issue and edit the description as appropriate

@libnat
Copy link
Author

libnat commented Jun 13, 2020

Please reopen the issue and edit the description as appropriate

It seems I am not allowed to reopen this issue.
Github has a rule: Non-collaborator cannot reopen its own issues if a repo collaborator closed them.
@davecheney Could you help to reopen it? Thanks

@libnat libnat changed the title [gomobile] cannot generate objective-c bindings gomobile: 1.15beta1 cannot generate objective-c bindings Jun 13, 2020
@ianlancetaylor
Copy link
Contributor

I've reopened it but I'm not sure I understand the problem. Are you saying that gomobile requires darwin/arm support in all cases even when not building for darwin/arm? That would be unfortunate.

CC @hyangah

@libnat
Copy link
Author

libnat commented Jun 13, 2020

@ianlancetaylor Your understanding is correct.
There is a line in golang.org/x/mobile/cmd/gobind/bind.go
config.Env = append(os.Environ(), "GOARCH=arm", "GOOS="+targetOS, "CGO_ENABLED=1")
If I replace "GOARCH=arm" with "GOARCH=arm64", then gomobile bind -target=ios/arm64 works, gomobile bind -target=ios/amd64 still get failed
It looks like x/mobile needs some changes if built with Go 1.15.

@odeke-em odeke-em changed the title gomobile: 1.15beta1 cannot generate objective-c bindings x/mobile: Go1.15beta1 cannot generate Objective-c bindings Jun 14, 2020
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jun 14, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jun 14, 2020
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 15, 2020
@hajimehoshi
Copy link
Member

hajimehoshi commented Jul 9, 2020

Confirmed. I'll take a look.

$ go1.15beta1 test ./cmd/gomobile/
--- FAIL: TestBindIOS (0.28s)
    bind_test.go:146: GOMOBILE=/Users/hajimehoshi/go/pkg/gomobile
        WORK=$WORK
        
    bind_test.go:147: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -tags=ios -- golang.org/x/mobile/asset]: exit status 2: cmd/go: unsupported GOOS/GOARCH pair darwin/arm
        
--- FAIL: TestBindWithGoModules (1.74s)
    --- FAIL: TestBindWithGoModules/ios (0.77s)
        --- FAIL: TestBindWithGoModules/ios/Absolute_Path (0.46s)
            bind_test.go:289: gomobile bind failed: exit status 1
                /var/folders/60/khbk2xqn1c5bml1byjn89dwc0000gn/T/gomobile-test843789053/gomobile: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -tags=ios -- golang.org/x/mobile/bind/testdata/cgopkg]: exit status 2: cmd/go: unsupported GOOS/GOARCH pair darwin/arm
                
        --- FAIL: TestBindWithGoModules/ios/Relative_Path (0.22s)
            bind_test.go:289: gomobile bind failed: exit status 1
                /var/folders/60/khbk2xqn1c5bml1byjn89dwc0000gn/T/gomobile-test843789053/gomobile: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -tags=ios -- ./bind/testdata/cgopkg]: exit status 2: cmd/go: unsupported GOOS/GOARCH pair darwin/arm
                
--- FAIL: TestIOSBuild (0.17s)
    build_darwin_test.go:49: GOMOBILE=/Users/hajimehoshi/go/pkg/gomobile
        WORK=$WORK
        
    build_darwin_test.go:50: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true -tags=tag1,ios -- golang.org/x/mobile/example/basic]: exit status 2: cmd/go: unsupported GOOS/GOARCH pair darwin/arm
        
FAIL
FAIL    golang.org/x/mobile/cmd/gomobile        4.135s
FAIL

@gopherbot
Copy link

Change https://golang.org/cl/241717 mentions this issue: cmd/gomobile: use arm64 at packagesConfig

@libnat
Copy link
Author

libnat commented Jul 10, 2020

https://golang.org/cl/241717

Thanks for the reply. This change can fix this issue.
I just found another issue after this change. gomobile bind -target=ios will only generate arm64 binary. It would be better to generate both arm64 and amd64 binaries by default. Arch amd64 is required for iOS simulator.
Before this change, gomobile built with go 1.14 will generate iOS framework which contains armv7, arm64, i386, amd64 binaries together.
As armv7 and i386 are not supported in go 1.15, it's expected to generate iOS framework which contains arm64 and amd64 by default.

@dmitshur
Copy link
Contributor

@libnat If that issue you found is an issue right now, please open a separate issue to track it. If it's introduced by that CL, please leave a review comment on it.

@diegomontoya Only the darwin 32-bit ports are deprecated in Go 1.15. See https://tip.golang.org/doc/go1.15#darwin.

@dmitshur dmitshur changed the title x/mobile: Go1.15beta1 cannot generate Objective-c bindings x/mobile/cmd/gomobile: Go1.15beta1 cannot generate Objective-c bindings because hardcoded GOARCH=arm configuration is used to load packages Jul 15, 2020
@Qubitium
Copy link

Qubitium commented Jul 16, 2020

Use the patch at https://golang.org/cl/241717 with Go 1.15beta1

gomobile bind -target=ios FAILS (same unsupported GOOS ARCH combo dawin/arm)
gomobile bind -target=ios/arm64 WORKS
gomobile bind -target=ios/amd64 FAILS (clang error --mmacosx-version-min=10.11 not allowed with -mios-simulator-version-min=7.0

The patch only addressed the specifics of passing -target=ios/arm64 and not the entire -target=ios build set. Something is wrong in go1.15bet1 causing =ios/amd64 compile inserting the macos build flag which xcode rejects.

@hajimehoshi
Copy link
Member

gomobile bind -target=ios FAILS (same unsupported GOOS ARCH combo dawin/arm)

I'll try to create another CL.

@gopherbot
Copy link

Change https://golang.org/cl/243477 mentions this issue: all: fix the error when specifying -target=ios with Go 1.15

gopherbot pushed a commit to golang/mobile that referenced this issue Jul 20, 2020
Go 1.15 no longer supports darwin/arm. This CL fixes by replacing
'allArchs' variable with a function taking a target OS, and excludes
'arm' when the target OS is iOS.

Updates golang/go#39575

Change-Id: I0623ed4cda2c679d2762fd80a7919f24dd5ce016
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243477
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopherbot pushed a commit to golang/mobile that referenced this issue Jul 20, 2020
Go 1.15 no longer supports darwin/arm. arm64 is still supported by
Android and iOS.

Updates golang/go#39575

Change-Id: I91f09477ae68de148e4d63eef38d7d28f553d16c
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/241717
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@hajimehoshi
Copy link
Member

I think we can close this issue (I don't have a right to do this :-)

@dmitshur
Copy link
Contributor

Fixed via CL 243477 and CL 241717.

@dmitshur dmitshur removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 20, 2020
@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 20, 2020
@Qubitium
Copy link

@hagen1778 @dmitshur

Unfortunately still not fixed. I checked the patch set and the IOS allArchs code is wrong to include 386 target.

return []string{"arm64", "386", "amd64"}

go1.15 also deprecated i386 for darwin. As result, I am getting "darwin/386" wrong GOOS/ARCH error when target=ios.

Build system:

  1. go tip
  2. gomobile/gobind tip

@Qubitium
Copy link

@hagen1778 @dmitshur

I really think the buildbot needs a updated test. This should not have passed buildbot ci imo.

@hajimehoshi
Copy link
Member

That's a little odd since go1.15beta1 test -run=BindIOSAll ./cmd/gomobile/ passed on my local machine. Let me investigate.

@gopherbot
Copy link

Change https://golang.org/cl/243837 mentions this issue: cmd/gomobile: fix the test for Go 1.15

@hajimehoshi
Copy link
Member

That's a little odd since go1.15beta1 test -run=BindIOSAll ./cmd/gomobile/ passed on my local machine.

My bad, the -n flag was on in the test and actual command execution (go build) did not run...

@gopherbot
Copy link

Change https://golang.org/cl/243838 mentions this issue: cmd/gomobile: remove darwin/386 support

gopherbot pushed a commit to golang/mobile that referenced this issue Jul 21, 2020
This is a remaining task for golang/go#39575.

Updates golang/go#39575

Change-Id: I10c021a9349461a7a773d4e93e80601b906741b2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
gopherbot pushed a commit to golang/mobile that referenced this issue Jul 21, 2020
Go 1.15 no longer supports darwin/386 and supports only arm64 and amd64
for darwin.

Updates golang/go#39575

Change-Id: I89e43f195f87baf5ea647da40614c579fbe45f88
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243838
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@hajimehoshi
Copy link
Member

@diegomontoya Does the latest commit work fine for you?

@libnat
Copy link
Author

libnat commented Jul 24, 2020

@hajimehoshi Thank you for the changes. Everything goes well if the target is ios/arm64. It will fail if target is ios or ios/amd64. I guess it's amd64 arch that causes the failure.
Error message:

clang: error: invalid argument '-mmacosx-version-min=10.11' not allowed with '-mios-simulator-version-min=7.0'
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]

Could you have a look at this? Please let me know if I should create a new issue.
Thanks

@hajimehoshi
Copy link
Member

@libnat I see. Could you file another issue? Thanks!

@libnat
Copy link
Author

libnat commented Jul 24, 2020

@hajimehoshi Fine. I created another issue: #40390

roderm pushed a commit to roderm/mobile that referenced this issue Sep 13, 2020
Go 1.15 no longer supports darwin/arm. This CL fixes by replacing
'allArchs' variable with a function taking a target OS, and excludes
'arm' when the target OS is iOS.

Updates golang/go#39575

Change-Id: I0623ed4cda2c679d2762fd80a7919f24dd5ce016
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243477
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
roderm pushed a commit to roderm/mobile that referenced this issue Sep 13, 2020
Go 1.15 no longer supports darwin/arm. arm64 is still supported by
Android and iOS.

Updates golang/go#39575

Change-Id: I91f09477ae68de148e4d63eef38d7d28f553d16c
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/241717
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
roderm pushed a commit to roderm/mobile that referenced this issue Sep 13, 2020
This is a remaining task for golang/go#39575.

Updates golang/go#39575

Change-Id: I10c021a9349461a7a773d4e93e80601b906741b2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
roderm pushed a commit to roderm/mobile that referenced this issue Sep 13, 2020
Go 1.15 no longer supports darwin/386 and supports only arm64 and amd64
for darwin.

Updates golang/go#39575

Change-Id: I89e43f195f87baf5ea647da40614c579fbe45f88
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243838
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Go 1.15 no longer supports darwin/arm. This CL fixes by replacing
'allArchs' variable with a function taking a target OS, and excludes
'arm' when the target OS is iOS.

Updates golang/go#39575

Change-Id: I0623ed4cda2c679d2762fd80a7919f24dd5ce016
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243477
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Go 1.15 no longer supports darwin/arm. arm64 is still supported by
Android and iOS.

Updates golang/go#39575

Change-Id: I91f09477ae68de148e4d63eef38d7d28f553d16c
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/241717
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
This is a remaining task for golang/go#39575.

Updates golang/go#39575

Change-Id: I10c021a9349461a7a773d4e93e80601b906741b2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Go 1.15 no longer supports darwin/386 and supports only arm64 and amd64
for darwin.

Updates golang/go#39575

Change-Id: I89e43f195f87baf5ea647da40614c579fbe45f88
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243838
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Go 1.15 no longer supports darwin/arm. This CL fixes by replacing
'allArchs' variable with a function taking a target OS, and excludes
'arm' when the target OS is iOS.

Updates golang/go#39575

Change-Id: I0623ed4cda2c679d2762fd80a7919f24dd5ce016
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243477
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Go 1.15 no longer supports darwin/arm. arm64 is still supported by
Android and iOS.

Updates golang/go#39575

Change-Id: I91f09477ae68de148e4d63eef38d7d28f553d16c
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/241717
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
This is a remaining task for golang/go#39575.

Updates golang/go#39575

Change-Id: I10c021a9349461a7a773d4e93e80601b906741b2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Go 1.15 no longer supports darwin/386 and supports only arm64 and amd64
for darwin.

Updates golang/go#39575

Change-Id: I89e43f195f87baf5ea647da40614c579fbe45f88
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/243838
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Dec 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done. OS-Darwin
Projects
None yet
Development

No branches or pull requests

9 participants