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

Don't use "libtool" for "ar" on darwin. #5127

Closed
judah opened this issue May 1, 2018 · 1 comment
Closed

Don't use "libtool" for "ar" on darwin. #5127

judah opened this issue May 1, 2018 · 1 comment

Comments

@judah
Copy link

judah commented May 1, 2018

Description of the problem / feature request:

On macOS (darwin), if the command-line developer tools are installed but XCode is not, then bazel uses /usr/bin/libtool as ar_executable. That behavior doesn't seem to make sense since (1) libtool and ar take different command-line arguments and (2) /usr/bin/ar is itself already available.

The relevant code in master is here:

overriden_tools["ar"] = "/usr/bin/libtool"

I'm unable to track down the reason for this behavior. It appears to have originated in this commit:
8fa5ae6#diff-3c392a08593f9fcb15e8267d7acc132dR67

Skylark build currently have to add logic to work around this behavior; we ran into it for rules_haskell (tweag/rules_haskell#223) and it's already been encountered in rules_rust: https://github.com/bazelbuild/rules_rust/blob/df95c3e3cd5afd87a69fa71dc9a56a0d0baa7823/rust/toolchain.bzl#L20

At minimum, it would help to add a comment explaining the reason so that downstream rule writers can know how to deal with it.

What operating system are you running Bazel on?

macOS Sierra

What's the output of bazel info release?

..................................................................
release 0.11.1-homebrew

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

https://github.com/bazelbuild/bazel
678bdb78a7971d9155297099aaac594f03d663fc
678bdb78a7971d9155297099aaac594f03d663fc
@hlopko
Copy link
Member

hlopko commented May 2, 2018

Hi Judah,

We use libtool because ar is deprecated (oneliner in http://www.manpages.info/macosx/libtool.1.html, who knows if it will be ever removed). Ideally you should assume nothing about C++ tools and command lines and instead ask C++ rules to give you the information needed. Except that C++ rules as of today won't give you good answers, but we're working on it:

  • [https://docs.google.com/document/d/1g91BWJITcYw_X-VxsDC0VgUn5E9g0kRBGoBSpoO41gA/edit](Skylark API to the C++ toolchain) - this is what you'll use to get the same command line as C++ rules would use.
  • Implement C++ Starlark API #4570 Skylark API to C++ action generation (and providers). Without looking into details I think this is what you'll need for rules haskell and rules rust.

We expect that both will be available by the end of Q2. I'll close this issue now since we don't plan to change the ar/libtool situation and we'll focus on proper APIs instead.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants