bazel-contrib / bazel-contrib/rules_go

Empty c files make the build sulky

Open
#643 0 comments 0 reactions 0 assignees View on GitHub
cgo darwin enhancement
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

The new cgo stuff is much better in many ways, but it does mean we often compile empty c files, and for some reason ranlib on the mac likes to produce non suppressible warnings for this.
```
ranlib: file: bazel-out/darwin_x86_64-fastbuild/.....cgo_c_lib.lo(_cgo_export.o) has no symbols
```
I think it's kind of ugly that the normal build process causes log spam, which might hide real information from the user. I think the only way to fix it though is to make all generated c files have at least one symbol in them, not sure what the best way to do that is that will work in all cases, on all compilers, is guaranteed to never cause a duplicate symbol error with user code, and does not cost in runtime memory or binary size.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the macOS build that emits the ranlib warning for bazel-out/darwin_x86_64-fastbuild/.....cgo_c_lib.lo(_cgo_export.o), then trace which generated C files are empty. Done means the normal cgo build no longer produces these warnings without introducing duplicate symbols, runtime memory, or binary-size costs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.