StefanSalewski / rust-chess

Port of salewski-chess from Nim to Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not compile on Linux : solved (?)

tissatussa opened this issue · comments

as i stated in the Issue StefanSalewski/salewski-chess#4 of your "salewski-chess" project (=same engine in the Nim language) i was not able to compile your rust-chess engine on Linux (i'm on Xubuntu 22.04, called "Jammy Jellyfish") .. in one of the comments of this Issue you suggested to take a look at https://users.rust-lang.org/t/gtk4-example-graphics-code-please/109136/3 for a solution : indeed i have the same problem as user Austin .. he says my GTK4 version is 4.6.9 but 4.10 seems required .. so i did the same as he, i removed the option features = ["v4_12"] from the Cargo.toml file .. then compiling went well : i get a valid binary called rust-chess of 474.6 Kb in /target/release.

at https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_linux.html i found what's needed to compile :

Debian and derivatives: (=also Xubuntu)
sudo apt install libgtk-4-dev build-essential

when i look into my Synaptic package manager, i see my libgtk-4-dev version 4.6.9+ds-0ubuntu0.22.04.1, which is also mentioned at https://launchpad.net/ubuntu/+source/gtk4 for Jammy Jellyfish (22.04).

Note: at first i got some errors and texts which suggested things to change and install .. i think i have all of them, but not the environment variable PKG_CONFIG_PATH (on Linux we can show all environment variables by the command printenv) : one of the error texts said that i had to set this environment variable to the "parent path" of the file gtk4.pc, which i found in the folder /usr/lib/x86_64-linux-gnu/pkgconfig/ .. so i could do export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/ (which i tried at first) but this wasn't needed : without this the compiling also went OK : only removing the features option seems needed for me to solve the compile error(s).

more info :

$ rustc -V
rustc 1.79.0-nightly (c9f8f3438 2024-03-27)

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/roelof/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
1.64.0-x86_64-unknown-linux-gnu
1.69.0-x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (directory override for '/home/roelof/Compiled/rust-chess')
rustc 1.79.0-nightly (c9f8f3438 2024-03-27)

i don't know if Nightly is requierd .. i can try again with the stable Rust version ?

i get a valid binary called rust-chess of 474.6 Kb

Fine that you managed to compile it. Rust binaries are indeed large -- for Nim I managed two years ago to get a binary size of only 100k. But I think it has become better already, some years ago executable size was in the megabyte range. And note, that only the first compile takes that long in Rust, due to working incremental compilation a recompile is very fast. I will fix your issue and the unneeded "features" request in Cargo.toml soon.