-
Notifications
You must be signed in to change notification settings - Fork 249
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
Add support for libtool over ar #309
Conversation
On macOS libtool is preferred for creating static archives over ar. If libtool is set as the static linker, we need to pass different flags.
@irengrig Can you review this? It's need to make downstream green again. ;) |
Irina is out of office for the next two weeks. |
@hlopko @oquenchil Does this PR looks safe to you? We need some CMake/C++ expert. |
Hi, sorry for the late response, I am having a vacation (and turned off the notifications). The documentation for the used flags is here: https://cmake.org/cmake/help/v3.15/variable/CMAKE_LANG_ARCHIVE_CREATE.html?highlight=cmake_%20lang%20_archive_create The code looks reasonable. The reference to libtool cli: https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html#Link-mode Also, the CI has passed, but it runs against released Bazel, not against the master branch. Thank you all again! |
Hmm I guess it's up to the cmake configs to know if those other flags are necessary. I can try to add the appropriate ones for those (although I'm not sure libtool supports those). Good point about LINK_FLAGS. Maybe we should remove those. Alternatively do you know if there's a way to make cmake smarter about the static archiver it's using? AFAICT there is not. I think we should try this with bazel HEAD against envoy since it uses a ton of cmake libraries. |
Well, I can google :) I think I rather add a test in a separate PR that the user can still pass the value for those flags to override the value that we put automatically, so that there is a workaround for any situation.
Probably, each library can have this in CMakeLists.txt, but not outside the scripts. We can only manipulate the flags/environment variables.
|
I tested locally, this change doesn't look like to fix the issue. You can get a Bazel binary from HEAD at the following url to reproduce.
|
@keith thank you again for working on it! I used the changes in this OR as the basis for the fix in #315. Your fix was actually correct, the problem was in on eof the rules_foreign_cc tests with configure rule. |
On macOS libtool is preferred for creating static archives over ar. If
libtool is set as the static linker, we need to pass different flags.
Fixes bazelbuild/bazel#9258