tikv / jemallocator

Rust allocator using jemalloc as a backend
Other
332 stars 52 forks source link

Unable to build jemalloc-sys v0.3.0 #44

Open jmgilman opened 1 year ago

jmgilman commented 1 year ago

Hello,

I have a cargo project which has a dependency on jemalloc-sys v0.3.2. It's failing to build with the following error:

error: failed to run custom build command for `jemalloc-sys v0.3.0 (/tmp/jemallocator/jemalloc-sys)`

Caused by:
  process didn't exit successfully: `/tmp/jemallocator/target/debug/build/jemalloc-sys-6abc125e9e85e332/build-script-build` (exit status: 101)
  --- stdout
  TARGET=x86_64-unknown-linux-gnu
  HOST=x86_64-unknown-linux-gnu
  NUM_JOBS=32
  OUT_DIR="/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out"
  BUILD_DIR="/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/build"
  SRC_DIR="/tmp/jemallocator/jemalloc-sys"
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  CC="gcc"
  CFLAGS="-O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall"
  JEMALLOC_SRC_DIR="/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/jemalloc"
  cargo:rustc-cfg=prefixed
  --with-jemalloc-prefix=_rjem_
  running: "sh" "/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/jemalloc/configure" "--disable-cxx" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=x86_64-unknown-linux-gnu" "--build=x86_64-unknown-linux-gnu" "--prefix=/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out"
  checking for xsltproc... false
  checking for x86_64-unknown-linux-gnu-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 we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking whether compiler is cray... no
  checking whether compiler supports -std=gnu11... yes
  checking whether compiler supports -Wall... 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 -pipe... yes
  checking whether compiler supports -g3... yes
  checking how to run the C preprocessor... gcc -E
  checking for grep that handles long lines and -e... /nix/store/p7pqs5c4zfc4y977p626zch11msmmpj8-gnugrep-3.7/bin/grep
  checking for egrep... /nix/store/p7pqs5c4zfc4y977p626zch11msmmpj8-gnugrep-3.7/bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.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-unknown-linux-gnu
  checking host system type... x86_64-unknown-linux-gnu
  checking whether pause instruction is compilable... yes
  checking number of significant virtual address bits... 48
  checking for x86_64-unknown-linux-gnu-ar... ar
  checking for x86_64-unknown-linux-gnu-nm... nm
  checking for gawk... gawk
  checking malloc.h usability... yes
  checking malloc.h presence... yes
  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... yes
  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... no
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... yes
  checking whether format(gnu_printf, ...) attribute is compilable... no
  checking whether compiler supports -Werror... yes
  checking whether compiler supports -herror_on_warning... yes
  checking whether format(printf, ...) attribute is compilable... no
  checking for a BSD-compatible install... /nix/store/qarssrazji0q9xp80xg8shsm2crckfr0-coreutils-9.0/bin/install -c
  checking for x86_64-unknown-linux-gnu-ranlib... ranlib
  checking for ld... /nix/store/ykcrnkiicqg1pwls9kgnmf0hd9qjqp4x-gcc-wrapper-11.3.0/bin/ld
  checking for autoconf... false
  checking for memalign... yes
  checking for valloc... yes
  checking whether compiler supports -O3... yes
  checking whether compiler supports -O3... yes
  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 a program using __builtin_unreachable is compilable... yes
  checking whether a program using __builtin_ffsl is compilable... yes
  checking LG_PAGE... 12
  checking pthread.h usability... yes
  checking pthread.h presence... yes
  checking for pthread.h... yes
  checking for pthread_create in -lpthread... yes
  checking dlfcn.h usability... yes
  checking dlfcn.h presence... 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 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 compiler supports -Werror... yes
  checking whether syscall(2) is compilable... no
  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 TLS... yes
  checking whether C11 atomics is compilable... yes
  checking whether GCC __atomic atomics is compilable... yes
  checking whether GCC __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 to force 32-bit __sync_{add,sub}_and_fetch()... no
  checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
  checking for __builtin_clz... yes
  checking whether Darwin os_unfair_lock_*() is compilable... no
  checking whether Darwin OSSpin*() 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... no
  checking for stdbool.h that conforms to C99... yes
  checking for _Bool... 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: include/jemalloc/jemalloc_defs.h is unchanged
  config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
  config.status: include/jemalloc/internal/jemalloc_internal_defs.h is unchanged
  config.status: creating test/include/test/jemalloc_test_defs.h
  config.status: test/include/test/jemalloc_test_defs.h is unchanged
  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/internal/size_classes.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   : 0.1.4-202-gac731c575d359f20c43bc8fa09fc6e450770d76e
  library revision   : 2

  CONFIG             : --disable-cxx --with-jemalloc-prefix=_rjem_ --with-private-namespace=_rjem_ --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --prefix=/tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out build_alias=x86_64-unknown-linux-gnu host_alias=x86_64-unknown-linux-gnu CC=gcc 'CFLAGS=-O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall' 'LDFLAGS=-O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall' 'CPPFLAGS=-O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall' CXX=g++
  CC                 : gcc
  CONFIGURE_CFLAGS   : -std=gnu11 -Wall -Wsign-compare -Wundef -Wno-format-zero-length -pipe -g3 -fvisibility=hidden -O3 -funroll-loops
  SPECIFIED_CFLAGS   : -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall
  EXTRA_CFLAGS       :
  CPPFLAGS           : -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall -D_GNU_SOURCE -D_REENTRANT
  CXX                : g++
  CONFIGURE_CXXFLAGS : -fvisibility=hidden -O3
  SPECIFIED_CXXFLAGS :
  EXTRA_CXXFLAGS     :
  LDFLAGS            : -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -Wall
  EXTRA_LDFLAGS      :
  DSO_LDFLAGS        : -shared -Wl,-soname,$(@F)
  LIBS               : -lm  -lpthread
  RPATH_EXTRA        :

  XSLTPROC           : false
  XSLROOT            :

  PREFIX             : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out
  BINDIR             : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/bin
  DATADIR            : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/share
  INCLUDEDIR         : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/include
  LIBDIR             : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/lib
  MANDIR             : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/share/man

  srcroot            : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/jemalloc/
  abs_srcroot        : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/jemalloc/
  objroot            :
  abs_objroot        : /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/build/

  JEMALLOC_PREFIX    : _rjem_
  JEMALLOC_PRIVATE_NAMESPACE
                     : _rjem_je_
  install_suffix     :
  malloc_conf        :
  autogen            : 0
  debug              : 0
  stats              : 1
  prof               : 0
  prof-libunwind     : 0
  prof-libgcc        : 0
  prof-gcc           : 0
  fill               : 1
  utrace             : 0
  xmalloc            : 0
  log                : 0
  lazy_lock          : 0
  cache-oblivious    : 1
  cxx                : 0
  ===============================================================================
  running: "make" "srcroot=../jemalloc/" "-j" "32"

  --- stderr
  /nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash: /tmp/jemallocator/target/debug/build/jemalloc-sys-feb15dac31e82840/out/jemalloc/include/jemalloc/internal/size_classes.sh: No such file or directory
  make: *** No rule to make target 'build_lib', needed by 'all'.  Stop.
  thread 'main' panicked at 'command did not execute successfully: "make" "srcroot=../jemalloc/" "-j" "32"
  expected success, got: exit status: 2', jemalloc-sys/build.rs:370:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I will note that this is being run on a NixOS system, which is pretty opinionated about where things live. Normally I'm able to intuit what's missing from $PATH, but in this case I'm really not sure why it's failing. Any pointers would be appreciated.

I can reproduce it with less verbosity:

shell ❯ cd jemalloc-sys/jemalloc
shell ❯ make -f Makefile.in
make: *** No rule to make target 'build_lib', needed by 'all'.  Stop

I don't have much experience with make, so I'm not sure why it's not able to find the target:

shell ❯ cat Makefile.in | grep build_lib                                                                                                                                                   
all: build_lib
build_lib_shared: $(DSOS)
build_lib_static: $(STATIC_LIBS)
build_lib: build_lib_shared
build_lib: build_lib_static
BusyJay commented 1 year ago

Can you upload the Makefile after configure? It should be stored in "{rust-jemalloc-dir}/target/debug/build/jemalloc-sys-{hash}/out/build/Makefile".