-
Notifications
You must be signed in to change notification settings - Fork 991
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] Conan 2.x Migration - transitive_headers and transitive_libs Trait Defaults #17505
Comments
Hi @radonish Thanks for your question. First, the
This also works for shared libraries, you can add So the only case where |
Hello @memsharded, thank you for the quick response. I ran the commands you gave and do see the expected behavior for those test packages. I'm comparing the generated recipes with the actual recipes my team is using in order to determine what is going wrong. One key observation when looking at the linker command line for the link failure that occurs in the test_package for our library is that the library paths are there (-L parameters for transitive dependencies are contained) but the specific transitive library path/names are missing. That makes me wonder if it is a package_info problem where the libs for the transitive dependency packages aren't being properly set/advertised. (In one example our proprietary library - let's call it libx - is simply dependent on the Conan Center's POCO library package. libx builds and links fine, but its test_package fails with linker errors that it cannot find POCO. As noted above, the linker command line contains the -L parameter to the Conan cache for POCO but I do not see any of the POCO libraries called out.) |
@memsharded, the issue appears to occur when cross-compiling. An example cross-compile host profile that fails with your liba/libb test is this aarch64 one below:
It works with a host profile that matches the build profile:
|
Here is a build log that shows:
(Changed them to shared libraries within the conanfile.py itself.) |
@memsharded, from the log above, the linker command that fails to link libb to liba for the libb test_package is:
I think the problem is related to how the linker command is being constructed. My understanding is we want to use 1 of 2 options:
Instead the linker command being generated is adding a If I change the Conan-generated libb/test_package/conanfile.py from:
to
The link succeeds because it causes the addition of the full path to liba in the cache to the linker command line. I haven't dug into why this works OK when I'm not cross-compiling and the build and host profiles are just the default RHEL build tools. Perhaps it has something to do with GCC 4 (build tool version) vs. GCC 8 (host tool version for our buildroot-based cross toolchains) and linker nuances. Either way, it's starting to feel like this is a cross-compilation test_package linker bug when the dependency tree is made up of shared libraries. It seems to me that the test_package linker command should include the full path to the shared libraries of the transitive dependencies (as is the case for the actual package linker command). Thank you |
What is your question?
Hello, I've read over the requirements traits documentation and want to ensure the behavior I'm seeing is as desired.
Let's say liba requires libx and liby. Let's also say that all 3 libraries are built shared. liba conanfile.py has:
In migrating the test_package for liba my first attempt was to simply have the following in test_package's conanfile.py:
The link of test_package for liba fails due to symbols from libx and liby. (Edit: Note, the test_package is just an empty main() - no actual code/references to the transitive dependencies.)
If I update liba's conanfile.py as follows, test_package can link:
I think I would have expected the transitive_headers and transitive_libs to be True by default since the libraries are shared. Any insight on the behavior/my assumptions would be appreciated. Thank you!
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: