-
Notifications
You must be signed in to change notification settings - Fork 967
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
[question] problem with collecting .so libs that have a . in the name #8109
Comments
Hi, @JimmySnails The tool Nevertheless, you can list the libraries yourself, or you can combine both approaches if it is easier for you ( self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.libs.extend(["name1", "name2", ]) And then there is another side of the same problem (not sure which one is bitting you): when Conan generates the |
Thank you for your answer. Just adding the libraries wasn't enough. they were still incorrectly added as "not found - system libs" via collect. What makes me wonder, is the fact that the libs are found correctly on windows (same filename, .dll extension instead of .so). i think this is a bug in the collection mechanism. |
Hi @SimplyLiz Could you please list the exact filenames of the libraries (in the filesystem) you want to collect and what would be the expected result, that
|
Please let me know if i can be of further assistance.
The output with the manually specified list:
the collect output:
The libraries:
same filename on windows, but |
Hi @SimplyLiz I am checking this behavior, and it seems conan is working consistently. These 2 tests pass: def test_collect_multiple_dots(self):
conanfile = ConanFileMock()
conanfile.package_folder = temp_folder()
libs = ["hmitr.eapi.license.so", "hmitr.eapi.main.so"]
for lib in libs:
save(os.path.join(conanfile.package_folder, "lib", lib), "")
conanfile.cpp_info = CppInfo("", "")
result = conanfile.collect_libs()
self.assertEqual(["hmitr.eapi.license", "hmitr.eapi.main"], result)
def test_collect_multiple_dots_libs(self):
conanfile = ConanFileMock()
conanfile.package_folder = temp_folder()
libs = ["hmitr.eapi.license.lib", "hmitr.eapi.main.lib"]
for lib in libs:
save( os.path.join(conanfile.package_folder, "lib", lib), "")
conanfile.cpp_info = CppInfo("", "")
result = conanfile.collect_libs()
self.assertEqual(["hmitr.eapi.license", "hmitr.eapi.main"], result) The problem here is the difference of the linker behavior for different compilers, I would say it is more of an issue or inconsistency in the gcc linker, that when it finds a name with dots, it assumes it already contains the extension. Seems that using dots in library names is really problematic. I don't think we can change the libs = tools.collect_libs(self)
if self.settings.os == "Linux": # Assuming shared libs in Linux
libs = [("{}.so".format(lib) if "." in lib else lib) for lib in libs]
self.cpp_info.libs = libs Please let me know if this helps. |
thank you, renaming isn't an option, it's a 3rd party component. i'll stick with your solution, it's perfect for my package. thank you! |
Yes, we might try to improve this for Conan 2.0, it will be less risky to change behavior there.
Sure, this is what we would try in Conan 2.0, it might work, but we have already learned that this kind of change can also break other users in impossible to anticipate ways. Thanks for the feedback! |
I'm using conan to collect libraries (.so) in a specific directory.
Edit: Since it's not obvious. I'm using cmake.
All libraries are found, but the ones that don't have a lib prefix AND a
.
in the name are not added correctly.I get an linker error. You can see in the log below, that all libs have the full path appended, but those "special name" libs are added via -l and thus fail
is this a bug?
Idk if you need more information. those are just external libraries (not built by me) in directory and i use this in the conanfile packaging step:
to gather those libraries and use them.
most start with
lib
and do not have dots in the name, but a few do...The text was updated successfully, but these errors were encountered: