-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[feature] Implement tools.build:install_strip for Autotools #18606
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pbs3141
Thanks for your contribution!
It would be necessary to add at least some integration
tests (in the integration folder), that means, those tests shouldn't really compile or install-strip anything, but at least cover that the install()
method works as expected.
This can be easily done in a similar way to test test_autotools_make_parameters
, by defining a custom def run()
method in the recipe, that will receive the resulting call.
target = "install" | ||
do_strip = self._conanfile.conf.get("tools.build:install_strip", check_type=bool) | ||
if do_strip: | ||
target += "-strip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that there are projects/packages out there that do not define a install-strip
target at all?
And then this would break for those projects/packages?
Or it is expected that every autotools project that calls autotools.install()
must have this install-strip
target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this automake manual the install-strip
target always exists,
Automake also generates rules for targets
uninstall
,installdirs
, andinstall-strip
.
though I'm no expert with autotools, so I could have somehow misinterpreted this documentation.
I've added a unit test based on those for the linked PRs. However, I haven't yet run it locally - in fact, I was rather hoping CI could do it for me! |
I tried rebuilding all my dependencies with this option, and only Here is the output at the point where it diverges, which happens at line 4: Before PR (good):
After PR (fails):
Note that the problematic file ( |
Thanks very much for checking and testing this, very appreciated! This is exactly the type of risk that we want to be aware, and understand the tradeoffs before moving something like this forward, very often changes looking as evident as this one do actually break different users and use cases out there in the wild.
This shouldn't be a problem, there are several packages in ConanCenter, that even they are library-like, for example So the solution wouldn't be to remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is what is failing in the tests in CI
Make Autotools strip libraries if requested, consistent with CMake and Meson, by using the 'install-strip' target instead of 'install'.
The issue with |
I think it would be better to at least fix |
The added test was broken, I have submitted a fix for the test. This would still need the fix for |
The failed tests are unrelated, they come from recent updates of github runners for OSX that broke some of our tests, we are trying to fix those tests. I have tried building
In my Ubuntu, but it didn't fail. Up to my knowledge, it didn't get any recent change to fix this. It seems this could fail only for an Android build? Can you please give more details on your seen errors and how to reproduce? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation itself LGTM.
however I'm not sure what will work in practice if enabled wholesale
The tools.build:install_strip config is supposed to allow shared libraries to be stripped.
The docs currently say this:
tools.build:install_strip: (boolean) Strip the binaries when installing them with CMake and Meson
Which "binaries" are stripped are up to the relevant tool. I'm fairly certain that the autotools target only strips executables, not libraries. And I've seen some cases where install-strip
doesn't work, or where the strip configuration is different (its provided as a flag to ./configure
).
So while the implementation is fine, I feel like this makes very few guarantees compared to what meson and CMake offer.
Merged, this will go in next 2.20. Thanks again for your contribution! |
Changelog: Feature: Implement
tools.build:install_strip
for Autotools.Docs: conan-io/docs#4211
The
tools.build:install_strip
config is supposed to allow shared libraries to be stripped. This was implemented for CMake in #14167, Meson in #18429, but not yet implemented for Autotools - which this PR does.develop
branch, documenting this one.