cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.3k stars 1.1k forks source link

Issue building with cargo #121

Closed NathanielPrescott closed 4 months ago

NathanielPrescott commented 4 months ago

Describe the bug

I first tried adding the pingora crate to a fresh project but was getting some errors around openssl-sys and libz-ng-sys. I've since pulled the pingora project down and am currently getting similar errors after installing the rust 1.72.1 version.

Pingora info

Please include the following information about your environment:

Pingora version: 0.1.0 (9308bec) Rust version: 1.72.1 Operating system version: Manjaro (Kernel 6.6.19-1)

Steps to reproduce

I'm just doing a 'cargo build' that fails on the above.

Expected results

I expected the build to complete failure free

Observed results

Build fails from: error: failed to run custom build command for libz-ng-sys v1.1.15 error: failed to run custom build command for openssl-sys v0.9.101

Additional context

Here is my build log

/usr/bin/cargo build --color=always --message-format=json-diagnostic-rendered-ansi --example client --manifest-path /home/nprescott/Documents/Projects/Github/pingora/pingora/Cargo.toml
   Compiling tokio-macros v2.2.0
   Compiling futures-macro v0.3.30
   Compiling serde_derive v1.0.197
   Compiling thiserror-impl v1.0.57
   Compiling openssl-sys v0.9.101
   Compiling regex v1.10.3
   Compiling rustls v0.21.10
   Compiling backtrace v0.3.69
   Compiling openssl-macros v0.1.1
   Compiling libz-ng-sys v1.1.15
   Compiling crossbeam-utils v0.8.19
   Compiling zstd-sys v1.6.2+zstd.1.5.1
   Compiling async-stream-impl v0.3.5
   Compiling http v1.1.0
   Compiling uname v0.1.1
   Compiling encoding_rs v0.8.33
error: failed to run custom build command for `libz-ng-sys v1.1.15`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
Caused by:
  process didn't exit successfully: `/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/libz-ng-sys-62cdc86db630cfde/build-script-build_zng` (exit status: 101)
  --- stdout
  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
  running: cd "/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/libz-ng-sys-10a3334b4541be7d/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/home/nprescott/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libz-ng-sys-1.1.15/src/zlib-ng" "-DBUILD_SHARED_LIBS=OFF" "-DZLIB_COMPAT=OFF" "-DZLIB_ENABLE_TESTS=OFF" "-DWITH_GZFILEOP=ON" "-DCMAKE_INSTALL_PREFIX=/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/libz-ng-sys-10a3334b4541be7d/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- Using CMake version 3.28.3
  -- ZLIB_HEADER_VERSION: 1.3.0
  -- ZLIBNG_HEADER_VERSION: 2.1.6
  -- Configuring incomplete, errors occurred!
  --- stderr
  CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1
  build script failed, must exit now', /home/nprescott/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
     1: core::panicking::panic_fmt
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
     2: cmake::fail
     3: cmake::run
     4: cmake::Config::build
     5: build_script_build_zng::build_zlib_ng
     6: build_script_build_zng::main
     7: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys v0.9.101`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
Caused by:
  process didn't exit successfully: `/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/openssl-sys-6ac894d0fb9db183/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
  AR_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
  AR_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
  ARFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
  ARFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_x86_64-unknown-linux-gnu
  RANLIB_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIB_x86_64_unknown_linux_gnu
  RANLIB_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIB
  HOST_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-unknown-linux-gnu
  RANLIBFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_unknown_linux_gnu
  RANLIBFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIBFLAGS
  HOST_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running cd "/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/openssl-sys-2b19167455886ffa/out/openssl-build/build/src" && AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/openssl-sys-2b19167455886ffa/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64"
  Configuring OpenSSL version 3.2.1 for target linux-x86_64
  Using os-specific seed configuration
  Created configdata.pm
  Running configdata.pm
  Created Makefile.in
  Created Makefile
  Created include/openssl/configuration.h
  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL.md file first)      ***
  ***                                                                ***
  **********************************************************************
  running cd "/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/openssl-sys-2b19167455886ffa/out/openssl-build/build/src" && "make" "depend"
  --- stderr
  thread 'main' panicked at '
  Error building OpenSSL dependencies:
      Command: cd "/home/nprescott/Documents/Projects/Github/pingora/target/debug/build/openssl-sys-2b19167455886ffa/out/openssl-build/build/src" && "make" "depend"
      Failed to execute: No such file or directory (os error 2)
      ', /home/nprescott/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.2.3+3.2.1/src/lib.rs:611:9
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
     1: core::panicking::panic_fmt
               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
     2: openssl_src::Build::run_command
     3: openssl_src::Build::build
     4: build_script_main::find_vendored::get_openssl
     5: build_script_main::find_openssl
     6: build_script_main::main
     7: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Process finished with exit code 101
LessThanGreaterThan commented 4 months ago

Hey, you need to have cmake and base-devel installed.

on Manjaro you can do it like this:

pacman -S cmake base-devel
NathanielPrescott commented 4 months ago

Oh wow I already had cmake but was missing base-devel

After installing base-devel it built with no issues, thank you