Skip to content

Instantly share code, notes, and snippets.

@Binary-Eater
Last active May 5, 2025 01:51
Show Gist options
  • Save Binary-Eater/7e2c9c56be5c41ac510c797a8b7e5902 to your computer and use it in GitHub Desktop.
Save Binary-Eater/7e2c9c56be5c41ac510c797a8b7e5902 to your computer and use it in GitHub Desktop.
Non-NixOS Rust for Linux setup experience
new-user@pop-os:~/Documents/linux$ make rustavailable
***
*** Rust bindings generator 'bindgen' could not be found.
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
make[1]: *** [/home/new-user/Documents/linux/Makefile:1798: rustavailable] Error 1
make: *** [Makefile:251: __sub-make] Error 2
new-user@pop-os:~/Documents/linux$ cargo install bindgen-cli
new-user@pop-os:~/Documents/linux$ make rustavailable
***
*** Running 'bindgen' to check the libclang version (used by the Rust
*** bindings generator) failed with code 101. This may be caused by
*** a failure to locate libclang. See output and docs below for details:
***
thread 'main' panicked at /home/new-user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.71.1/lib.rs:604:27:
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: [])"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
make[1]: *** [/home/new-user/Documents/linux/Makefile:1798: rustavailable] Error 1
make: *** [Makefile:251: __sub-make] Error 2
new-user@pop-os:~/Documents/linux$ sudo apt install libclang-dev build-essentials
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package build-essentials
new-user@pop-os:~/Documents/linux$ sudo apt install libclang-dev
new-user@pop-os:~/Documents/linux$ make rustavailable
***
*** Source code for the 'core' standard library could not be found
*** at '/home/new-user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/lib.rs'.
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
make[1]: *** [/home/new-user/Documents/linux/Makefile:1798: rustavailable] Error 1
make: *** [Makefile:251: __sub-make] Error 2
new-user@pop-os:~/Documents/linux$ rustup component add rust-src
info: downloading component 'rust-src'
info: installing component 'rust-src'
new-user@pop-os:~/Documents/linux$ make rustavailable
Rust is available!
new-user@pop-os:~/Documents/linux$ make -j $(nproc) compile_commands.json
BINDGEN rust/uapi/uapi_generated.rs
error: Error loading target specification: target feature `soft-float` is incompatible with the ABI but gets enabled in target spec. Run `rustc --print target-list` for a list of built-in targets
# After rebase of rust-for-linux/rust-next
new-user@pop-os:~/Documents/linux$ make rustavailable
***
*** libclang (used by the Rust bindings generator 'bindgen') is too old.
*** Your version: 14.0.0
*** Minimum version: 15.0.0
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
make[1]: *** [/home/new-user/Documents/linux/Makefile:1815: rustavailable] Error 1
make: *** [Makefile:248: __sub-make] Error 2
new-user@pop-os:~/Documents/linux$ sudo apt install libclang-15-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libclang-common-15-dev libclang1-15
The following NEW packages will be installed:
libclang-15-dev libclang-common-15-dev libclang1-15
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 39.5 MB of archives.
After this operation, 360 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://apt.pop-os.org/ubuntu jammy-security/main amd64 libclang1-15 amd64 1:15.0.7-0ubuntu0.22.04.3 [7,012 kB]
Get:2 http://apt.pop-os.org/ubuntu jammy-security/main amd64 libclang-common-15-dev amd64 1:15.0.7-0ubuntu0.22.04.3 [5,988 kB]
Get:3 http://apt.pop-os.org/ubuntu jammy-security/main amd64 libclang-15-dev amd64 1:15.0.7-0ubuntu0.22.04.3 [26.5 MB]
Fetched 39.5 MB in 2s (21.3 MB/s)
Selecting previously unselected package libclang1-15.
(Reading database ... 258434 files and directories currently installed.)
Preparing to unpack .../libclang1-15_1%3a15.0.7-0ubuntu0.22.04.3_amd64.deb ...
Unpacking libclang1-15 (1:15.0.7-0ubuntu0.22.04.3) ...
Selecting previously unselected package libclang-common-15-dev.
Preparing to unpack .../libclang-common-15-dev_1%3a15.0.7-0ubuntu0.22.04.3_amd64.deb ...
Unpacking libclang-common-15-dev (1:15.0.7-0ubuntu0.22.04.3) ...
Selecting previously unselected package libclang-15-dev.
Preparing to unpack .../libclang-15-dev_1%3a15.0.7-0ubuntu0.22.04.3_amd64.deb ...
Unpacking libclang-15-dev (1:15.0.7-0ubuntu0.22.04.3) ...
Setting up libclang-common-15-dev (1:15.0.7-0ubuntu0.22.04.3) ...
Setting up libclang1-15 (1:15.0.7-0ubuntu0.22.04.3) ...
Setting up libclang-15-dev (1:15.0.7-0ubuntu0.22.04.3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.9) ...
new-user@pop-os:~/Documents/linux$ make rustavailable
Rust is available!
@Binary-Eater
Copy link
Author

https://lore.kernel.org/rust-for-linux/[email protected]/

I didn't have the above rebased into my tree as well, which was annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment