Scorpil / docker-rust

45 stars 8 forks source link

Can't build backtrace-sys, a dependency of error-chain #13

Open duelinmarkers opened 7 years ago

duelinmarkers commented 7 years ago

It's probably worth including in the docker image whatever it takes to build error-chain, which some consider the first dependency every rust app should add. It looks like it currently can't build due to backtrace-sys's build script wanting to use /usr/bin/file, but I haven't looked deeply into it.

I saw this failure in the CI build for a lib of mine. Here's the output of the failure.

Running with gitlab-ci-multi-runner 1.10.4 (b32125f)
Using Docker executor with image scorpil/rust:stable ...
Pulling docker image scorpil/rust:stable ...
Running on runner-e11ae361-project-1691053-concurrent-0 via runner-e11ae361-machine-1486217056-45afdcd8-digital-ocean-4gb...
Cloning repository...
Cloning into '/builds/duelinmarkers/steel-cent'...
Checking out 213d20a4 as master...
Skipping Git submodules setup
Checking cache for test:stable/master...
Successfully extracted cache
$ mkdir target || echo "target already existed"
$ mkdir cargo || echo "cargo already existed"
$ du -hs target && du -hs cargo
8.0K    target
8.0K    cargo
$ rustc --version && cargo --version
rustc 1.14.0 (e8a012324 2016-12-16)
cargo 0.15.0-nightly (298a012 2016-12-20)
$ time cargo test --verbose --jobs 1 --release
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading error-chain v0.8.1
 Downloading lazy_static v0.2.2
 Downloading backtrace v0.3.0
 Downloading kernel32-sys v0.2.2
 Downloading rustc-demangle v0.1.3
 Downloading dbghelp-sys v0.2.0
 Downloading backtrace-sys v0.1.6
 Downloading libc v0.2.20
 Downloading cfg-if v0.1.0
 Downloading winapi v0.2.8
 Downloading winapi-build v0.1.1
 Downloading gcc v0.3.43
 Downloading csv v0.14.7
 Downloading byteorder v0.5.3
 Downloading rustc-serialize v0.3.22
   Compiling byteorder v0.5.3
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-0.5.3/src/lib.rs --crate-name byteorder --crate-type lib -C opt-level=3 --cfg feature=\"default\" --cfg feature=\"std\" -C metadata=e4fc6ea0c49cabcf -C extra-filename=-e4fc6ea0c49cabcf --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling gcc v0.3.43
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.43/src/lib.rs --crate-name gcc --crate-type lib -C opt-level=3 -C metadata=be7b7587fd240ec9 -C extra-filename=-be7b7587fd240ec9 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling cfg-if v0.1.0
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.0/src/lib.rs --crate-name cfg_if --crate-type lib -C opt-level=3 -C metadata=72c1f992b13d5087 -C extra-filename=-72c1f992b13d5087 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling backtrace v0.3.0
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/build.rs --crate-name build_script_build --crate-type bin -C opt-level=3 --cfg feature=\"coresymbolication\" --cfg feature=\"kernel32-sys\" --cfg feature=\"dladdr\" --cfg feature=\"winapi\" --cfg feature=\"dbghelp-sys\" --cfg feature=\"backtrace-sys\" --cfg feature=\"default\" --cfg feature=\"dbghelp\" --cfg feature=\"libunwind\" --cfg feature=\"libbacktrace\" -C metadata=4d922e79d0b3f0f4 --out-dir /builds/duelinmarkers/steel-cent/target/release/build/backtrace-4d922e79d0b3f0f4 --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling winapi-build v0.1.1
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1/src/lib.rs --crate-name build --crate-type lib -C opt-level=3 -C metadata=493a7b0628804707 -C extra-filename=-493a7b0628804707 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling rustc-demangle v0.1.3
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.3/src/lib.rs --crate-name rustc_demangle --crate-type lib -C opt-level=3 -C metadata=9f84838926c47318 -C extra-filename=-9f84838926c47318 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling kernel32-sys v0.2.2
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2/build.rs --crate-name build_script_build --crate-type bin -C opt-level=3 -C metadata=d6afa5bd3d7cfaef --out-dir /builds/duelinmarkers/steel-cent/target/release/build/kernel32-sys-d6afa5bd3d7cfaef --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --extern build=/builds/duelinmarkers/steel-cent/target/release/deps/libbuild-493a7b0628804707.rlib --cap-lints allow`
     Running `/builds/duelinmarkers/steel-cent/target/release/build/kernel32-sys-d6afa5bd3d7cfaef/build-script-build`
   Compiling libc v0.2.20
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.20/src/lib.rs --crate-name libc --crate-type lib -C opt-level=3 --cfg feature=\"use_std\" --cfg feature=\"default\" -C metadata=29ef97a68464c2b7 -C extra-filename=-29ef97a68464c2b7 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling dbghelp-sys v0.2.0
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/dbghelp-sys-0.2.0/build.rs --crate-name build_script_build --crate-type bin -C opt-level=3 -C metadata=63f6e37cae1a7d6b --out-dir /builds/duelinmarkers/steel-cent/target/release/build/dbghelp-sys-63f6e37cae1a7d6b --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --extern build=/builds/duelinmarkers/steel-cent/target/release/deps/libbuild-493a7b0628804707.rlib --cap-lints allow`
     Running `/builds/duelinmarkers/steel-cent/target/release/build/dbghelp-sys-63f6e37cae1a7d6b/build-script-build`
     Running `/builds/duelinmarkers/steel-cent/target/release/build/backtrace-4d922e79d0b3f0f4/build-script-build`
   Compiling winapi v0.2.8
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.2.8/src/lib.rs --crate-name winapi --crate-type lib -C opt-level=3 -C metadata=0889532d327ff4e2 -C extra-filename=-0889532d327ff4e2 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/dbghelp-sys-0.2.0/src/lib.rs --crate-name dbghelp --crate-type lib -C opt-level=3 -C metadata=72843bd5c387f78b -C extra-filename=-72843bd5c387f78b --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --extern winapi=/builds/duelinmarkers/steel-cent/target/release/deps/libwinapi-0889532d327ff4e2.rlib --cap-lints allow`
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2/src/lib.rs --crate-name kernel32 --crate-type lib -C opt-level=3 -C metadata=df86a08647459244 -C extra-filename=-df86a08647459244 --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --extern winapi=/builds/duelinmarkers/steel-cent/target/release/deps/libwinapi-0889532d327ff4e2.rlib --cap-lints allow`
   Compiling lazy_static v0.2.2
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.2/src/lib.rs --crate-name lazy_static --crate-type lib -C opt-level=3 -C metadata=7f1b96a3a3eb529d -C extra-filename=-7f1b96a3a3eb529d --out-dir /builds/duelinmarkers/steel-cent/target/release/deps --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --cap-lints allow`
   Compiling backtrace-sys v0.1.6
     Running `rustc cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/build.rs --crate-name build_script_build --crate-type bin -C opt-level=3 -C metadata=e84e02e57cb850a4 --out-dir /builds/duelinmarkers/steel-cent/target/release/build/backtrace-sys-e84e02e57cb850a4 --emit=dep-info,link -L dependency=/builds/duelinmarkers/steel-cent/target/release/deps --extern gcc=/builds/duelinmarkers/steel-cent/target/release/deps/libgcc-be7b7587fd240ec9.rlib --cap-lints allow`
     Running `/builds/duelinmarkers/steel-cent/target/release/build/backtrace-sys-e84e02e57cb850a4/build-script-build`
error: failed to run custom build command for `backtrace-sys v0.1.6`
process didn't exit successfully: `/builds/duelinmarkers/steel-cent/target/release/build/backtrace-sys-e84e02e57cb850a4/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
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
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("release")
running: "/builds/duelinmarkers/steel-cent/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/configure" "--with-pic" "--disable-multilib" "--disable-shared" "--disable-host-shared" "--target=x86_64-unknown-linux-gnu" "--host=x86_64-unknown-linux-gnu"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for x86_64-unknown-linux-gnu-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-unknown-linux-gnu-gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking for gawk... (cached) mawk
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for x86_64-unknown-linux-gnu-dumpbin... no
checking for x86_64-unknown-linux-gnu-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-unknown-linux-gnu-ar... no
checking for ar... ar
checking for x86_64-unknown-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-unknown-linux-gnu-ranlib... ranlib
checking command to parse nm output from cc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether cc supports -W... yes
checking whether cc supports -Wall... yes
checking whether cc supports -Wwrite-strings... yes
checking whether cc supports -Wstrict-prototypes... yes
checking whether cc supports -Wmissing-prototypes... yes
checking whether cc supports -Wold-style-definition... yes
checking whether cc supports -Wmissing-format-attribute... yes
checking whether cc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... yes
checking __sync extensions... yes
checking __atomic extensions... yes
checking output filetype... elf64
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gstdint.h... stdint.h (already complete)
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking for mmap... yes
checking link.h usability... yes
checking link.h presence... yes
checking for link.h... yes
checking for dl_iterate_phdr... yes
checking for fcntl... yes
checking whether strnlen is declared... yes
checking for getexecname... no
checking whether tests can run... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating backtrace-supported.h
config.status: creating config.h
config.status: executing libtool commands
config.status: executing gstdint.h commands
config.status: executing default commands
running: "make" "INCDIR=/builds/duelinmarkers/steel-cent/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace"

--- stderr
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
/builds/duelinmarkers/steel-cent/cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/src/libbacktrace/configure: line 6897: /usr/bin/file: No such file or directory
thread 'main' panicked at 'failed to get status: No such file or directory (os error 2)', cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-sys-0.1.6/build.rs:91
note: Run with `RUST_BACKTRACE=1` for a backtrace.

ERROR: Build failed: exit code 1
logaritmisk commented 7 years ago

I have the same issue, and my first thought was to install missing dependencies using "before_script" (I'm also using Gitlab CI). But unfortunately it seems I can't do that because this rm -rf /var/lib/apt/lists/*.

Is that necessary? Or is there another way to install packages?

dovahcrow commented 7 years ago

@logaritmisk @duelinmarkers using jimmycuadra/rust solves the issue. Basically, scorpil/rust lacks of make installed