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

Bazel should pass -no_warning_for_no_symbols to libtool when using XCode toolchain #5981

Closed
nelhage-stripe opened this issue Aug 24, 2018 · 12 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple

Comments

@nelhage-stripe
Copy link
Contributor

nelhage-stripe commented Aug 24, 2018

Description of the problem / feature request:

I have a (proprietary) project that contains some C++ source code files which, on certain platforms, emit no symbols due to #ifdefs. When I build on macOS, bazel build prints useless warnings like:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/darwin-fastbuild/bin/libempty.a(empty.o) has no symbols                                     

Feature requests: what underlying problem are you trying to solve with this feature?

I'd like bazel to pass flags to suppress this useless warning.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

You can easily reproduce with a cc_library rule with empty .c file; I've uploaded a minimal test case here: https://gist.github.com/nelhage-stripe/df1374361be6daa938e6ec75f93daf7a

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 0.16.1

Any other information, logs, or outputs that you want to share?

I believe passing no_warning_for_no_symbols to libtool (which is $AR on the xcode toolchain, as I understand it) will suppress this warning.

@jin jin added z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple untriaged labels Aug 26, 2018
@tetromino tetromino added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Aug 30, 2018
@tetromino
Copy link
Contributor

Makes sense, we should fix this.

@tetromino
Copy link
Contributor

This involves updating the script that generates bazel/tools/osx/crosstool/CROSSTOOL.tpl - I've filed an internal bug for it.

@tetromino
Copy link
Contributor

For future reference - internal bug is b/113576433

@jamiesnape
Copy link

Any progress on this? Since #6478 merged, this is the one remaining source of needless spam in the output on Mac.

@tetromino
Copy link
Contributor

Sorry, this fell through the cracks. I will try to fix.

bazel-io pushed a commit that referenced this issue Jan 16, 2019
…sx CROSSTOOL.

Reduces useless warning spam on osx, as reported in #5981.

RELNOTES: None
PiperOrigin-RevId: 229586053
@tetromino
Copy link
Contributor

Fixed by 81b59f0.

weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this issue Jan 31, 2019
…sx CROSSTOOL.

Reduces useless warning spam on osx, as reported in bazelbuild#5981.

RELNOTES: None
PiperOrigin-RevId: 229586053
@cpsauer
Copy link
Contributor

cpsauer commented Apr 20, 2022

Looks like some of these are still sneaking through. Posted more in the (still open) #4057 (comment)

@keith
Copy link
Member

keith commented Apr 20, 2022

can you file a new issue with a repro? should be an easy fix

@cpsauer
Copy link
Contributor

cpsauer commented Apr 20, 2022

On it! Thanks, Keith. Amazed at your breadth

@cpsauer
Copy link
Contributor

cpsauer commented Apr 20, 2022

(You're sure you don't want it in the other issue, still open and applicable?)

@keith
Copy link
Member

keith commented Apr 20, 2022

either way

@phst
Copy link
Contributor

phst commented Jan 15, 2024

I think this issue has reappeared now that C++ builds on macOS use the Unix toolchain by default (Bazel 7). I guess Bazel should pass the necessary flags for the Unix toolchain as well, at least if the macOS binaries (and not GNU ones installed via e.g. Homebrew) are used for compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple
Projects
None yet
Development

No branches or pull requests

7 participants