bazel-contrib / bazel-contrib/rules_go

The C compiler cannot be changed

Open
#3,310 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.5k
Forks
762
Avg merge
1d 11h
Merged PRs (30d)
12

Description

What version of rules_go are you using?

v0.35.0

What version of gazelle are you using?

N/A

What version of Bazel are you using?

5.3.1

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

MacOS 11.6.8 x86_64

Any other potentially useful information about your toolchain?

No

What did you do?
go_binary(
    name = "lib-ios",
    srcs = [
        "main.go",
    ],
    cgo = True,
    linkmode = "c-archive",
    tags = [
        "ios",
    ],
)
What did you expect to see?

I expected there to be an option to change the C compiler. Specifically, I would like to use the C compiler returned from xcrun --sdk iphoneos --find clang

What did you see instead?

There is no option to change the C-compiler

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the go_binary example using cgo=True and linkmode="c-archive", then trace how rules_go selects the C compiler under Bazel. Compare that behavior with xcrun --sdk iphoneos --find clang and check the relevant Bazel toolchain configuration. Done means the example can select the requested compiler and still produces the expected iOS archive.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.