Sign inSign up

openeuler/musl

Sponsored OSS

By openeuler

Updated 2 months ago

Image
0

4.5K

openeuler/musl repository overview

Quick reference

musl | openEuler

Current musl docker images are built on the openEuler. This repository is free to use and exempted from per-user rate limits.

musl is an implementation of the C standard library built on top of the Linux system call API, including interfaces defined in the base language standard, POSIX, and widely agreed-upon extensions. musl is lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safety.

Learn more about musl on musl Website⁠.

The tag of each musl docker image is consist of the version of musl and the version of basic image. The details are as follows

TagCurrentlyArchitectures
1.2.6-oe2403sp4musl 1.2.6 on openEuler 24.03-LTS-SP4amd64, arm64
1.2.6-oe2403sp3musl 1.2.6 on openEuler 24.03-LTS-SP3amd64, arm64
1.2.5-oe2403sp1musl 1.2.5 on openEuler 24.03-LTS-SP1amd64, arm64

Usage

In this usage, users can select the corresponding {Tag} based on their requirements.

  • Pull the openeuler/musl image from docker

    docker pull openeuler/musl:{Tag}
    
  • Run with an interactive shell

    You can start the container with an interactive shell to run your own code using musl.

    docker run -it --rm openeuler/musl:{Tag} bash
    
  • Write a Test Program (test.c)

    Create a file named test.c with the following content:

    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    
    int main() {
        printf("Hello, musl! (PID: %d)\n", getpid());
        
        // Test memory allocation (musl's malloc implementation)
        int *arr = malloc(10 * sizeof(int));
        if (!arr) {
            perror("malloc failed");
            return 1;
        }
        free(arr);
    
        // Detect C library
        #ifdef __GLIBC__
            printf("C library: glibc\n");
        #else
            printf("C library: musl\n");
        #endif
    
        return 0;
    }
    
  • Compilation Methods

    Static Compilation

    musl-gcc -static test.c -o static_app
    ./static_app
    

    Output:

    Hello, musl! (PID: 147)
    C library: musl
    

Question and answering

If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images.

Tag summary

Content type

Image

Digest

sha256:fb129b2c5

Size

173.9 MB

Last updated

2 months ago

docker pull openeuler/musl

This week's pulls

Pulls:

1

Last week