kime can not complied at rustc 1.82(stable)
error: could not compile `kime-indicator` (bin "kime-indicator") due to 1 previous error
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" VSLANG="1033" "cc" "-m64" "/tmp/rustcbCGtta/symbols.o" "/home/raca/kime/target/release/deps/kime_candidate_window-f0bb64628e16e99b.kime_candidate_window.1d85ad86b36a51d5-cgu.02.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/raca/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-7e3ac74759210e95.rlib" "-Wl,-Bdynamic" "-lkime_engine" "-ldl" "-lfreetype" "-lfreetype" "-lfontconfig" "-lexpat" "-lfreetype" "-ldl" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/usr/lib" "-L" "/usr/lib" "-L" "/usr/lib" "-L" "/usr/lib" "-L" "/home/raca/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/raca/kime/target/release/deps/kime_candidate_window-f0bb64628e16e99b" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
= note: /usr/bin/ld: cannot find -lkime_engine: No such file or directory
collect2: error: ld returned 1 exit status
This error occurs with rustc >= 1.82, but succeeds with version 1.81.
can add rust-toolchain.toml?
For NixOS users who use nixos-unstable branch, you might need to use rust-overlay since current nixpkgs version is 1.82.0.
module.nix
{ inputs, ... }:
{
nixpkgs.overlays = [
inputs.rust-overlay.overlays.default
(final: prev: {
kime = prev.callPackage ./package.nix {
inherit (final) rust-bin;
};
})
];
}
package.nix
diff --git a/package.nix b/package.nix
index 6d7759a..ac93671 100644
--- a/package.nix
+++ b/package.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, rustPlatform, rustc, cargo, fetchFromGitHub, pkg-config, cmake, extra-cmake-modules
+{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, cmake, extra-cmake-modules, rust-bin, makeRustPlatform
, withWayland ? true
, withIndicator ? true, dbus, libdbusmenu
, withXim ? true, xorg, cairo
@@ -15,6 +15,12 @@ let
++ lib.optionals withQt6 ["-DENABLE_QT6=ON"];
optFlag = w: (if w then "1" else "0");
+
+ rust181 = rust-bin.stable."1.81.0".default;
+ customRustPlatform = makeRustPlatform {
+ cargo = rust181;
+ rustc = rust181;
+ };
in
stdenv.mkDerivation (finalAttrs: {
pname = "kime";
@@ -97,10 +103,9 @@ stdenv.mkDerivation (finalAttrs: {
pkg-config
cmake
extra-cmake-modules
- rustPlatform.bindgenHook
- rustPlatform.cargoSetupHook
- rustc
- cargo
+ customRustPlatform.bindgenHook
+ customRustPlatform.cargoSetupHook
+ rust181
];
RUST_BACKTRACE = 1;
Are there any ways to fix it?
Seems like this is caused by rust-lang/rust#128370
here is a simple overlay for NixOS:
final: prev:
let
rustChannel = inputs.rust-overlay.packages.x86_64-linux.rust_1_81_0;
in
{
kime = prev.kime.override {
rustPlatform = prev.makeRustPlatform {
rustc = rustChannel;
cargo = rustChannel;
};
rustc = rustChannel;
cargo = rustChannel;
};
};
Seems like this is caused by rust-lang/rust#128370
I doubt it since the PR has already been merged into 1.82.0.
Please also see https://github.com/Riey/kime/issues/693#issuecomment-2612017513 .