qarmin / czkawka

Multi functional app to find duplicates, empty folders, similar images etc.
Other
20.35k stars 663 forks source link

Starfive VisionFive 2 compile of slint gui is slow, but the link is painfully slow #1218

Closed omac777 closed 1 month ago

omac777 commented 9 months ago

Bug Description To build the Slint-based Gui on Starfive VisionFive 2 is difficult to say the least. It's not a czkawka issue, but more of a progress report about porting czkawka to the VF2. The rust compiler on the VF2 is slow, but the rust linker is painfully slow. I started the build at 7pm roughly. It's 7am and it's still not completed. I believe all the compiling to object files is done within a couple of hours, but the linking duration is 6+ hours for whatever reason. The good news is that it does compile though. This build attempt was done on Fedora 40. I will try again on ArchLinux CWT30 image.

Steps to reproduce:

cd czkawka/
source ~/.cargo/env
cargo clean
time cargo +nightly build --release --verbose --verbose --verbose

Terminal output (optional):

   Compiling czkawka_gui v7.0.0 (/home/dmarceau/czkawka/czkawka_gui)
     Running `CARGO=/home/dmarceau/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/cargo CARGO_BIN_NAME=czkawka_gui CARGO_CRATE_NAME=czkawka_gui CARGO_MANIFEST_DIR=/home/dmarceau/czkawka/czkawka_gui CARGO_PKG_AUTHORS='Rafał Mi\
krut <mikrutrafal@protonmail.com>' CARGO_PKG_DESCRIPTION='GTK frontend of Czkawka' CARGO_PKG_HOMEPAGE='https://github.com/qarmin/czkawka' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=czkawka_gui CARGO_PKG_README=README.\
md CARGO_PKG_REPOSITORY='https://github.com/qarmin/czkawka' CARGO_PKG_RUST_VERSION=1.74.0 CARGO_PKG_VERSION=7.0.0 CARGO_PKG_VERSION_MAJOR=7 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAG\
E=1 CARGO_RUSTC_CURRENT_DIR=/home/dmarceau/czkawka LD_LIBRARY_PATH='/home/dmarceau/czkawka/target/release/deps:/home/dmarceau/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/lib:/home/dmarceau/.rustup/toolchains/nightly-riscv64gc-\
unknown-linux-gnu/lib' /home/dmarceau/.rustup/toolchains/nightly-riscv64gc-unknown-linux-gnu/bin/rustc --crate-name czkawka_gui --edition=2021 czkawka_gui/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-i\
ncompat --diagnostic-width=237 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' -C metadata=08733c91abef1210 -C extra-filename=-08733c91abef1210 --out-dir /home/dmarceau/czkawka/target/re\
lease/deps -C strip=debuginfo -L dependency=/home/dmarceau/czkawka/target/release/deps --extern chrono=/home/dmarceau/czkawka/target/release/deps/libchrono-dc6bae44224088d1.rlib --extern crossbeam_channel=/home/dmarceau/czkawka/target/re\
lease/deps/libcrossbeam_channel-671411effca177f9.rlib --extern czkawka_core=/home/dmarceau/czkawka/target/release/deps/libczkawka_core-4e7cc7bbab41028c.rlib --extern directories_next=/home/dmarceau/czkawka/target/release/deps/libdirector\
ies_next-f639c01059621b8e.rlib --extern fs_extra=/home/dmarceau/czkawka/target/release/deps/libfs_extra-4d4592ff42eba4ff.rlib --extern fun_time=/home/dmarceau/czkawka/target/release/deps/libfun_time-154bcfedde08d5a7.rlib --extern gdk4=/h\
ome/dmarceau/czkawka/target/release/deps/libgdk4-408375f1d9721474.rlib --extern glib=/home/dmarceau/czkawka/target/release/deps/libglib-55073509f943330a.rlib --extern gtk4=/home/dmarceau/czkawka/target/release/deps/libgtk4-90566696ad5a68\
83.rlib --extern handsome_logger=/home/dmarceau/czkawka/target/release/deps/libhandsome_logger-f4188d0849d36f03.rlib --extern humansize=/home/dmarceau/czkawka/target/release/deps/libhumansize-f2a0268e6b0d69ee.rlib --extern i18n_embed=/ho\
me/dmarceau/czkawka/target/release/deps/libi18n_embed-8f2025912ee3aefa.rlib --extern i18n_embed_fl=/home/dmarceau/czkawka/target/release/deps/libi18n_embed_fl-9083d7d500009c1b.so --extern image=/home/dmarceau/czkawka/target/release/deps/\
libimage-7c90e31bbb08a305.rlib --extern image_hasher=/home/dmarceau/czkawka/target/release/deps/libimage_hasher-79f2f5b8d3b4c8ac.rlib --extern log=/home/dmarceau/czkawka/target/release/deps/liblog-b181f943677fe9b8.rlib --extern once_cell\
=/home/dmarceau/czkawka/target/release/deps/libonce_cell-bba3fd2f150231c6.rlib --extern open=/home/dmarceau/czkawka/target/release/deps/libopen-0026dd42964860f0.rlib --extern rayon=/home/dmarceau/czkawka/target/release/deps/librayon-f0bb\
e062c84d7f99.rlib --extern regex=/home/dmarceau/czkawka/target/release/deps/libregex-a36923d6eded97ba.rlib --extern rust_embed=/home/dmarceau/czkawka/target/release/deps/librust_embed-ecd1a21301ad100a.rlib --extern trash=/home/dmarceau/c\
zkawka/target/release/deps/libtrash-91415ba9508c51be.rlib -L native=/usr/lib64`

It has been stuck there for at least 6 hours. UPDATE:

warning: `krokiet` (bin "krokiet") generated 1 warning
    Finished `release` profile [optimized] target(s) in 1028m 07s

real    1028m7.738s
user    1191m39.495s
sys     3m37.965s

System

cat /etc/os-release 
NAME="Fedora Linux"
VERSION="40 (Rawhide Prerelease)"
ID=fedora
VERSION_ID=40
VERSION_CODENAME=""
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Linux 40 (Rawhide Prerelease)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:40"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=rawhide
SUPPORT_END=2024-05-14

uname -a
Linux fedora-riscv 6.1.31 #1 SMP Wed Dec 27 21:23:03 -03 2023 riscv64 GNU/Linux

cat fedora-riscv-koji.repo
[fedora-riscv-koji]
name=Fedora RISC-V Koji
baseurl=http://fedora.riscv.rocks/repos/f40-build/latest/riscv64/
enabled=1
gpgcheck=0

cat fedora-riscv.repo
[fedora-riscv]
name=Fedora RISC-V
baseurl=http://fedora.riscv.rocks/repos-dist/f40/latest/riscv64/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
enabled=1
gpgcheck=0
qarmin commented 9 months ago

Slint generates big files and rustc have problems to properly optimize them.

Issue in rust repo - https://github.com/rust-lang/rust/issues/121354, the easiest workaround is to build only debug build or disable sroa optimization

omac777 commented 9 months ago

https://github.com/omac777/VF2-stuff I plunked the Fedora 40 VF2 binaries here just in case anybody wants to give them a try.

omac777 commented 9 months ago

btw if anybody wants to build this on the VF2, ArchLinux's VF2 maintainer cwt gave me a tip to configure rust for the VF2 cpu characteristics:

cat .cargo/config.toml 
[net]
git-fetch-with-cli = true

[profile.release]
opt-level = 3
debug = false
lto = 'thin'
strip = true

[target.riscv64gc-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=sifive-u74", "-C", "target-feature=+m,+a,+f,+d,+c,+zba,+zbb"]

cwt is a super-hero, let it be known!!!

qarmin commented 1 month ago

Looks like newest slint version fixed problem(at least partially)