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: CGO_CXXFLAGS, CGO_LDFLAGS overwritten for ios #56137

Open
happyalu opened this issue Oct 10, 2022 · 3 comments
Open

x/mobile: CGO_CXXFLAGS, CGO_LDFLAGS overwritten for ios #56137

happyalu opened this issue Oct 10, 2022 · 3 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@happyalu
Copy link

happyalu commented Oct 10, 2022

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

$ go version
go version go1.18.2 darwin/amd64

Does this issue reproduce with the latest release?

This bug is in cmd/gomobile, and is reproducible with the latest commit on that.

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

go env Output
$ go env
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOVERSION="go1.18.2"
GCCGO="gccgo"
GOAMD64="v1"

What did you do?

I was trying to build an ios framework with gomobile that also includes C dependencies. I need to set CGO_CXXFLAGS and CGO_LDFLAGS to get the build working.

CGO_ENABLED=1 CGO_LDFLAGS="<flags>" CGO_CXXFLAGS="<flags>" gomobile bind -target ios/arm64,iossimulator/amd64 -iosversion 9.3.0 ./cmd/app

What did you expect to see?

gomobile should forward the values of CGO_CXXFLAGS and CGO_LDFLAGS to rest of the build process (gobind, go build, etc.) This does happen when building for Android, but not when targeting ios.

What did you see instead?

The CGO_CXXFLAGS, CGO_LDFLAGS, etc. variables get overwritten by values that are required to introduce system dependencies for ios.

This was causing my build to break.

Ideally, these new values introduced by gomobile should be appended to values already in the environment. I tried out this change that resolves this issue.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Oct 10, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 10, 2022
@joedian
Copy link

joedian commented Oct 14, 2022

Hi happyalu,

Can you please add more details to the bug and use the bug format. If this is not a bug, please see below.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

@happyalu
Copy link
Author

happyalu commented Oct 14, 2022

Sorry, I was not aware of the bug template. Updated my post above with more details.

@dr2chase
Copy link
Contributor

dr2chase commented Oct 17, 2022

@hyangah can you give this a look?

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants