How to build system76 keyboard configurator with cargo on void? - linux

I've been trying to build the system 76 keyboard configurator (https://github.com/pop-os/keyboard-configurator) with cargo, but I keep getting the following error:
error: failed to run custom build command for 'system76-keyboard-configurator v1.3.0 (/home/myuser/source/keyboard-configurator)'
Caused by: process didn't exit successfully: '/home/myuser/source/keyboard-configurator/target/release/build/system76-keyboard-configurator-fcba57b6e3fa23d8/build-script-build' (exit status: 101) --- stderr thread 'main' panicked at 'called 'Result::unwrap()' on an 'Err' value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/myuser/.cargo/registry/src/github.com-1ecc6299db9ec823/gio-0.15.10/src/resource.rs:56:10 note: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...
I'm using void linux(GNU), so I installed the xbps equivalent packages of the dependencies (cargo gtk+3-devel hidapi-devel eudev-libudev-devel). I also have the necessary pkgconfig package. I've also tried to build the previous commit for release 1.3.0, to no success. I was expecting this to build, but I'm not sure what's going wrong. Does anyone know what could be wrong here?

the problem is on the 56th line of resource.rs as per the error message.
here is the panicking code in question
49 let status = Command::new("glib-compile-resources")
50 .arg("--sourcedir")
51 .arg(source_dir.as_ref())
52 .arg("--target")
53 .arg(&format!("{}/{}", out_dir, target))
54 .arg(gresource)
55 .status()
56 .unwrap();
this code builds a "glib-compile-resources" command, which is provided by glib-devel. this package is a dependency of libgtk-3-dev on debian as libglib2.0-dev, but not of gtk+3-devel on void, which explains why it isn't listed as a dependency.
the build should complete after installing glib-devel

Related

Rust flo_draw graphics library is not building

The issue I'm having are regarding a copy-pasted flo_draw example program. I am using vscode and the rust-anylizer extension. It tells me failed to run build scripts, check server logs for more information apon copying the code in. I don't know how to check these or what they are. Using cargo run from the terminal yields no better results.
I tried to copy in the code below:
// src.main.rs
use flo_draw::*;
use flo_draw::canvas::*;
fn main() {
with_2d_graphics(|| {
let canvas = create_canvas_window("Hello, world");
});
}
$ cargo run
Compiling futures v0.3.25
Compiling semver v0.11.0
Compiling flo_render_gl_offscreen v0.3.0
Compiling allsorts v0.5.1
Compiling winit v0.24.0
error: failed to run custom build command for `flo_render_gl_offscreen v0.3.0`
Caused by:
process didn't exit successfully: `/<path to program>/target/debug/build/flo_render_gl_offscreen-9d539a79f1cb257c/build-script-build` (exit status: 101)
\--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: \['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'\], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: \[\])"', /<path to home>/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/lib.rs:1959:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
flo_draw, or, more specifically, one of its dependencies, links to the external C library and therefore have to generate the matching API. This is done using bindgen, which requires clang to be installed in your system.
Installation instructions from the linked page:
Debian-based Linuxes
# apt install llvm-dev libclang-dev clang
Ubuntu 18.04 provides the necessary packages directly.
Arch
# pacman -S clang
Fedora
# dnf install clang-devel

VS Code error `failed to run build scripts` when using Rust-Analyzer only on one specific project

