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: compile error on mac when using "crypto/x509" package #25944

Closed
siuying opened this issue Jun 18, 2018 · 2 comments
Closed
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@siuying
Copy link

siuying commented Jun 18, 2018

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

go1.10.3 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

darwin/amd64

What did you do?

Compile to iOS target on Mac, if import contains "crypto/x509", will result in compile error:

$ gomobile build -target=ios .
gomobile: go build . failed: exit status 2
# crypto/x509
clang: error: invalid argument '-mmacosx-version-min=10.6' not allowed with '-mios-simulator-version-min=6.1'
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]

To reproduce the error, create a file hello.go:

hello.go

package hello

import (
	"crypto/x509"
	"fmt"
)

func Hello() string {
	roots := x509.NewCertPool()
	ok := roots.AppendCertsFromPEM([]byte(""))
	return fmt.Sprintf("Result: %v", ok)
}

Then run the command: gomobile build -target=ios .

What did you expect to see?

It should compile withour error.

What did you see instead?

Error: "clang: error: invalid argument '-mmacosx-version-min=10.6' not allowed with '-mios-simulator-version-min=6.1'"

@gbbr gbbr changed the title gomobile compile error on mac when using "crypto/x509" package x/mobile/cmd/gomobile: compile error on mac when using "crypto/x509" package Jun 18, 2018
@gopherbot gopherbot added this to the Unreleased milestone Jun 18, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jun 18, 2018
@ianlancetaylor
Copy link
Contributor

CC @eliasnaur

@gopherbot
Copy link

Change https://golang.org/cl/119555 mentions this issue: cmd/gomobile: fix gomobile build of non-main packages for iOS

@golang golang locked and limited conversation to collaborators Jun 18, 2019
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Non-main packages are built in an earlier code path than main
packages. Add the ios build tag before that early code path to
ensure packages that expect that tag successfully compiles.

Fixes golang/go#25944

Change-Id: Ida15475109373127dde024037e9787c76b32ee0b
Reviewed-on: https://go-review.googlesource.com/119555
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Non-main packages are built in an earlier code path than main
packages. Add the ios build tag before that early code path to
ensure packages that expect that tag successfully compiles.

Fixes golang/go#25944

Change-Id: Ida15475109373127dde024037e9787c76b32ee0b
Reviewed-on: https://go-review.googlesource.com/119555
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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
Projects
None yet
Development

No branches or pull requests

3 participants