Skip to content

CMake error when compiling hello_bterm #376

@YacYac

Description

@YacYac

I'm trying to compile the hello_bterm example from Hands on Rust and I get the following compile error on Fedora 44.
I've tried using the respective bracket-lib and rust versions in the book of "~0.8.1" and "2018" and the current versions of "0.8.7" and "2024" and both produce the error.

   Compiling expat-sys v2.1.6
   Compiling wayland-commons v0.29.5
   Compiling thiserror-impl v1.0.69
   Compiling foreign-types-macros v0.2.3
   Compiling safe_arch v0.7.4
   Compiling x11-dl v2.21.0
   Compiling smithay-client-toolkit v0.16.1
   Compiling instant v0.1.13
   Compiling crossfont v0.5.2
   Compiling xcursor v0.3.10
error: failed to run custom build command for `expat-sys v2.1.6`

Caused by:
  process didn't exit successfully: `/home/claire/Projects/learn_rust/hands_on_rust/hello_bterm/target/debug/build/expat-sys-4600711f8898fd50/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=EXPAT_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=EXPAT_STATIC
  cargo:rerun-if-env-changed=EXPAT_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
  CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
  CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-linux-gnu = None
  CMAKE_x86_64_unknown_linux_gnu = None
  HOST_CMAKE = None
  CMAKE = None
  -- Configuring incomplete, errors occurred!

  --- stderr
  running: cd "/home/claire/Projects/learn_rust/hands_on_rust/hello_bterm/target/debug/build/expat-sys-150b40130a253b39/out/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "cmake" "/home/claire/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/expat-sys-2.1.6/expat" "-B" "/home/claire/Projects/learn_rust/hands_on_rust/hello_bterm/target/debug/build/expat-sys-150b40130a253b39/out/build" "-DBUILD_shared=OFF" "-DBUILD_tools=OFF" "-DBUILD_examples=OFF" "-DBUILD_tests=OFF" "-DCMAKE_INSTALL_PREFIX=/home/claire/Projects/learn_rust/hands_on_rust/hello_bterm/target/debug/build/expat-sys-150b40130a253b39/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  CMake Warning (dev) at CMakeLists.txt:4 (project):
    cmake_minimum_required() should be called prior to this top-level project()
    call.  Please see the cmake-commands(7) manual for usage documentation of
    both commands.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Error at CMakeLists.txt:6 (cmake_minimum_required):
    Compatibility with CMake < 3.5 has been removed from CMake.

    Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
    to tell CMake that the project requires at least <min> but has been updated
    to work with policies introduced by <max> or earlier.

    Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.



  thread 'main' (35815) panicked at /home/claire/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cmake-0.1.58/src/lib.rs:1132: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
warning: build failed, waiting for other jobs to finish...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions