-
Notifications
You must be signed in to change notification settings - Fork 988
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
[platform_requires] and consumers use of dependencies['somelib'] #16659
Comments
Maybe //Klaus |
Hi @klausholstjacobsen I'd caution that using |
I have done some progress in my PR: #16443, if you want to give it a try and see if it works in your case, that would be very valuable feedback. |
#16443 was merged, providing "referential transparency" for replaced requires in Closing this ticket as solved, but please don't hesitate to create new tickets for any further question or issue, thanks for your feedback. |
Hmm, this is not quite working for me and I can't figure out why.
This is working most places, except for ERROR: boost/1.85.0: Error in build() method, line 1150
self._create_user_config_jam(self._boost_build_dir)
while calling '_create_user_config_jam', line 1537
contents += create_library_config("zlib", "zlib")
while calling 'create_library_config', line 1519
aggregated_cpp_info = self.dependencies[deps_name].cpp_info.aggregated_components()
KeyError: "'zlib' not found in the dependency set" Looking at the conan code, it looks right to me. Any ideas? |
Hi @curlybeast I think this is expected. The moment you use This is why in the blog post and docs I think we commented this, the summary would be:
|
If this is the case, how will recipes expecting to use
I see the problem, but I see another problem coming with the current approach - how can we link to the system library if recipes are adding the linker flags based on a dictionary lookup that no longer exists?
I read the blog too - thanks, good post! |
Because in many cases accessing the dependencies explicitly in recipes is not necessary, and it shouldn't be necessary. The abstractions, build system generators such as CMakeDeps are there to avoid having to do this. Recipes doing this are usually exceptions because they have some special build systems or not following best practices, so recipes need to provision explicitly for those dependencies. If the recipe for example needs to provide the build scripts with the
Linker flags should also be unnecessary, implemented in the consumer build scripts, or abstracted away by other means. But if it is the dependency recipe, like the This is the reason why in many cases the In other words, if everything was easily usable without Conan, then Conan wouldn't exist. There is a reason why having Conan packages is very convenient, and completely dropping the "representation" that a Conan package recipe brings, takes users to the initial state without Conan, where it is not that easy to use dependencies. And |
Yes, it's actually boost 1.85 that's problematic for me here. I think the main reason they have code for this is because zlib is optional? I suspected they were outside the recommended approaches though with this :)
Remember, I'm talking about recipes (
Yea, I agree. To be fair, it's pretty hard to get this right in a general way. Where I work, some engineers want to use system libraries AND 3rd party libraries together. This is difficult to begin with, but I think this becomes increasingly problematic and it's often better to go with one approach or the other. Sadly, the main reason we're using Conan is also because the system doesn't provide the libraries we need :) Thanks again for the help / support! |
Yes, this is the relevant code in boost recipe: if self._with_iconv:
flags.append(f"-sICONV_PATH={self.dependencies['libiconv'].package_folder}")
if self._with_icu:
flags.append(f"-sICU_PATH={self.dependencies['icu'].package_folder}") As Boost build system uses these cli args, then it is reasonable that they need these
Yes, exactly :) |
Hello
I've read a previous thread about this issue, and understand the complications and limitations.
It would be nice if recipes could detect if a dependency is a normal dependency or a platform_requires.
In the boost recipe I have similar challenges with libiconv. One solution could be to to just probe dependencies for the existence of a dependency and otherwise asume it is an platform_requires? Like this:
Regards
Klaus
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: