Questions tagged [musl]

A new standard library to power a new generation of Linux-based devices.

MUSL, a new standard library to power a new generation of Linux-based devices. MUSL is lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safety.
http://www.musl-libc.org/

149 questions
6
votes
3 answers

GCC is generating binaries filled with zeroes

I'm trying to figure out why the binaries generated by GCC are so large. Consider this empty program: int main() { return 0; } Now I build it with GCC 9.2.1 20190827 (Red Hat 9.2.1-1) and glibc 2.29 without any additional parameters: gcc -o…
Antti Laine
  • 139
  • 10
6
votes
0 answers

Symbol versioning on Alpine Linux

The musl C library has only an approximative implementation of symbol versioning. This can result in symbols being bound together that have different symbol versions, something which would not happen in a full implementation. Projects which expect…
Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
6
votes
0 answers

How do I build the Rust standard library with a custom musl?

I want to build static Rust executables with a customized version of musl. As a first step, I'm making myself familiar with Rust's build system. I took the slightly outdated docker-rust-musl GitHub project and updated URLs that went out-of-date.…
fzgregor
  • 1,807
  • 14
  • 20
6
votes
1 answer

linking to musl with other headers from /usr/include

I am trying to compile a program with x11 and use musl for the c library. I still have glibc on my system. Musl is located at /usr/local/musl/include The glib headers are still in /usr/include When I muild with musl-gcc test.c I get fatal error:…
Samuel
  • 1,073
  • 11
  • 22
6
votes
1 answer

failure to build rust-libc using cargo when rustc is musl-enabled

I successfully created a musl configured rustc by following this link My attempt to build a project (which builds fine using non-musl configured rust) failed when I used cargo rustc -- --target=x86_64-unknown-linux-musl 'error: could not find crate…
M Moadeli
  • 99
  • 6
5
votes
0 answers

errno without thread-local storage

I want to statically compile a program with tcc. tcc complains with error: Unknown relocation type: 23. This is apparently caused by my libc implementation (glibc 2.28-10) using thread-local storage to implement errno, which tcc does not support.…
Tom
  • 61
  • 1
  • 4
5
votes
1 answer

How do I override the libc in a Nix package to be musl?

I'm using Nix as a dependency manager for a Rust program. I have the following default.nix (simplified, but working): rec { pkgs = import {}; hello = pkgs.stdenv.mkDerivation rec { name = "rust-hello"; buildInputs = [ …
Julian Stecklina
  • 1,271
  • 1
  • 10
  • 24
5
votes
2 answers

How to build an executable that depends on curl for x86_64-unknown-linux-musl

I am on an amd64 Debian machine, and am trying to build a x86_64-unknown-linux-musl executable. I have this in my Cargo.toml: [dependencies] curl = "0.4" When I run cargo build --target=x86_64-unknown-linux-musl I get this: error: failed to run…
tshepang
  • 12,111
  • 21
  • 91
  • 136
4
votes
1 answer

Make can't run mkdir as root in Alpine Linux container

So, I'm trying to build musl-libc inside an Alpine Linux Docker container. The configure script succeeds, but make stops immediately because it can't run mkdir: mkdir -p lib make: mkdir: Operation not permitted make: *** [Makefile:96: lib] Error…
4
votes
1 answer

Static executable segfaults if location counter is initialized as too small or too large in linker script

I'm trying to generate a static executable for this program (with musl): main.S: .section .text .global main main: mov $msg, %rdi mov $0, %rax call printf mov %rax, %rdi mov $60, %rax syscall msg: .ascii "hello…
fctorial
  • 765
  • 1
  • 6
  • 11
4
votes
3 answers

Issues with time() when running a C musl application in docker container on arm

My application is unable to handle time operations like time(2) when it runs in alpine docker container on an arm device. What I have: I am building a native c application which is statically linked to musl with toolchain from musl.cc…
Thomas
  • 153
  • 9
4
votes
1 answer

"error: expected expression before struct" at macro argument to `offsetof` inside a macro function with musl

gcc throws following error with musl libc device_achat.c:192:29: error: expected expression before ‘struct’ return container_of(_iocb, struct ffs_request, iocb); ^~~~~~ device_achat.c:52:45: note: in definition of…
Necktwi
  • 2,483
  • 7
  • 39
  • 62
4
votes
1 answer

gdb won't load shared libs symbols, not even libc.so (musl), when loading a core file

I'm trying to debug a program running remotely on a board with a MIPS cpu, using musl for its libc. If I start gdbserver on the board, set the sysroot via set sysroot /path/to/sysroot and connect live from gdb, I get a meaningful stack trace (which…
Daniele
  • 410
  • 7
  • 19
4
votes
1 answer

Stopping linkage against GLIBC turning strftime into __strftime_l

I have an application which is normally built and executed using GLIBC. One of my users is attempting to use it on a platform built with the MUSL C library (which claims to be GLIBC compatible). When doing so they are getting an ldd symbol…
solidpixel
  • 10,688
  • 1
  • 20
  • 33
4
votes
1 answer

Build static binary with cgo, LuaJIT and musl

After reading Statically compiled Go programs, always, even with cgo, using musl I'm trying to use described method to statically link LuaJIT. Using https://github.com/aarzilli/golua go bindings Assuming musl and golua are already installed Go…
Michael
  • 481
  • 2
  • 6
  • 13
1
2
3
9 10