Describe the bug
The make command fails on Debian 12 (Bookworm):
include/jemalloc/internal/rtree.h:106:33: error: variably modified 'root' at file scope
106 | rtree_leaf_elm_t root[1U << (RTREE_NSB/RTREE_HEIGHT)];
| ^~~~
make[3]: *** [Makefile:479: src/jemalloc.sym.o] Error 1
/usr/bin/ld: cannot find ../deps/jemalloc/lib/libjemalloc.a: No such file or directory
To reproduce
- Create
Dockerfile:
FROM debian:bookworm
RUN apt update && apt install -y wget build-essential pkg-config
RUN wget https://github.com/redis/redis/archive/7.2.3.tar.gz \
&& tar xf 7.2.3.tar.gz \
&& cd redis-7.2.3 \
&& make
- Run
docker build .
Expected behavior
Build succeeds
Additional information
This may be related: https://github.com/jemalloc/jemalloc/issues/2318
Comment From: yossigo
@mhassan1 What hardware architecture are you building for? Can you include the jemalloc configure output?
Comment From: mhassan1
I am building for x86_64.
Here is the output of jemalloc configure:
cd jemalloc && ./configure --disable-cxx --with-version=5.3.0-0-g0 --with-lg-quantum=3 --disable-cache-oblivious --with-jemalloc-prefix=je_ CFLAGS="" LDFLAGS=""
checking for xsltproc... false
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether compiler is cray... no
checking whether compiler supports -std=gnu11... yes
checking whether compiler supports -Werror=unknown-warning-option... no
checking whether compiler supports -Wall... yes
checking whether compiler supports -Wextra... yes
checking whether compiler supports -Wshorten-64-to-32... no
checking whether compiler supports -Wsign-compare... yes
checking whether compiler supports -Wundef... yes
checking whether compiler supports -Wno-format-zero-length... yes
checking whether compiler supports -Wpointer-arith... yes
checking whether compiler supports -Wno-missing-braces... yes
checking whether compiler supports -Wno-missing-field-initializers... yes
checking whether compiler supports -Wno-missing-attributes... yes
checking whether compiler supports -pipe... yes
checking whether compiler supports -g3... yes
checking how to run the C preprocessor... gcc -E
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking size of void *... 8
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of intmax_t... 8
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking whether pause instruction is compilable... yes
checking number of significant virtual address bits... 0
checking for ar... ar
checking for nm... nm
checking for gawk... no
checking for mawk... mawk
checking for malloc.h... yes
checking whether malloc_usable_size definition can use const argument... no
checking for library containing log... -lm
checking whether __attribute__ syntax is compilable... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -fvisibility=hidden... no
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether tls_model attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether alloc_size attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether format(gnu_printf, ...) attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether format(printf, ...) attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether format(printf, ...) attribute is compilable... yes
checking whether compiler supports -Wimplicit-fallthrough... yes
checking whether fallthrough attribute is compilable... yes
checking whether compiler supports -Wimplicit-fallthrough... yes
checking whether compiler supports -Wimplicit-fallthrough... no
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether cold attribute is compilable... yes
checking whether vm_make_tag is compilable... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for ld... /usr/bin/ld
checking for autoconf... false
checking for memalign... yes
checking for valloc... yes
checking for malloc_size... no
checking whether compiler supports -O3... yes
checking whether compiler supports -O3... no
checking whether compiler supports -funroll-loops... yes
checking configured backtracing method... N/A
checking for sbrk... yes
checking whether utrace(2) is compilable... no
checking whether utrace(2) with label is compilable... no
checking whether a program using __builtin_unreachable is compilable... yes
checking whether a program using __builtin_ffsl is compilable... yes
checking whether a program using __builtin_popcountl is compilable... yes
checking LG_PAGE... 12
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for dlfcn.h... yes
checking for dlsym... yes
checking whether pthread_atfork(3) is compilable... yes
checking whether pthread_setname_np(3) is compilable... yes
checking whether pthread_getname_np(3) is compilable... yes
checking whether pthread_get_name_np(3) is compilable... no
checking for library containing clock_gettime... none required
checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable... yes
checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable... yes
checking whether mach_absolute_time() is compilable... no
checking whether clock_gettime(CLOCK_REALTIME, ...) is compilable... yes
checking whether compiler supports -Werror... yes
checking whether syscall(2) is compilable... yes
checking for secure_getenv... yes
checking for sched_getcpu... yes
checking for sched_setaffinity... yes
checking for issetugid... no
checking for _malloc_thread_cleanup... no
checking for _pthread_mutex_init_calloc_cb... no
checking for memcntl... no
checking for TLS... yes
checking whether C11 atomics is compilable... yes
checking whether GCC __atomic atomics is compilable... yes
checking whether GCC 8-bit __atomic atomics is compilable... yes
checking whether GCC __sync atomics is compilable... yes
checking whether GCC 8-bit __sync atomics is compilable... yes
checking whether Darwin OSAtomic*() is compilable... no
checking whether madvise(2) is compilable... yes
checking whether madvise(..., MADV_FREE) is compilable... yes
checking whether madvise(..., MADV_DONTNEED) is compilable... yes
checking whether madvise(..., MADV_DO[NT]DUMP) is compilable... yes
checking whether madvise(..., MADV_[NO]HUGEPAGE) is compilable... yes
checking whether madvise(..., MADV_[NO]CORE) is compilable... no
checking whether mprotect(2) is compilable... yes
checking for __builtin_clz... yes
checking whether Darwin os_unfair_lock_*() is compilable... no
checking whether glibc malloc hook is compilable... no
checking whether glibc memalign hook is compilable... no
checking whether pthreads adaptive mutexes is compilable... yes
checking whether compiler supports -D_GNU_SOURCE... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether strerror_r returns char with gnu source is compilable... yes
checking for _Bool... yes
checking for stdbool.h that conforms to C99... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating jemalloc.pc
config.status: creating doc/html.xsl
config.status: creating doc/manpages.xsl
config.status: creating doc/jemalloc.xml
config.status: creating include/jemalloc/jemalloc_macros.h
config.status: creating include/jemalloc/jemalloc_protos.h
config.status: creating include/jemalloc/jemalloc_typedefs.h
config.status: creating include/jemalloc/internal/jemalloc_preamble.h
config.status: creating test/test.sh
config.status: creating test/include/test/jemalloc_test.h
config.status: creating config.stamp
config.status: creating bin/jemalloc-config
config.status: creating bin/jemalloc.sh
config.status: creating bin/jeprof
config.status: creating include/jemalloc/jemalloc_defs.h
config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
config.status: creating test/include/test/jemalloc_test_defs.h
config.status: executing include/jemalloc/internal/public_symbols.txt commands
config.status: executing include/jemalloc/internal/private_symbols.awk commands
config.status: executing include/jemalloc/internal/private_symbols_jet.awk commands
config.status: executing include/jemalloc/internal/public_namespace.h commands
config.status: executing include/jemalloc/internal/public_unnamespace.h commands
config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
config.status: executing include/jemalloc/jemalloc_rename.h commands
config.status: executing include/jemalloc/jemalloc_mangle.h commands
config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
config.status: executing include/jemalloc/jemalloc.h commands
===============================================================================
jemalloc version : 5.3.0-0-g0
library revision : 2
CONFIG : --disable-cxx --with-version=5.3.0-0-g0 --with-lg-quantum=3 --disable-cache-oblivious --with-jemalloc-prefix=je_ CFLAGS= LDFLAGS=
CC : gcc
CONFIGURE_CFLAGS : -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 -O3 -funroll-loops
SPECIFIED_CFLAGS :
EXTRA_CFLAGS :
CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT
CXX :
CONFIGURE_CXXFLAGS :
SPECIFIED_CXXFLAGS :
EXTRA_CXXFLAGS :
LDFLAGS :
EXTRA_LDFLAGS :
DSO_LDFLAGS : -shared -Wl,-soname,$(@F)
LIBS : -lm -pthread
RPATH_EXTRA :
XSLTPROC : false
XSLROOT :
PREFIX : /usr/local
BINDIR : /usr/local/bin
DATADIR : /usr/local/share
INCLUDEDIR : /usr/local/include
LIBDIR : /usr/local/lib
MANDIR : /usr/local/share/man
srcroot :
abs_srcroot : /redis-7.2.3/deps/jemalloc/
objroot :
abs_objroot : /redis-7.2.3/deps/jemalloc/
JEMALLOC_PREFIX : je_
JEMALLOC_PRIVATE_NAMESPACE
: je_
install_suffix :
malloc_conf :
documentation : 1
shared libs : 1
static libs : 1
autogen : 0
debug : 0
stats : 1
experimental_smallocx : 0
prof : 0
prof-libunwind : 0
prof-libgcc : 0
prof-gcc : 0
fill : 1
utrace : 0
xmalloc : 0
log : 0
lazy_lock : 0
cache-oblivious : 0
cxx : 0
Comment From: yossigo
Looks like you're hitting the jemalloc/jemalloc#2318 issue indeed:
checking number of significant virtual address bits... 0
However, it's not clear why and I can reproduce this locally. You can probably work around this by passing explicit address bits configuration to jemalloc:
make JEMALLOC_CONFIGURE_OPTS=--with-lg-vaddr=48
Comment From: mhassan1
Thank you @yossigo. That workaround works. Would it make sense to add that flag in the Makefile?
Comment From: yossigo
@mhassan1 Having JEMALLOC_CONFIGURE_OPTS serves this exact purpose, I don't think we need a more specific flag.
Comment From: mhassan1
@yossigo I meant would it make sense to add that as a default flag to ./Configure so builders can just run make without specifying JEMALLOC_CONFIGURE_OPTS? I see we are already passing a bunch of default flags there.