October 24, 2024
Chicago 12, Melborne City, USA
PHP

Rust – 'Cargo install cargo-php' giving – linking with `cc` failed: exit status: 1


Rustc –version
rustc 1.78.0 (9b00956e5 2024-04-29)

cargo –version
cargo 1.78.0 (54d8815d0 2024-03-26)

OS – On WSL – Ubuntu 22.4

I am running the command Cargo install cargo-php And it throws the error.

Compiling ext-php-rs v0.12.0
error: linking with cc failed: exit status: 1

|
= note: LC_ALL="C" PATH="/home/ssuresh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/ssuresh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/ssuresh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:

now" "-Wl,-O1" "-Wl,–strip-debug" "-nodefaultlibs" "-rdynamic"
= note: /usr/bin/ld: /tmp/cargo-installQbAhTj/release/deps/libext_php_rs-b94e59a004df3e03.rlib(2e40c9e35e9506f4-wrapper.o): in function ext_php_rs_process_globals:
wrapper.c:(.text.ext_php_rs_process_globals+0x7): undefined reference to `core_globals’
/usr/bin/ld: /tmp/cargo-installQbAhTj/release/deps/libext_php_rs-b94e59a004df3e03.rlib(2e40c9e35e9506f4-wrapper.o): in function ext_php_rs_sapi_globals:

= note: some extern functions couldn’t be found; some native libraries may need to be installed or have their path specified
= note: use the -l flag to specify native libraries to link
= note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile cargo-php (bin "cargo-php") due to 1 previous error
error: failed to compile cargo-php v0.1.9, intermediate artifacts can be found at /tmp/cargo-installQbAhTj.
To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path

I tried with different versions of Rust and ran the rustup toolchain

rustup toolchain uninstall stable && rustup toolchain install stable ,

Installed sudo apt install libxcb-xfixes0-dev>

I Still see the same error.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video