emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Unable to find musl-g++ #53

Closed insanitybit closed 5 years ago

insanitybit commented 6 years ago

I have a dependency on grpcio-sys, which is failing to build in the container with the following:

error: failed to run custom build command for `grpcio-sys v0.2.3`
process didn't exit successfully: `/home/rust/src/target/release/build/grpcio-sys-53b66955a325ba1b/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=grpc_wrap.c
cargo:rerun-if-changed=grpc
cargo:rerun-if-env-changed=GRPCIO_SYS_USE_PKG_CONFIG
running: "cmake" "/home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.2.3/grpc" "-DCMAKE_INSTALL_PREFIX=/home/rust/src/target/x86_64-unknown-linux-musl/release/build/grpcio-sys-0c674ae629d3b252/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_C_COMPILER=/usr/bin/musl-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -static" "-DCMAKE_CXX_COMPILER=musl-g++" "-DCMAKE_BUILD_TYPE=Release"
-- The CXX compiler identification is unknown
-- Configuring incomplete, errors occurred!
See also "/home/rust/src/target/x86_64-unknown-linux-musl/release/build/grpcio-sys-0c674ae629d3b252/out/build/CMakeFiles/CMakeOutput.log".
See also "/home/rust/src/target/x86_64-unknown-linux-musl/release/build/grpcio-sys-0c674ae629d3b252/out/build/CMakeFiles/CMakeError.log".

--- stderr
CMake Error at CMakeLists.txt:31 (project):
The CMAKE_CXX_COMPILER:

musl-g++

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.31/src/lib.rs:643:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
insanitybit commented 6 years ago

Solved by adding: sudo ln -s /bin/g++ /bin/musl-g++

emk commented 5 years ago

This may be worth adding to the container, I think, so I'm reopening it. At least to consider the idea.

insanitybit commented 5 years ago

That's fair - it'd actually be great if it were here, as I intend to have rust-musl-builder as a documented way to build a project I'm working on.

emk commented 5 years ago

Yes, upon consideration, I think this is a worthwhile addition to the upstream container, and I would happily merge a PR adding this, especially if it came with a confirmation that ./test-image still worked. :-)

insanitybit commented 5 years ago

I should be able to get a PR to you either tonight or this weekend. Thanks!

emk commented 5 years ago

Did we merge a PR to fix this? I can't remember off the top of my head, and I wanted to check with you before closing this.

insanitybit commented 5 years ago

Sorry - I think this completely slipped my mind.

This is the PR for this: https://github.com/emk/rust-musl-builder/pull/57

I can remove the Go stuff and just include the symlink.

emk commented 5 years ago

(This was merged a while ago, but I forgot to close the issue.)