Riey / kime

Korean IME
GNU General Public License v3.0
522 stars 53 forks source link

kime can not complied at rustc 1.82(stable) #688

Open racagogi opened 2 weeks ago

racagogi commented 2 weeks ago
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?

nakoo commented 2 weeks ago

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
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;
Bot-wxt1221 commented 2 weeks ago

Are there any ways to fix it?

ehgus commented 1 week ago

Seems like this is caused by rust-lang/rust#128370