jemalloc / jemalloc/jemalloc

Unable to build jemaloc using musl on Ubuntu aarch64

Open
#2,782 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.2k
Forks
1.6k
Avg merge
4d 8h
Merged PRs (30d)
13

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C11 atomics check in configure and the failed command recorded in config.log, then inspect include/jemalloc/internal/atomic.h to understand the selected support. Reproduce with aarch64-linux-musl-gcc on Ubuntu using the issue's commands. Done means jemalloc builds for aarch64 with musl without requiring CFLAGS=-mno-outline-atomics.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.