Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
racagogi opened this issue Nov 2, 2024 · 3 comments
Open

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

racagogi opened this issue Nov 2, 2024 · 3 comments

Comments

@racagogi
Copy link

racagogi commented Nov 2, 2024

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
Copy link
Contributor

nakoo commented Nov 4, 2024

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;

@Bot-wxt1221
Copy link

Are there any ways to fix it?

@ehgus
Copy link

ehgus commented Nov 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants