eclipse / paho.mqtt.rust

paho.mqtt.rust
Other
525 stars 102 forks source link

Running Rust in Docker container with paho_mqtt #201

Closed EvilWatermelon closed 1 year ago

EvilWatermelon commented 1 year ago

While trying to build a container I always get the following error:

error: failed to run custom build command for paho-mqtt-sys v0.8.0 (https://github.com/eclipse/paho.mqtt.rust.git?branch=master#8e1f7342)

Caused by:

process didn't exit successfully: `/project/target/release/build/paho-mqtt-sys-59b7aa0e8e96437c/build-script-build` (exit status: 101)

#0 98.15   --- stdout
#0 98.15   debug:Running the bundled build for Paho C
#0 98.15   cargo:rerun-if-changed=build.rs
#0 98.15   CMAKE_TOOLCHAIN_FILE_aarch64-unknown-linux-gnu = None
#0 98.15   CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_gnu = None
#0 98.15   HOST_CMAKE_TOOLCHAIN_FILE = None
#0 98.15   CMAKE_TOOLCHAIN_FILE = None
#0 98.15   CMAKE_GENERATOR_aarch64-unknown-linux-gnu = None
#0 98.15   CMAKE_GENERATOR_aarch64_unknown_linux_gnu = None
#0 98.15   HOST_CMAKE_GENERATOR = None
#0 98.15   CMAKE_GENERATOR = None
#0 98.15   CMAKE_PREFIX_PATH_aarch64-unknown-linux-gnu = None
#0 98.15   CMAKE_PREFIX_PATH_aarch64_unknown_linux_gnu = None
#0 98.15   HOST_CMAKE_PREFIX_PATH = None
#0 98.15   CMAKE_PREFIX_PATH = None
#0 98.15   CMAKE_aarch64-unknown-linux-gnu = None
#0 98.15   CMAKE_aarch64_unknown_linux_gnu = None
#0 98.15   HOST_CMAKE = None
#0 98.15   CMAKE = None
#0 98.15   running: cd "/whiz/target/release/build/paho-mqtt-sys-c1b0a80e2f02b97a/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/usr/local/cargo/git/checkouts/paho.mqtt.rust-44b07fd42c95bba6/8e1f734/paho-mqtt-sys/paho.mqtt.c/" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=on" "-DOPENSSL_ROOT_DIR=/usr" "-DCMAKE_INSTALL_PREFIX=/whiz/target/release/build/paho-mqtt-sys-c1b0a80e2f02b97a/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
#0 98.15 
#0 98.15   --- stderr
#0 98.15   thread 'main' panicked at '
#0 98.15   failed to execute command: No such file or directory (os error 2)
#0 98.15   is `cmake` not installed?

I'm running this command on an Apple Silicon Chip. Is this a paho_mqtt problem or a CMAKE only problem? It seems for me that mqtt can't find CMAKE.

fpagliughi commented 1 year ago

It needs a native CMake and a cross-compiler to be installed and on the path. The cross-compiler it's expecting sure seems to be aarch64-unknown-linux-gnu from the output above. But it appears to be complaining that it can't find the CMake executable.

EvilWatermelon commented 1 year ago

RUN apt-get update && apt-get -y install cmake at the beginning in my Dockerfile fixed it.