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] How to use musl instead of glibc? #16179

Open
1 task done
AndreyMlashkin opened this issue Apr 30, 2024 · 2 comments
Open
1 task done

[question] How to use musl instead of glibc? #16179

AndreyMlashkin opened this issue Apr 30, 2024 · 2 comments
Assignees

Comments

@AndreyMlashkin
Copy link

What is your question?

I would like to use musl for all my dependency tree in a project. Is there any way how to archive that?
I am going to link it statically. I know, it may be against the best practices, but still there are reasons to do so.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this May 2, 2024
@memsharded
Copy link
Member

Hi @AndreyMlashkin

Thanks for your question.

Conan has no modeling of glibc or musl at the moment, so it is not possible to force using one or another glibc or musl via Conan. I guess that the recommendation is to configure the toolchain in a way that uses musl, what would be the recommended way to do this without Conan? How this is done via CMake, Meson or Autotools?

@Todiq
Copy link
Contributor

Todiq commented Jun 13, 2024

Hello @memsharded,

Would it be possible to add it to either to settings.yml or to global.conf?

I just hit an error with b2 refusing to run on Alpine Linux. I used the Docker image python:3.9.19-alpine3.20 with conan 2.4.1.

Here is the conanfile.txt:

[requires]
b2/5.2.0

And the profile:

[settings]
arch={{detect_api.detect_arch()}}
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=17
os=Linux

[conf]
tools.build:compiler_executables = {"c": "clang", "cpp": "clang++", "rc": "llvm-rc", "ar": "llvm-ar", "ld": "ld.lld"}
Log
/workspace $ conan install conanfile.txt -pr:a clang

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=17
os=Linux
[conf]
tools.build:compiler_executables={'c': 'clang', 'cpp': 'clang++', 'rc': 'llvm-rc', 'ar': 'llvm-ar', 'ld': 'ld.lld'}
cast*/*:tools.build:cxxflags=['-fansi-escape-codes -fcolor-diagnostics']
cast*/*:tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
cast*/*:tools.cmake.cmaketoolchain:generator=Ninja

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=17
os=Linux
[conf]
tools.build:compiler_executables={'c': 'clang', 'cpp': 'clang++', 'rc': 'llvm-rc', 'ar': 'llvm-ar', 'ld': 'ld.lld'}
cast*/*:tools.build:cxxflags=['-fansi-escape-codes -fcolor-diagnostics']
cast*/*:tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
cast*/*:tools.cmake.cmaketoolchain:generator=Ninja


======== Computing dependency graph ========
b2/5.2.0: Not found in local cache, looking in remotes...
b2/5.2.0: Checking remote: conancenter
b2/5.2.0: Downloaded recipe revision 4dc00a0e56fc6a4036c8f9fc0122a02e
Graph root
    conanfile.txt: /workspace/conanfile.txt
Requirements
    b2/5.2.0#4dc00a0e56fc6a4036c8f9fc0122a02e - Downloaded (conancenter)

======== Computing necessary packages ========
Requirements
    b2/5.2.0#4dc00a0e56fc6a4036c8f9fc0122a02e:63fead0844576fc02943e16909f08fcdddd6f44b#0640c5ac1ad653164b26d95a43ad0030 - Download (conancenter)

======== Installing packages ========

-------- Downloading 1 package --------
b2/5.2.0: Retrieving package 63fead0844576fc02943e16909f08fcdddd6f44b from remote 'conancenter'
b2/5.2.0: Package installed 63fead0844576fc02943e16909f08fcdddd6f44b
b2/5.2.0: Downloaded package revision 0640c5ac1ad653164b26d95a43ad0030
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: b2/5.2.0

======== Finalizing install (deploy, generators) ========
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished successfully

Although the installation went fine, trying to run b2 from the conan cache leads to a file not found error.

In fact, you have to apk add gcompat in order to run executables that are expected to use glibc.

However, I would have liked an option to trigger a recompilation, in order to support such cases natively (with musl). What do you think?

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

No branches or pull requests

3 participants