My company just switched on a new repo the Rust project I'm working on, to merge it with a Tauri project, and VS Code now gave me this error:
Failed to run build scripts
I can compile, run my project or use cargo check to see the warnings/error but Rust Analyzer is not working and it's very annoying for me to run cargo check every time i need to check my code.
This error occurs only on this repo, which contains a Rust workspace separate in two folders: one Tauri/Rust project and one basic Rust project.
Cargo.toml at the root:
[workspace]
members = [
"builder",
"studio/src-tauri"
]
Error details:
[ERROR rust_analyzer::lsp_utils] failed to run build scripts:
The following warnings were emitted during compilation:
error: failed to run custom build command for `cairo-sys-rs v0.15.1`
Caused by:
process didn't exit successfully: `/home/korocouille/Sogilis/IReflex/reflex2/target/debug/build/cairo-sys-rs-decf14405d906ced/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=CAIRO_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=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:warning=`"pkg-config" "--libs" "--cflags" "cairo" "cairo >= 1.14"` did not exit successfully: exit status: 1
error: could not find system library 'cairo' required by the 'cairo-sys-rs' crate
--- stderr
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
I tried to uninstall and re-install Rust-Analyzer, switch to pre-release or older version, delete my target folder, run a cargo clean cmd but nothing changed, and I can't find any solution.

Failed to run custom build command for `librocksdb-sys

Does anybody know what should I install to fulfill librocksdb-sys dependency? I was trying to solve it with apt install clang but does not solve the issue. My best guess is that it is some error connected with linking and/or versioning.
Appreciate any hints.
error: failed to run custom build command for librocksdb-sys v0.8.0+7.4.4
Caused by: process didn't exit successfully:
/home/tomek/ssd/workspaces/substrate/target/release/build/librocksdb-sys-dcab8f317e6498cb/build-script-build
(exit status: 101) --- stderr thread 'main' panicked at
'"enum_(unnamed_at_rocksdb/include/rocksdb/c_h_981_1)" is not a valid
Ident',
/home/tomek/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/fallback.rs:756:9
note: run with RUST_BACKTRACE=1 environment variable to display a
backtrace warning: build failed, waiting for other jobs to finish...
The error occurs on Debian.

trying to use the gstreamer-player rust crate, I get this pkg-config error

This is the full log
error: failed to run custom build command for `glib-sys v0.10.1`
Caused by:
process didn't exit successfully: `C:\Users\Wu\Documents\RustProjects\mechanical\target\debug\build\glib-sys-b6b5049ea9ffd484\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=GLIB_2.0_STATIC
cargo:rerun-if-env-changed=GLIB_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-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
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-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
Failed to run `"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.42"`: The system cannot find the file specified. (os error 2)
warning: build failed, waiting for other jobs to finish...
error: build failed
I have this error when I try to build my project (it's empty but it's using the gstreamer-player crate
I was told to install pkg-config (I'm on windows) so I used MSYS2 to install it with pacman -S mingw-w64-x86_64-pkg-config
The error persisted so I added the environment variable PKG_CONFIG_PATH = H:\MSYS2\usr\lib\pkgconfig, and I added H:\MSYS2\usr\lib\pkgconfig to the path variable
The error still persists, anyone has any idea of what I could do or what am I doing wrong? Any help appreciated

Cargo fails to compile rust-qml on Windows 10

I want to make a GUI application using Rust on Windows 10 and I found the qml crate which looks nice.
I added in my Cargo.toml file this dependency: qml = "0.0.9", but when I run cargo build, I get this error:
> cargo build
Compiling qml v0.0.9
error: failed to run custom build command for `qml v0.0.9`
process didn't exit successfully: `project\target\debug\build\qml-018515e4bf91189d\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'failed to execute process: The specified file cannot be found. (os error 2)', user\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\build.rs:28:33
note: Run with `RUST_BACKTRACE=1` for a backtrace.
I looked at the build.rs file and I saw this line:
fs::copy(Path::new(&manifest_dir).join("build_lib.sh"), Path::new(&out_dir).join("build_lib.sh")).unwrap();
Maybe I don't have the rights to do that on my account, so I tried to run it as admin, but cargo and rustc are installed in my user folder.
When I change the path, I get the error error: no default toolchain configured.
QML 0.0.9's build script doesn't support Windows.
It appears that support for Windows was added in 80ccad26, which seemingly hasn't been released yet.
You will need to use the version from the git repository instead:
[dependencies]
qml = { git = "https://github.com/White-Oak/qml-rust" }

Resources