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

proposal: cmd/go: support CC_FOR_* #24294

Closed
eliasnaur opened this issue Mar 7, 2018 · 1 comment
Closed

proposal: cmd/go: support CC_FOR_* #24294

eliasnaur opened this issue Mar 7, 2018 · 1 comment
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Proposal
Milestone

Comments

@eliasnaur
Copy link
Contributor

eliasnaur commented Mar 7, 2018

I'm working on generating standalone gomobile bindings, allowing you to first generate and then use regular go commands to build. For example, this works with my local version of gomobile:

$ gobind -outdir $GOPATH golang.org/x/mobile/example/bind/hello
$ GOOS=android GOARCH=arm64 CC=<ndk-arm64-dir>/bin/clang go build -buildmode=c-shared gomobile

Note that CC (and CXX) is GOARCH specific, so to build for all 4 android GOARCHs, a user have to go:

$ GOOS=android GOARCH=arm CC=<ndk-arm-dir>/bin/clang go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=arm64 CC=<ndk-arm64-dir>/bin/clang go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=386 CC=<ndk-386-dir>/bin/clang go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=amd64 CC=<ndk-amd64-dir>/bin/clang go build -buildmode=c-shared -o ... gomobile

It would be nice if the go command supported the CC_FOR_* environment variables like make.bash does, so the user could set CC_FOR_android_arm, CC_FOR_android_arm64, CC_FOR_android_amd64 and CC_FOR_android_386 once and reduce the build to the much nicer:

$ GOOS=android GOARCH=arm go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=arm64 go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=386 go build -buildmode=c-shared -o ... gomobile
$ GOOS=android GOARCH=amd64 go build -buildmode=c-shared -o ... gomobile

I suppose for completeness, the go command has to support CC_FOR_TARGET and CXX_FOR_TARGET as well.

@andybons andybons added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 7, 2018
@andybons andybons changed the title cmd/go: support CC_FOR_* proposal: cmd/go: support CC_FOR_* Mar 7, 2018
@gopherbot gopherbot added this to the Proposal milestone Mar 7, 2018
@ianlancetaylor
Copy link
Contributor

To really work in the ecosystem, the whole set of environment variables would have to be reported by go env, whose output is already rather long. It's sufficiently simple to write a shell script, or tiny Go program, or Makefile, that it doesn't seem necessary to add this to cmd/go itself.

Decision: we aren't going to add this.

@golang golang locked and limited conversation to collaborators Mar 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Proposal
Projects
None yet
Development

No branches or pull requests

4 participants