Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.88k stars 481 forks source link

Cargo install failed #2989

Closed abdulalalalalala closed 3 months ago

abdulalalalalala commented 3 months ago

What is the current bug behavior?

Failed to install hurl via cargo, here is the error:

error: failed to run custom build command for `libxml v0.3.3`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installiBco6J/release/build/libxml-01d19effc1719f56/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBXML_2.0_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=LIBXML_2.0_STATIC
  cargo:rerun-if-env-changed=LIBXML_2.0_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

  --- stderr
  thread 'main' panicked at /home/alice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libxml-0.3.3/build.rs:38:5:
  Could not find libxml2.
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `hurl v4.3.0`, intermediate artifacts can be found at `/tmp/cargo-installiBco6J`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Steps to reproduce

cargo install hurl

What is the expected correct behavior?

Install hurl successfully

Execution context

N/A

Possible fixes

May be related to #361

jcamiel commented 3 months ago

Hi @abdulalalalalala

On which Linux distribution are you trying to build Hurl?

Can you check that you've followed build instructions for Linux on https://hurl.dev/docs/installation.html#build-on-linux?

abdulalalalalala commented 3 months ago

Hi @abdulalalalalala

On which Linux distribution are you trying to build Hurl?

Can you check that you've followed build instructions for Linux on https://hurl.dev/docs/installation.html#build-on-linux?

indeed. I'm on Fedora 40.

I looked at the dependencies and found libxml2-devel missing in system, which hurl's cargo installation method requires for compilation. After dnf install libxml2-devel, cargo was able to compile ok.

I guessing that may be because a rust lib libxml actually require the host's system to have libxml2-devel from both "hurl_core" and "hurl" workspaces. I think there is alternative to it called xml-rs that doesn't require host to install extra pkg. It can potentially make hurl to be more "distro agnostic"... but that seems way outside of scope to this issue i posted

jcamiel commented 3 months ago

Hi @abdulalalalalala

For the build on Fedora, we should update the docs https://hurl.dev/docs/installation.html#build-on-linux, I'm going to create an issue on that.

For libxml2, we use it for:

This PR #1910 can gives some context on performance gain using libxml2.