From: Timo Lange <firstname.lastname@example.org>
To: "email@example.com" <firstname.lastname@example.org>
Subject: [musl] [Question] Statically compile and link C++ against musl on Ubuntu (musl-gcc)
Date: Fri, 24 Dec 2021 07:37:04 +0000 [thread overview]
Message-ID: <AM0PR04MB56672EC6763A3E58DFC0C6B09D7F9@AM0PR04MB5667.eurprd04.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]
I am currently compiling my C++ project against musl.
The reason is that I need a fully static executable and glibc does not seem to be suited for that case.
Currently I am doing the compilation inside an Alpine based Docker image. Using buildx and QEMU I also cross-compile for aarch64 - which is terribly slow.
Apart from that, the problem I am facing with this approach is that a few tools I want to use (static code analysis, FOSS scan, etc.) do not run under Alpine, as they require an Ubuntu loader.
Of course I tried making them run under Alpine but I feel this is not a proper solution. Anyhow I have failed so far.
So I came across musl-tools, resp. musl-gcc which is a wrapper around GCC on Ubuntu that "replaces" glibc libraries by musl. I am able to compile a simple C program with this, but not C++. It fails including any C++ header.
I assume it supports only C, as the name musl-gcc indicates.
Is there any way to compile a C++ program on Ubuntu entirely static (against musl)?
And if so, would this work with a "proper" amd64 -> aarch64 cross-compiler? So I could get rid of QEMU.
[-- Attachment #2: Type: text/html, Size: 2714 bytes --]
next reply other threads:[~2021-12-24 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-24 7:37 Timo Lange [this message]
2021-12-24 9:47 ` Markus Wichmann
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).