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

[question] Is it possible to model the glibc forward compatibility? #17523

Open
1 task done
leha-bot opened this issue Dec 24, 2024 · 2 comments · May be fixed by #17524
Open
1 task done

[question] Is it possible to model the glibc forward compatibility? #17523

leha-bot opened this issue Dec 24, 2024 · 2 comments · May be fixed by #17524
Assignees
Labels
responded Responded by Conan team type: question

Comments

@leha-bot
Copy link

leha-bot commented Dec 24, 2024

What is your question?

I had added the glibc.version (as was suggested in #3972 (comment) )
and I'm stuck with the issue: how could I mark the packages as compatible with any libc.version greater or equal current.

Example:

  1. I created and exported the package on old Ubuntu with libc_version, for example, 2.28
  2. I want to consume this binary package on new Ubuntu with libc_version 2.32
  3. What should I do with conanfile.py? I thought also about compatibility.py, but don't understand, is it suitable for this

According to https://docs.conan.io/2/reference/conanfile/methods/compatibility.html , I should check the current libc.version with some prebuilt version, if I understood correctly, but how can I get it from first step?

Sorry for potentially vague question, feel free to ask, if I wrote something weird.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@leha-bot leha-bot changed the title [question] SHORT DESCRIPTION [question] Is it possible to model the glibc forward compatibility? Dec 25, 2024
@AbrilRBS AbrilRBS self-assigned this Dec 25, 2024
@AbrilRBS
Copy link
Member

AbrilRBS commented Dec 25, 2024

Hi @leha-bot thanks a lot for your question.
You're right in assuming that the best approach for your request would be to use the compatibility.py extension.
A very basic one would look something like this:

<conan_home>/extensions/plugins/compatibility/compatibility.py

from glibc_compat import glibc_compat
def compatibility(conanfile):
    configs = cppstd_compat(conanfile)
    # TODO: Append more configurations for your custom compatibility rules
	libc_versions = glibc_compat(conanfile)
    # This is where you would need to do extra work for the crossproduct of cppstd and libc compats
    # For now it just adds them
    configs.extend(libc_versions)
    return configs

And your <conan_home>/extensions/plugins/compatibility/glibc_compat.py file:

from conan.tools.scm import Version

def glibc_compat(conanfile):
    # Do we have the setting?
    libc_version = conanfile.settings.get_safe("libc_version")
    if libc_version is None:
        return []
    available_libc_versions = conanfile.settings.libc_version.possible_values()
    ret = []
    for possible_libc_version in available_libc_versions:
        if Version(possible_libc_version) >= Version(libc_version):
            ret.append({"settings": [("libc_version", possible_libc_version)]})
    return ret

Some notes:

  • As written, this would not create the cross product of cppstd compatibility and glibc versions. If that's desired, the logic would need to be a bit different
  • These compatibility changes should at the very least be part of the consumer config, which is the one that needs to be able to iterate them

Additionally, I've submitted a test in #17524 to reflect this suggestion and ensure we can use it as a reference point in the future

Let me know if this helps :)

@AbrilRBS AbrilRBS linked a pull request Dec 25, 2024 that will close this issue
@memsharded memsharded added type: question responded Responded by Conan team labels Dec 27, 2024
@leha-bot
Copy link
Author

Big thanks, it worked when I swapped the version comparison sign here:

 if Version(possible_libc_version) >= Version(libc_version):

I also used the dotted values for glibc version in settings_user.yml ("os.libc.version")
settings_user.yml.zip

