Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <AM0PR04MB56672EC6763A3E58DFC0C6B09D7F9@AM0PR04MB5667.eurprd04.prod.outlook.com>
Date: Fri, 24 Dec 2021 07:37:04 +0000
From: Timo Lange <la.ti@...look.de>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: [Question] Statically compile and link C++ against musl on Ubuntu
 (musl-gcc)

Hey there.
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.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.