rust-analyzer: proc macro `Deserialize` not expanded: Cannot create expander for libserde_derive: UnsupportedABI

rust-analyzer version: 0.3.1277-standalone

rustc version: 1.65.0 (897e37553 2022-11-02)

relevant settings: –

rustup show:

Default host: x86_64-unknown-linux-gnu
rustup home:  $HOME/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.65.0 (897e37553 2022-11-02)

I’m getting the following error message with serde:

proc macro `Deserialize` not expanded: Cannot create expander for <project>/target/debug/deps/libserde_derive-a150df8d26d00fd1.so: UnsupportedABI

I’ve already cleaned and recompiled the project. Building and cargo check works fine.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like your project is compiled with a rustc installed from the arch linux package repos. This version is incompatible with a rustc from rustup. Does /usr/libexec/rust-analyzer-proc-macro-srv exist? If so rust-analyzer probably gets confused and thinks it needs to load the rust-analyzer-proc-macro-srv from rustup. If not rust-analyzer may have picked the right rustc, but fails anyway as arch linux doesn’t ship the proc macro server. In either case compiling using the rustup distributed version of rustc (by putting ~/.cargo/bin before /usr/bin in your PATH or by removing the arch linux installed rustc) should solve your issues.

I think we should try and make that error message more helpful by printing expected abi vs found one etc.

@heftig I see. I guess we could move it to lib/rustlib/x86_64-unknown-linux-gnu/libexec (or .../bin). In any case it would have been nice if you informed us about the incompatibility with the arch linux packaging rules. The sole purpose of rust-analyzer-proc-macro-srv is to make any (recent) rust-analyzer version (including those distributed in the vscode extension) work with with any (recent) rustc version independent of who built it. This requires at a minimum a well known location that is independent of the entity packaging rust or rust-analyzer. Had we known that arch linux doesn’t allow /usr/libexec, I’m sure we would have chosen a location that does work for everyone involved.

Arch doesn’t have a /usr/libexec at all.

This is the issue: https://github.com/archlinux/svntogit-packages/blob/packages/rust/trunk/0001-bootstrap-Change-libexec-dir.patch Arch linux decided to move rust-analyzer-proc-macro-srv from libexec to lib, breaking rust-analyzer. @heftig why does arch linux change libexec to lib for rust-analyzer-proc-macro-srv?