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

Fix broken cpp_info.location deduction due to unsanitized regex #17430

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Dec 8, 2024

Changelog: Fix: Fix broken cpp_info.location deduction due to unsanitized regex.
Docs: Omit

Using grpc with -c tools.cmake.cmakedeps:new=will_break_next currently fails with:

ConanException: grpc/1.67.1: Cannot obtain 'location' for library 'grpc++_alts' in ['/home/martin/.conan2/p/b/grpcad62ea78a9235/p/lib']. You can specify 'cpp_info.location' directly or report in github.com/conan-io/conan/issues if you think it should have been deduced correctly.

This PR fixes the location detection failure due to the unsanitized + symbols in the library name.

@valgur valgur force-pushed the bugfix/location-regex branch from 722ea8a to d6e9c5d Compare December 8, 2024 21:11
@valgur
Copy link
Contributor Author

valgur commented Dec 8, 2024

The location detection could be improved further, still. It should fall back to the fuzzy regex only if an exact match is not found.

grpc/1.67.1: WARN: There were several matches for Lib grpc: ['lib/libgrpc.so.44.0.0', 'lib/libgrpc_authorization_provider.so.1.67.1', 'lib/libgrpc_plugin_support.so.1.67.1', 'lib/libgrpc_unsecure.so.44.0.0']

grpc/1.67.1: WARN: There were several matches for Lib grpc++: ['lib/libgrpc++.so.1.67.1', 'lib/libgrpc++_alts.so.1.67.1', 'lib/libgrpc++_error_details.so.1.67.1', 'lib/libgrpc++_reflection.so.1.67.1', 'lib/libgrpc++_unsecure.so.1.67.1']

@valgur
Copy link
Contributor Author

valgur commented Dec 8, 2024

Unrelated, but too minor for a separate issue - using grpc with the new CMakeDeps still fails after this fix with

  File "/home/martin/libs/conan/conan/tools/cmake/cmakedeps2/target_configuration.py", line 169, in _get_cmake_lib
    self._conanfile.output.warning("frameworks not supported yet in new CMakeDeps generator")
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConanFileInterface' object has no attribute 'output'

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

We would like to start first with some unit test that would fail without this change. This is the best way to move forward without breaking the addressed issue because is not properly covered.

@memsharded
Copy link
Member

Unrelated, but too minor for a separate issue - using grpc with the new CMakeDeps still fails after this fix with

Agree, if you want you can just replace that with a ConanOutput(scope=str(self.conanfile)).warning() or something like that, this doesn't require test coverage yet, as it is just a temporary warning until the frameworks are implemented.

@memsharded memsharded merged commit c238022 into conan-io:develop2 Dec 11, 2024
33 checks passed
@memsharded
Copy link
Member

Merged, thanks for the contribution, it will be in next Conan 2.11

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

Successfully merging this pull request may close these issues.

4 participants