-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
cc_library warning: file has no symbols #4057
Comments
It looks to me like there's still an issue outstanding here somewhere. Not sure if it's a regression since #5981/81b59f0, or an edge case that's slipping through. [I'm seeing this warning when building a .mm (Obj-C++) file using an objc_library.] @tetromino, I'm hoping it's okay if I tag you, since you wrote the original fix--and I don't (quickly) see where thie invocation is slipping through without |
@keith, here's the repro, per #5981: Output should show the warning in all valid cases with {cc_library, objc_library}x{C, C++, Obj-C, and Objc-++}. |
This warning is actually slightly different, and there doesn't appear to be a way to disable it: |
This original issue can def be closed, but we could track that one separately, or not. Theoretically we could filter the output to just ignore that, IMO it's rarely going to indicate a real issue |
The warning is unlikely to indicate a real issue, and Bazel already silences parallel warnings with `-no_warning_for_no_symbols`. For more context, see bazelbuild#4057
Good call. Figured I'd PR it up while we were discussing. How about something like #15325? |
(Have tested, and it fixes all the repro cases above and the instances in my own codebase that initially brought me to this issue.) |
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: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.0The text was updated successfully, but these errors were encountered: