-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[service] Removing compiler
from package_id
causes libstdc++ compatibility errors in tool_requires packages
#17034
Comments
* Add model of libstdc++ compatibility to ensure that binaries can not be used with older version of libstdc++ than what it was compiled for. * Remove deletion of self.info.settings.compiler because this _is_ relevant metadata for executables, as it inserts a dependency on a libstdc++ version at least what it was compiled with. * Modify the dependency version impact on package id to use full_version_mode. This ensures that the dependency package id's don't impact doxygen's package id - only version changes in dependencies will impact doxygen's package id. This is necessary to allow doxygen built with gcc 10 to be identified as compatible with a gcc 12 profile. Without this, compiler.version=12 propagates through the dependency tree and the package id of the doxygen package built with gcc 10 does not match appropriately and is not resolved as compatible. Relates to conan-io#17034
* Add model of libstdc++ compatibility to ensure that binaries can not be used with older version of libstdc++ than what it was compiled for. * Remove deletion of self.info.settings.compiler because this _is_ relevant metadata for executables, as it inserts a dependency on a libstdc++ version at least what it was compiled with. * Modify the dependency version impact on package id to use full_version_mode. This ensures that the dependency package id's don't impact doxygen's package id - only version changes in dependencies will impact doxygen's package id. This is necessary to allow doxygen built with gcc 10 to be identified as compatible with a gcc 12 profile. Without this, compiler.version=12 propagates through the dependency tree and the package id of the doxygen package built with gcc 10 does not match appropriately and is not resolved as compatible. Relates to conan-io#17034
Hi @samuel-emrys - thanks for opening this issue and your analysis. The approach followed by Conan Center is roughly what you list here:
That is, we try and ensure that packages that are consumed exclusively as executables are built with the oldest possible to ensure broad compatibility. This has been the approach followed for Conan 1.x packages in Conan Center, and not just with regards to libstdc++ but also glibc. I believe the specific issue here is that the Conan 2.0 packages published in Conan Center are built with gcc11 as the baseline, and thus it does not satisfy the assumption and might be an issue for users who are trying to run those binaries on older versions and consider possible solutions. Could you provide details as to which os (distro version etc) and compiler versions you are trying to target, and which Docker images you are using for this? Thanks! |
Thanks for the response @jcar87. I've been trying to build my application with gcc10, gcc11, gcc12. I use the I think the fact that conan 2 is only building with a very limited subset of compilers (i.e., only gcc11) is highlighting the deficiency with solution (1) as I outlined as a long term solution. It might be broadly sufficient for what conan center provides in terms of binaries, but in terms of recipes it opens the door to easily creating incompatible packages that won't identify the incompatibility and trigger a rebuild to ensure that a compatible binary is produced. I've demonstrated a working implementation of what a change in policy might look like in #17051. Unfortunately it seems to be failing the CI builds at the moment because it relies on reading |
* Add model of libstdc++ compatibility to ensure that binaries can not be used with older version of libstdc++ than what it was compiled for. * Remove deletion of self.info.settings.compiler because this _is_ relevant metadata for executables, as it inserts a dependency on a libstdc++ version at least what it was compiled with. * Modify the dependency version impact on package id to use full_version_mode. This ensures that the dependency package id's don't impact doxygen's package id - only version changes in dependencies will impact doxygen's package id. This is necessary to allow doxygen built with gcc 10 to be identified as compatible with a gcc 12 profile. Without this, compiler.version=12 propagates through the dependency tree and the package id of the doxygen package built with gcc 10 does not match appropriately and is not resolved as compatible. Relates to conan-io#17034
* Add model of libstdc++ compatibility to ensure that binaries can not be used with older version of libstdc++ than what it was compiled for. * Remove deletion of self.info.settings.compiler because this _is_ relevant metadata for executables, as it inserts a dependency on a libstdc++ version at least what it was compiled with. * Modify the dependency version impact on package id to use full_version_mode. This ensures that the dependency package id's don't impact doxygen's package id - only version changes in dependencies will impact doxygen's package id. This is necessary to allow doxygen built with gcc 10 to be identified as compatible with a gcc 12 profile. Without this, compiler.version=12 propagates through the dependency tree and the package id of the doxygen package built with gcc 10 does not match appropriately and is not resolved as compatible. Relates to conan-io#17034
What is your problem/feature request?
As per conan-io/conan-docker-tools#501, removing
compiler
frompackage_id
with a statement similar to the following is the incorrect model to model package requirements fortool_requires
packages.The compatibility model that should be used here is that any compiler newer than the version used to build the library is compatible. The reason for this is that building an executable with gcc 11 will use
GLIBCXX_3.4.30
, and so some assumptions are injected into the executable about which libstdc++ library version is available in the environment. If this executable is used in an environment where gcc 10 is used, the installed libstdc++ library will only have symbols compatible with up toGLIBCXX_3.4.28
and the executable will fail to execute.One example of this in CCI currently is the doxygen recipe. Because conan 2 is building packages using gcc 11, attempting to use the doxygen recipe using the
conanio/gcc10-ubuntu16.04
docker image fails with errors similar to the following:To fix this, there are a few options:
compiler
from package id with a very old compiler. This will just hide the underlying issue but it will give broad compatibility quickly. Could be a good short term solution.compiler
frompackage_id
in favour of more robust compatibility modelling using thecompatibility()
function. This is the best short/medium term solution and could be akin to (untested):Specifically, the documentation has the following suggestion:
I'm proposing this should be removed and should be considered grounds for rejection of a PR in a review in favour of some agreed upon
compatibility()
function definition.Another conversation that may be worth having is whether there's a better way to model these requirements explicitly rather than via compiler version. This isn't a great metric for evaluating which clang compiler versions can be used, for example, given it can also build using
libstdc++
and is not just constrained tolibc++
. This is somewhat related to conan-io/conan#3972The text was updated successfully, but these errors were encountered: