Description of the problem / feature request / question:
On macOS, if a source file in a static cc_library doesn't define any global symbols, we see a warning like the one below:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/darwin_x86_64-fastbuild/bin/libempty.a(empty.o) has no symbols
This is a problem in rules_go. We use a tool in the Go toolchain (cgo) that generates some .c files that get compiled with cc_library. One of the generated files in each library frequently has no symbols, but it's hard to know ahead of time whether that's the case (the file is not empty).
It would be nice to suppress these warnings altogether. There may be a lot of libraries with cgo in a Go project, so our users may see a lot of warnings.
It looks like ranlib on macOS supports a flag -no_warnings_for_no_symbols. ar does not support this flag. The actual command that's emitting this warning looks like this:
external/local_config_cc/wrapped_ar rcs bazel-out/darwin_x86_64-fastbuild/bin/libempty.a bazel-out/darwin_x86_64-fastbuild/bin/_objs/empty/empty.o
Maybe this flag can be added in wrapped_ar.tpl?
If possible, provide a minimal example to reproduce the problem:
cc_library(
name = "empty",
srcs = ["empty.c"],
linkstatic = 1,
)
empty.c is an empty file. Note that there are additional warnings if the entire library has no symbols. Those warnings don't affect rules_go, but they should probably be suppressed, too.
Environment info
Description of the problem / feature request / question:
On macOS, if a source file in a static
cc_librarydoesn't define any global symbols, we see a warning like the one below:This is a problem in rules_go. We use a tool in the Go toolchain (cgo) that generates some .c files that get compiled with
cc_library. One of the generated files in each library frequently has no symbols, but it's hard to know ahead of time whether that's the case (the file is not empty).It would be nice to suppress these warnings altogether. There may be a lot of libraries with cgo in a Go project, so our users may see a lot of warnings.
It looks like ranlib on macOS supports a flag
-no_warnings_for_no_symbols. ar does not support this flag. The actual command that's emitting this warning looks like this:Maybe this flag can be added in wrapped_ar.tpl?
If possible, provide a minimal example to reproduce the problem:
empty.c is an empty file. Note that there are additional warnings if the entire library has no symbols. Those warnings don't affect rules_go, but they should probably be suppressed, too.
Environment info
Operating System: macOS Sierra 10.12.6
Bazel version (output of
bazel info release): release 0.7.0