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

[bug] using 'replace_requires' leads MSBuildDeps generator to include non-existent property sheet #17966

Open
chr-thien opened this issue Mar 15, 2025 · 6 comments · May be fixed by #17967
Open
Assignees
Milestone

Comments

@chr-thien
Copy link

Describe the bug

I'm using component 'wt' with recipe from conan-center-index.
'wt' requires 'sqlite3'.
I'm building a component named 'sqlite3see' which is a drop-in replacement for 'sqlite3'.
For 'sqlite3see' I'm using the recipe from conan-center-index and changed only source code URL.

My profile for building 'wt' contains 'replace_requires'
[replace_requires]
sqlite3/*: sqlite3see/[>3]

This part works fine.

Now I'm consuming 'wt' in my own component using MSBuild.
I use same profile with 'replace_requires'.
I use MSBuildDeps generator to get property sheets which I import into my project.

The bug is:
Generator created a property sheet named conan_sqlite3see.props.
Generator created a property sheet named conan_wt.props.
The property sheet for 'wt' wants to import a property sheet of conan_sqlite3.props.
But 'sqlite3' was redirected to 'sqlite3see'.
So there is no property sheet conan_sqlite3.props

This but was introduced in 2.12.

This bug is related to #17557

Revisions of Conan prior to 2.12 generated different property sheets.
Property sheets for 'wt' did not include the property sheets of requirements.

How to reproduce it

Maybe could be reproduced with other 'replace_requires' as well (e.g. 'zlib'->'zlig-ng').

@memsharded memsharded self-assigned this Mar 15, 2025
@memsharded
Copy link
Member

Hi @chr-thien

Thanks for your report.

I am trying to reproduce, and did some extra checks in the test suite in #17967.

So far it seems to be working fine, the conan_openssl_release_x64.props properties file is including the replacementconan_zlib-ng.props, not the original conan_zlib.props.

It would be great to have a minimal reproducible case, ideally self-contained, it can be done with quick conan new cmake_lib templates, maybe?

@chr-thien
Copy link
Author

I tried to create minimum working example with zlib-ng and libpng. Everything works as expected.

Then I had a look at the recipe of 'wt' from conan-center-index and found this:

def package_info(self):
...
# wtdbosqlite3
if self.options.get_safe("with_sqlite"):
self.cpp_info.components["wtdbosqlite3"].set_property("cmake_target_name", "Wt::DboSqlite3")
self.cpp_info.components["wtdbosqlite3"].libs = ["wtdbosqlite3{}".format(suffix)]
self.cpp_info.components["wtdbosqlite3"].requires = ["wtdbo", "sqlite3::sqlite3"]

Here it sets a requirement to 'sqlite3::sqlite3' directly. This could be the problem. It seems that 'replace_requires' is not taken into account here.

@memsharded
Copy link
Member

Thanks for the details.
I have extended the check for the tests that check components, and indeed, the case for components was not covered, so I added the fix in #17967. I'll try to add it to next Conan 2.15 release

@memsharded memsharded added this to the 2.15.0 milestone Mar 15, 2025
@memsharded
Copy link
Member

If you know how to do it, it would be useful if you could test your project running from source from my branch in #17967, that would be good feedback too.

@chr-thien
Copy link
Author

I tested using your branch 'test/replace_requires_msbuilddeps'. The problem is gone.
Now generated 'conan_wt_wtdbosqlite3.props' imports generated property sheet of replaced component.
Great!
Waiting for 2.15 now.

@memsharded
Copy link
Member

Excellent, thanks for the feedback!

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

Successfully merging a pull request may close this issue.

2 participants