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

build error where there shouldnt be #12935

Closed
makuru-org opened this issue Nov 8, 2023 · 7 comments
Closed

build error where there shouldnt be #12935

makuru-org opened this issue Nov 8, 2023 · 7 comments
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@makuru-org
Copy link

makuru-org commented Nov 8, 2023

Problem

I'll try to make a small project with slint but it errors out with message:

   compiling …
   Compiling slint-macros v1.2.2
   Compiling slint v1.2.2
error[E0463]: can't find crate for `slint_macros`
   --> /home/lenovo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/slint-1.2.2/lib.rs:202:9
    |
202 | pub use slint_macros::slint;
    |         ^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `slint` (lib) due to previous error

even though it is defined in cargo.toml

Steps

  1. Install Nixos
  2. copy my config (ask for it)
  3. run my project calculator.zip

Possible Solution(s)

No response

Notes

slint-ui/slint#3877

Version

cargo 1.73.0 (9c4383fb5 2023-08-26)
release: 1.73.0
commit-hash: 9c4383fb55986096b414d98125421ab87b5fd642
commit-date: 2023-08-26
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: NixOS 23.11.0 [64-bit]
@makuru-org makuru-org added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Nov 8, 2023
@epage
Copy link
Contributor

epage commented Nov 8, 2023

I downloaded the zip file and it wouldn't build because the build.rs needed slint_build. I uncommented that dependency and cargo check worked. This was with cargo 1.73.0 (9c4383fb5 2023-08-26) on a regular Linux distribution.

@ogoffart
Copy link

ogoffart commented Nov 8, 2023

I originally got this reported at slint-ui/slint#3877
I've never seen this error before and many user have been using the slint crate from crates.io without a problem. And the slint-macros crate is not even behind a feature flag.

Perhaps something to do with the NixOS environment which can be sometimes a bit special?

@weihanglo
Copy link
Member

I use Nix as a package manager on AWS Amazon Linux 2 and built your project flawlessly.

Not sure if it is relevant, but how did you install Rust on NixOS? Is it possible to share related nix env or settings?

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Nov 8, 2023
@makuru-org
Copy link
Author

  users.users.lenovo = {
    uid = 1001;
    isNormalUser = true;
    extraGroups = [ "wheel" "networkmanager" "libvirtd" "adbusers" ];
    packages = with pkgs; [
 
      ……………………
      # Development
      vscodium-fhs
      direnv
      python3Full
      rustup
      rust-analyzer
      gcc_multi
      pkg-config
      fontconfig
      android-studio
      qt6.full
      mesa
      libGLU
      slint-lsp

      # programming
      python311Packages.matplotlib
      python311Packages.numpy
      python311Packages.pyserial
      pylint
      openssl
      pkg-config
      
      ……………………
    ];
  };

@weihanglo
Copy link
Member

This issue might be relevant: rust-lang/rust#115073

It is happening because on Nix, we need to patch the binary's dynamic linker (.interp) and dynamic library search path (rpath/RUNPATH) so that they point at the Nix-specific values ...

@weihanglo
Copy link
Member

With nix-shell -p slint-lsp I can confirm it's slint-lsp that confuses rustc: https://github.com/NixOS/nixpkgs/blob/d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167/pkgs/development/tools/misc/slint-lsp/default.nix#L50

I am going to close this, as it is more like a NixOS specific behavior that might not be fixable on Cargo side. If possible, I would recommend installing it from cargo install slint-lsp as a workaround.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
@MilesConn
Copy link

Ran into a similar issue recently. My specific circumstances was I was using a flake.nix to setup my dev environment via nix develop. In my outside shell I didn't have rustup as I was using rust-overlay and develop flake I was using rustup. While this worked for a while it seems that adding rustup to my outside shell before running nix develop seemed to solve my issue.

cargo install

would not have worked as this was for building my own crates and the proc-macro in question was just a dependency.

Hope this helps someone! It was very strange and I'm not saying my issue is definitive by any means.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

5 participants