Debug log for conan install --requires=fmt/11.0.0
======== Computing necessary packages ========
2.39
['2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '2.8', '2.9', '2.10', '2.11', '2.12', '2.13', '2.14', '2.15', '2.16', '2.17', '2.18', '2.19', '2.20', '2.21', '2.22', '2.23', '2.24', '2.25', '2.26', '2.27', '2.28', '2.29', '2.30', '2.31', '2.32', '2.33', '2.34', '2.35', '2.36', '2.37', '2.38', '2.39']
2.0
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
2.10
2.11
2.12
2.13
2.14
2.15
2.16
2.17
2.18
2.19
2.20
2.21
2.22
2.23
2.24
2.25
2.26
2.27
2.28
2.29
2.30
2.31
2.32
2.33
2.34
2.35
2.36
2.37
2.38
2.39
fmt/11.0.0: Main binary package 'eafad8a7125e3266294c4a2cbe8f3373e6e2a785' missing
fmt/11.0.0: Checking 39 compatible configurations
fmt/11.0.0: Compatible configurations not found in cache, checking servers
fmt/11.0.0: '8f79c18cf917dd784543b0a7e7c41ada73225d54': os.libc.version=2.0
fmt/11.0.0: '295bb19a67909d5ff78ce348e7307ab8c2dbb0a3': os.libc.version=2.1
fmt/11.0.0: 'ab8c16cf32ed0d3dbc48f34e7439300a63f33ecc': os.libc.version=2.2
fmt/11.0.0: '197894ef1620f7945cfa9e0a3892c0bef55918e9':
fmt/11.0.0: 'ee19daa8c26f3836cd2e0eddd14a6d28b2653894': os.libc.version=2.4
fmt/11.0.0: 'aa4fb8da1c40531930e7e2560f55b5b57fb94d8f': os.libc.version=2.5
fmt/11.0.0: '17049a7dbd880274920911da527e702ff84b0032': os.libc.version=2.6
fmt/11.0.0: '6e2fd6901f3798beb01d2a8252bacbb7af04dc61': os.libc.version=2.7
fmt/11.0.0: '04469fe5ea0fc0ea650c8a9044be4f080022da5b': os.libc.version=2.8
fmt/11.0.0: '1efd15f72dec684ce6de6a3670fa73990395eb7e': os.libc.version=2.9
fmt/11.0.0: '500b7c8acbafeb17f541644bf543cf57b60ffb21': os.libc.version=2.10
fmt/11.0.0: '48c859127659dc43a04d2220cc03951bde1ee8cc': os.libc.version=2.11
fmt/11.0.0: '20cae635e9a4b925fde97c7a998e37aa39f05275': os.libc.version=2.12
fmt/11.0.0: '9952ff15cdc47857f6f752bfc3a11f0f1888f0ea': os.libc.version=2.13
fmt/11.0.0: 'bda3feba48a2bfcd2d4dafaed4265007e9c8fd26': os.libc.version=2.14
fmt/11.0.0: '9ef70e0bf9b6e15da206bb8e4105335aa217309a': os.libc.version=2.15
fmt/11.0.0: '87b106f214355ced9fb469bacab4862784a4b8c0': os.libc.version=2.16
fmt/11.0.0: 'd68ac9253db925c052536e668647b3b7b671b936': os.libc.version=2.17
fmt/11.0.0: 'ebd101d774103fee5128525d766832db2b12aa64': os.libc.version=2.18
fmt/11.0.0: '4ea2026a50f32fc5c182d6eaa472f501eb1ee5fa': os.libc.version=2.19
fmt/11.0.0: '4b74a93ada7aeb624d10beed73bbee4e4fb5d06f': os.libc.version=2.20
fmt/11.0.0: '8824541ff4e9d2c979b84470bbfa63fa69c073fe': os.libc.version=2.21
fmt/11.0.0: 'd8505431fe685055a57efddfaa77b9f2deac08f0': os.libc.version=2.22
fmt/11.0.0: '2d8387c59349860f616112a652a887a43fdefa5c': os.libc.version=2.23
fmt/11.0.0: '4819c09b7c4dc32791e7ffc9e68aa6beae2b4ecf': os.libc.version=2.24
fmt/11.0.0: 'b86b59718eb1f9a1fee2538f1fcfd79862ff407b': os.libc.version=2.25
fmt/11.0.0: '24c57359afc36fd7b790ee19851971816b8ded5d': os.libc.version=2.26
fmt/11.0.0: 'da33e20a24981ae51424b46d1275a90a9a2fae4f': os.libc.version=2.27
fmt/11.0.0: 'fdf59b56ddc917d493fbbc210e09530192512e83': os.libc.version=2.28
fmt/11.0.0: '160f1b278b20b10d4ab03eb9e2a321338192173c': os.libc.version=2.29
fmt/11.0.0: '1196af7c0add5cdd7144c221db0e961dadf7e98c': os.libc.version=2.30
fmt/11.0.0: '59a2d2c125872977cab4a55b5c5dc1b13f1350a8': os.libc.version=2.31
fmt/11.0.0: '8030d72e4e65dad348029ca491505ec7f4d4573c': os.libc.version=2.32
fmt/11.0.0: '353b1693573d9ee22978676459092338a39f37c4': os.libc.version=2.33
fmt/11.0.0: '8ccce8eda2efdc9516f7e48d79721d4b85c193a0': os.libc.version=2.34
fmt/11.0.0: '584fe6b02beb7608f6eb5766037061e3d640558d': os.libc.version=2.35
fmt/11.0.0: Found compatible package '584fe6b02beb7608f6eb5766037061e3d640558d': os.libc.version=2.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
responded Responded by Conan team type: question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants