Skip to content

Unable to build jemaloc using musl on Ubuntu aarch64 #2782

Open

Description

@bazhenov

When trying to build jemalloc on aarch64 Ubuntu using musl, jemalloc could not determine appropriate atomic support.

Steps to reproduce:

# apt install musl-tools musl-dev
$ ./configure CC=aarch64-linux-musl-gcc
$ make
In file included from include/jemalloc/internal/jemalloc_internal_externs.h:5,
                 from include/jemalloc/internal/tsd_internals.h:11,
                 from include/jemalloc/internal/tsd_tls.h:7,
                 from include/jemalloc/internal/tsd.h:13,
                 from include/jemalloc/internal/ckh.h:5,
                 from include/jemalloc/internal/prof_structs.h:5,
                 from include/jemalloc/internal/jemalloc_internal_includes.h:51,
                 from src/jemalloc.c:2:
include/jemalloc/internal/atomic.h:22:4: error: #error "Don't have atomics implemented on this platform."
   22 | #  error "Don't have atomics implemented on this platform."
      |    ^~~~~

The problem, as far as I can understand, is that jemalloc configure script is not able to test atomic support. The following output is found in config.log

configure:14978: checking whether C11 atomics is compilable
configure:15008: aarch64-linux-musl-gcc -o conftest -std=gnu11 -Wall -Wextra -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -Wno
-missing-attributes -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -Wdeprecated-declarations -O3 -funroll-loops -D_GNU_SOURCE -D_REENTRANT  conftest.c -pthread >&5
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(lse-init.o): in function `init_have_lse_atomics':
(.text.startup+0x10): undefined reference to `__getauxval'
collect2: error: ld returned 1 exit status

It seems like a problem with out-of-line atomics support. I've tried to disable it using -mno-outline-atomics and it works:

$ ./configure CC=aarch64-linux-musl-gcc CFLAGS=-mno-outline-atomics

Can I somehow build jemalloc on aarch64 using musl without specifying CFLAGS=-mno-outline-atomics?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions