jemallocator icon indicating copy to clipboard operation
jemallocator copied to clipboard

Jemalloc-sys fails to build within docker

Open Firstyear opened this issue 3 years ago • 1 comments

When building inside a docker environment, jemalloc-sys fails to build. I'm not 100% sure if this is an issue in jemalloc-sys or jemalloc itself.

Proof of concept: https://github.com/Firstyear/jemallocator_build_docker

docker build .

Sending build context to Docker daemon   10.5MB
Step 1/6 : FROM opensuse/tumbleweed:latest
 ---> 4924d7532ace
Step 2/6 : RUN zypper -vv ref && 	zypper dup -y && 	zypper install -y 		cargo 		rust 		gcc 		bash
 ---> Using cache
 ---> 59b26627f325
Step 3/6 : COPY . /usr/src/demo
 ---> 29bbb73eb100
Step 4/6 : WORKDIR /usr/src/demo
 ---> Running in 5b8f4ec381ba
Removing intermediate container 5b8f4ec381ba
 ---> 709fc2dab885
Step 5/6 : RUN cargo build --release
 ---> Running in 7247482af628
   Compiling fs_extra v1.2.0
   Compiling cc v1.0.66
   Compiling libc v0.2.86
   Compiling jemalloc-sys v0.3.2
error: failed to run custom build command for `jemalloc-sys v0.3.2`

Caused by:
  process didn't exit successfully: `/usr/src/demo/target/release/build/jemalloc-sys-df3486eb4be3f3de/build-script-build` (exit code: 101)
  --- stdout
  TARGET=x86_64-unknown-linux-gnu
  HOST=x86_64-unknown-linux-gnu
  NUM_JOBS=8
  OUT_DIR="/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out"
  BUILD_DIR="/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/build"
  SRC_DIR="/usr/src/demo/vendor/jemalloc-sys"
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  CC="cc"
  CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC -m64 -Wall"
  JEMALLOC_REPO_DIR="jemalloc"
  JEMALLOC_SRC_DIR="/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc"
  cargo:rustc-cfg=prefixed
  --with-jemalloc-prefix=_rjem_
  running: "sh" "/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/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=/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out"
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: This script requires a shell more modern than all
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: the shells that I found on your system.
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: Please tell [email protected] about your system,
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: including any error possibly output before this
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: message. Then install a modern shell, or manually run
  /usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out/jemalloc/configure: the script under such a shell if you do have one.

  --- stderr
  thread 'main' panicked at 'command did not execute successfully: "sh" "/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/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=/usr/src/demo/target/release/build/jemalloc-sys-aa4a5c2372fb2439/out"
  expected success, got: exit code: 1', /usr/src/demo/vendor/jemalloc-sys/build.rs:392:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The command '/bin/sh -c cargo build --release' returned a non-zero code: 101

It it worth noting that if the dockerfile steps are taken manually (IE docker run -i -t opensuse/tumbleweed:latest) then you install the components and do the build it succeeds. It appears that something about the lack of interactivity may be causing the sh checker to fail.

cargo/rust version 1.49.0, jemalloc-sys 0.3.2

Firstyear avatar Feb 17 '21 08:02 Firstyear