mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Add the ability to install multiple versions (2.*, 3.*, 4.* ...) on the system simultaneously

Open winterheart opened this issue 1 year ago • 3 comments

Suggested enhancement

Hello, I'm maintaining the MbedTLS package on the Gentoo Linux system. We have multiple packages that still depend on MbedTLS 2, so in order to build them we need 2.* branches installed. Unfortunately, there are also a number of packages that already require newer version 3.*. We need to enhance the CMake buildsystem in a way that will allow us to have both 2 and 3 versions. By default, 2 and 3 cannot be installed simultaneously due path conflicts in lib and include directories.

Justification

Mbed TLS needs this because many packages still stick or are unable to migrate to 3 versions. We need a way to install both versions and let packages decide what to choose between them.

See also https://bugs.gentoo.org/805011 for actual problem and rationale.

winterheart avatar Jan 18 '24 22:01 winterheart

Hi,

I'm not familiar with the specifics of your situation , but would #8691 be relevant / solve this issue?

davidhorstmann-arm avatar Jan 19 '24 10:01 davidhorstmann-arm

@davidhorstmann-arm #8691 is relevant and pc-files should be tweaked in order to find libraries in custom locations.

My proposal is install 2.* into mbedtls2 path while 3.* - into mbedtls3. It should look this:

# Mbed TLS 2
/usr/lib64/mbedtls2/libmbedtls.so.2.28.6
/usr/lib64/mbedtls2/libmbedcrypto.so.2.28.6
/usr/lib64/mbedtls2/libmbedx509.so.2.28.6
# ...
/usr/include/mbedtls2/mbedtls/*.h
/usr/include/mbedtls2/psa/*.h
# Mbed TLS 3
/usr/lib64/mbedtls3/libmbedcrypto.so.3.5.1
/usr/lib64/mbedtls3/libmbedx509.so.3.5.1
/usr/lib64/mbedtls3/libmbedtls.so.3.5.1
/usr/lib64/mbedtls3/libeverest.so
/usr/lib64/mbedtls3/libp256m.so
# ...
/usr/include/mbedtls3/mbedtls/*.h
/usr/include/mbedtls3/psa/*.h
/usr/include/mbedtls3/everest/*.h
# Cmake modules should be named as MbedTLS3
/usr/lib/cmake/MbedTLS3/

Packages can compiles and links with -I/usr/include/mbedtls2 and -L/usr/lib64/mbedtls2 for version 2 and FindPackage(MbedTLS3) for version 3 in cmake project.

winterheart avatar Jan 19 '24 17:01 winterheart