Open huysentr opened 5 months ago
Hi @huysentr
Have you had a look to this blog post? https://blog.conan.io/2024/02/20/Conan-2-graph-features.html
I think it can help with your issue, it allows to replace any dependency in the graph with your own logic, either defining it as a plaform_requires (in the system) or replacing it with your own recipe (that must implement the opengl/system
logic compatibility).
Please check that and let me know.
Hi @memsharded
I can replace them indeed, this was the initial approach, this however triggers a rebuild of the packages depending on them and then I run into include issues.
this however triggers a rebuild of the packages
Yes, this might be necessary, if you are changing one dependency for another, the binaries of the consumer packages might need a rebuild from source to account for the new dependency. This is natural and expected. If you have doubts about why/when this is happening, (and you think it shouldn't be happening) it would be good to have a reproducible example with code that shows the behavior.
then I run into include issues.
What include issues? If you have some reproducible steps that we can do to understand what issues, that would help. You might have to specify in the replace_requires
recipe the self.cpp_info.includedirs
to the specific system path holding those includes?
So currently I gave up on this approach because there is a package from conan center that creates its own .pc file append this on the path of gcc package that is replacing the system packages and errors because the path is complete nonsense, the .pc file assume that search starts from system root but it does not. So now I need to do a conan install step just for gcc and then pass the gcc location as tools.gnu:pkg_config=gcc/package/folder/bin/pkg-config
Sorry, I am a bit lost how that is connected with the original issue with opengl/system
being replaced by a user recipe. Most likely I am missing a lot of details and understanding how that gcc
package works, and what packages in ConanCenter you refer to, and why they will create .pc files. It would be much better if there is something that we could reproduce from our side, to understand it.
Okay so we're using a gcc package to deploy cross-compilers. We try to use some of the conan io center uploads as wel. These have system packages. We have the options to install them automatically on the system, however we prefer to deploy them using the gcc package.
There are two attempts for this, one is to specify the pkg config as:
tools.gnu:pkg_config=<path to the gcc package>/bin/pkg-config
or
replace requires:
[replace_requires]
opengl/system: gcc_package
xkeyboard/system: gcc_package
...etc
Now the issue I run into is with this dependency: https://github.com/conan-io/conan-center-index/blob/master/recipes/xkbcommon/all/conanfile.py
in particular these lines:
if self._has_build_profile:
pkg_config_deps.build_context_activated = ["wayland", "wayland-protocols"]
pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"}
else:
# Manually generate pkgconfig file of wayland-protocols since
# PkgConfigDeps.build_context_activated can't work with legacy 1 profile
wp_prefix = self.dependencies.build["wayland-protocols"].package_folder
wp_version = self.dependencies.build["wayland-protocols"].ref.version
wp_pkg_content = textwrap.dedent(f"""\
prefix={wp_prefix}
datarootdir=${{prefix}}/res
pkgdatadir=${{datarootdir}}/wayland-protocols
Name: Wayland Protocols
Description: Wayland protocol files
Version: {wp_version}
""")
save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content)
pkg_config_deps.generate()
turns out the wayland.pc that is generated assume it is searching from the root, and it uses the full conan package path of wayland. result is that gcc package config searches inside it self using the wayland .pc like this:
<gcc-package>/sysroot/<wayland-package>
complete non-sense ofcourse. I suspect both solutions will have this issue. But the replace requires triggers a rebuild and the package-config redirect does not. Hence I did not run into the issue then.
What is your question?
Hi, I am using conan 2
And I have a list of dependencies. One of these dependencies uses
opengl/system
for example.opengl/system
requires installs on the machine itself. However I do not want this to happen. I want specifically to use my owngcc/rhel7
package for these configs. My solution:However, I need to know the path to my gcc/rhel7 package. And it is only installed after I run my conan install step, that fails the first time on the opengl/system, because the package_info of this package looks for the gl package, that is not installed (because I set tools.system.package_manager:mode=report)
After this first install step I can retrieve. And then I can pass this config:
tools.gnu:pkg_config=<path to the gcc package>/bin/pkg-config
and everything works out. Now ofc, I want the build to succeed only having to run once. Is there a way for me to retrieve the GCC package directory, somehow before hand? Any tips on this?Have you read the CONTRIBUTING guide?