neXromancers/shotgun

Compiling png v0.16.8, error: failed to run custom build command for `x11 v2.18.2`

Closed this issue · 4 comments

I run cargo install shothun. Cargo was not able to finish installing it, I got the following
output:

Compiling png v0.16.8
error: failed to run custom build command for `x11 v2.18.2`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installcE9C7R/release/build/x11-50eac858fab6455f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=X11_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=X11_STATIC
  cargo:rerun-if-env-changed=X11_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
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=X11_STATIC
  cargo:rerun-if-env-changed=X11_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu
  cargo:rustc-link-lib=X11
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=X11_STATIC
  cargo:rerun-if-env-changed=X11_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
  cargo:rerun-if-env-changed=XRANDR_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=XRANDR_STATIC
  cargo:rerun-if-env-changed=XRANDR_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 'called `Result::unwrap()` on an `Err` value: Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"xrandr\" \"xrandr >= 1.5\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package xrandr was not found in the pkg-config search path.\nPerhaps you should add the directory containing `xrandr.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'xrandr' found\nPackage xrandr was not found in the pkg-config search path.\nPerhaps you should add the directory containing `xrandr.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'xrandr' found\n" } }', /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/x11-2.18.2/build.rs:36:67
  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 `shotgun v2.2.1`, intermediate artifacts can be found at `/tmp/cargo-installcE9C7R`

My environment: Ubuntu 20.04 LTS, gcc, pkg-config already installed. It fails only on Ubuntu, all is well when I install it on Arch. Am I missing any dependencies?

9ary commented

Yes, it's not very legible but the "thread panicked" line shows the error, looks like you're missing the "development" headers for (lib)xrandr. Arch doesn't split those into separate packages, but Ubuntu does, just like Debian and all of its other derivatives.
Maybe dependencies should be listed in the readme. Ideally we'd switch from the xlib-based x11 crate to x11rb which would eliminate non-rust dependencies, but that would require rewriting all X code (hopefully it's abstracted away nicely enough), and I don't have the motivation to do it since I don't use shotgun anymore (I use Wayland).

Following your suggestion sudo apt install -y libxrandr-dev && cargo install shotgun solved the matter.

9ary commented

Thanks! Leaving this open as a reminder to fix the readme.

9ary commented

Turns out the readme doesn't need fixing (see #26).