cross icon indicating copy to clipboard operation
cross copied to clipboard

mqtt-paho not finding OpenSSL Library

Open SeaRoll opened this issue 6 months ago • 4 comments

I followed the guide for using openSSL with Docker since the first option did not work. I am trying to build for Raspberry Pi (64-bit)

Here's the dockerfile I used

aarch64.Dockerfile

FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
RUN dpkg --add-architecture arm64
RUN apt-get update && apt-get install --assume-yes libssl-dev:arm64

Cargo.toml

paho-mqtt = { version = "0.13.3", features = ["vendored-ssl"] }

Cross.toml

[target.aarch64-unknown-linux-gnu]
# pre-build = [
#   "dpkg --add-architecture arm64",
#   "apt-get update && apt-get install --assume-yes libssl-dev:arm64",
# ]
dockerfile = "aarch64.Dockerfile"

But this is the error:

error: failed to run custom build command for `paho-mqtt-sys v0.10.3`

Caused by:
  process didn't exit successfully: `/target/release/build/paho-mqtt-sys-237734db669160e4/build-script-build` (exit status: 101)
  --- stdout
  debug:Running the bundled build for Paho C
  cargo:rerun-if-changed=build.rs
  CMAKE_TOOLCHAIN_FILE_aarch64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_gnu = Some("/opt/toolchain.cmake")
  CMAKE_GENERATOR_aarch64-unknown-linux-gnu = None
  CMAKE_GENERATOR_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-unknown-linux-gnu = None
  CMAKE_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/yohan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/paho-mqtt-sys-0.10.3/paho.mqtt.c/" "-DCMAKE_C_STANDARD=99" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=on" "-DPAHO_WITH_UNIX_SOCKETS=on" "-DOPENSSL_ROOT_DIR=/target/aarch64-unknown-linux-gnu/release/build/openssl-sys-0700daa4cc0ba354/out/openssl-build/install" "-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain.cmake" "-DCMAKE_INSTALL_PREFIX=/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_BUILD_TYPE=Release"
  -- CMake version: 3.23.1
  -- CMake system name: Linux
  -- Timestamp is 2025-06-27T08:21:29Z
  -- Configuring incomplete, errors occurred!
  See also "/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out/build/CMakeFiles/CMakeOutput.log".

  --- stderr
  fatal: not a git repository (or any parent up to mount point /home/yohan)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  CMake Error at /usr/local/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
    system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
    OPENSSL_INCLUDE_DIR)
  Call Stack (most recent call first):
    /usr/local/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
    /usr/local/share/cmake-3.23/Modules/FindOpenSSL.cmake:578 (find_package_handle_standard_args)
    src/CMakeLists.txt:238 (find_package)



  thread 'main' panicked at /home/yohan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.54/src/lib.rs:1119:5:

  command did not execute successfully, got: exit status: 1

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

edit:

this is the following command I build with:

cross build --release --target aarch64-unknown-linux-gnu

SeaRoll avatar Jun 27 '25 08:06 SeaRoll

error: failed to run custom build command for paho-mqtt-sys v0.10.3

this means it's the build script failing, you'll need to also install libssl-dev for the host, so

apt-get update && apt-get install --assume-yes libssl-dev:arm64 libssl-dev

Emilgardis avatar Jun 27 '25 13:06 Emilgardis

Ah will try, thanks!

SeaRoll avatar Jun 27 '25 21:06 SeaRoll

error: failed to run custom build command for paho-mqtt-sys v0.10.3

this means it's the build script failing, you'll need to also install libssl-dev for the host, so

apt-get update && apt-get install --assume-yes libssl-dev:arm64 libssl-dev

So I tried it by updating dockerfile to:

FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
RUN dpkg --add-architecture arm64
RUN apt-get update && apt-get install --assume-yes libssl-dev:arm64 libssl-dev

That did not work, so I tried with doing it also to the host.

Still the same issue occurred

SeaRoll avatar Jun 27 '25 22:06 SeaRoll

Error output:

error: failed to run custom build command for `paho-mqtt-sys v0.10.3`

Caused by:
  process didn't exit successfully: `/target/release/build/paho-mqtt-sys-237734db669160e4/build-script-build` (exit status: 101)
  --- stdout
  debug:Running the bundled build for Paho C
  cargo:rerun-if-changed=build.rs
  CMAKE_TOOLCHAIN_FILE_aarch64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_gnu = Some("/opt/toolchain.cmake")
  CMAKE_GENERATOR_aarch64-unknown-linux-gnu = None
  CMAKE_GENERATOR_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-unknown-linux-gnu = None
  CMAKE_aarch64_unknown_linux_gnu = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/yohan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/paho-mqtt-sys-0.10.3/paho.mqtt.c/" "-DCMAKE_C_STANDARD=99" "-DPAHO_BUILD_SHARED=off" "-DPAHO_BUILD_STATIC=on" "-DPAHO_ENABLE_TESTING=off" "-DPAHO_HIGH_PERFORMANCE=on" "-DPAHO_WITH_SSL=on" "-DPAHO_WITH_UNIX_SOCKETS=on" "-DOPENSSL_ROOT_DIR=/target/aarch64-unknown-linux-gnu/release/build/openssl-sys-0700daa4cc0ba354/out/openssl-build/install" "-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain.cmake" "-DCMAKE_INSTALL_PREFIX=/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC" "-DCMAKE_BUILD_TYPE=Release"
  -- CMake version: 3.23.1
  -- CMake system name: Linux
  -- Timestamp is 2025-06-27T22:43:48Z
  -- Configuring incomplete, errors occurred!
  See also "/target/aarch64-unknown-linux-gnu/release/build/paho-mqtt-sys-ccc5fabb262ce0cb/out/build/CMakeFiles/CMakeOutput.log".

  --- stderr
  fatal: not a git repository (or any parent up to mount point /home/yohan)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  CMake Error at /usr/local/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
    system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
    OPENSSL_INCLUDE_DIR)
  Call Stack (most recent call first):
    /usr/local/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
    /usr/local/share/cmake-3.23/Modules/FindOpenSSL.cmake:578 (find_package_handle_standard_args)
    src/CMakeLists.txt:238 (find_package)



  thread 'main' panicked at /home/yohan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.54/src/lib.rs:1119:5:

  command did not execute successfully, got: exit status: 1

Same right?

SeaRoll avatar Jun 27 '25 22:06 SeaRoll