williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.8k stars 273 forks source link

asm-lsp compile socket2 #580

Closed kawaegle closed 1 year ago

kawaegle commented 2 years ago

I've searched open issues for similar requests

Yes

I've recently downloaded the latest plugin version of mason.nvim

Problem description

when I try to install asm-lsp on my computer (Arch 6-0-2) with latest mason and cargo (1.64.0) I get a compile error

Expected behavior

just to install asm-lsp with mason install asm-lsp

Affected packages

asm-lsp

Mason output

No response

Installation log

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types                                                                     │                   
~                    │         --> /home/kawaegle/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.12/src/sockaddr.rs:176:9                                                      │                   
~                    │          |                                                                                                                                                           │                   
~                    │      176 |         mem::transmute::<SocketAddrV4, sockaddr_in>(v4);                                                                                                  │                   
~                    │          |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                       │                   
~                    │          |                                                                                                                                                           │                   
~                    │          = note: source type: `SocketAddrV4` (48 bits)                                                                                                               │                   
~                    │          = note: target type: `sockaddr_in` (128 bits)                                                                                                               │                   
~                    │                                                                                                                                                                      │                   
~                    │      For more information about this error, try `rustc --explain E0512`.                                                                                             │                   
~                    │      error: could not compile `socket2` due to previous error                                                                                                        │                   
~                    │      warning: build failed, waiting for other jobs to finish...                                                                                                      │                   
~                    │      error: failed to compile `asm-lsp v0.2.0`, intermediate artifacts can be found at `/tmp/cargo-installvSzIkf`                                                    │                   
~                    │      spawn: cargo failed with exit code 101 and signal 0.                                                                                                            │                   
~                    │

Neovim version (>= 0.7)

NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by builduser

Operating system/version

NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by builduser

Healthcheck

1 ↓
  2   mason:·require("mason.health").check()↓
    1 ========================================================================↓
    2 ##·mason.nvim·report↓
    3 ··-·OK:·neovim·version·>=·0.7.0↓
    4 ··-·OK:·Go:·`go·version·go1.19.2·linux/amd64`↓
    5 ··-·OK:·cargo:·`cargo·1.64.0`↓
    6 ··-·OK:·luarocks:·`/sbin/luarocks·3.9.1`↓
    7 ··-·OK:·Ruby:·`ruby·3.0.4p208·(2022-04-12·revision·3fa771dded)·[x86_64-linux]`↓
    8 ··-·OK:·RubyGem:·`3.3.23`↓
    9 ··-·WARNING:·Composer:·not·available↓
   10 ··-·WARNING:·PHP:·not·available↓
   11 ··-·OK:·npm:·`8.19.2`↓
   12 ··-·OK:·node:·`v19.0.0`↓
   13 ··-·OK:·python3:·`Python·3.10.8`↓
   14 ··-·OK:·pip3:·`pip·22.3·from·/usr/lib/python3.10/site-packages/pip·(python·3.10)`↓
   15 ··-·OK:·javac:·`javac·19.0.1`↓
   16 ··-·OK:·java:·`openjdk·version·"19.0.1"·2022-10-18`↓
   17 ··-·WARNING:·julia:·not·available↓
   18 ··-·OK:·wget:·`GNU·Wget·1.21.3·built·on·linux-gnu.`↓
   19 ··-·OK:·curl:·`curl·7.85.0·(x86_64-pc-linux-gnu)·libcurl/7.85.0·OpenSSL/1.1.1q·zlib/1.2.13·              brotli/1.0.9·zstd/1.5.2·libidn2/2.3.3·libpsl/0.21.1·(+libidn2/2.3.0)·libssh2/1.10.0·nghttp2/1.         50.0`↓
   20 ··-·OK:·gzip:·`gzip·1.12`↓
   21 ··-·OK:·tar:·`tar·(GNU·tar)·1.34`↓
   22 ··-·OK:·bash:·`GNU·bash,·version·5.1.16(1)-release·(x86_64-pc-linux-gnu)`↓
   23 ··-·OK:·sh:·`Ok`↓
   24 ··-·ERROR:·GitHub·API·rate·limit·exceeded.·Used:·60.·Remaining:·0.·Limit:·60.·Reset:·Thu·Oct·20·         11:54:27·2022.↓
   25 ↓

Screenshots

No response

jinzhongjia commented 1 year ago

i also meet this error

NoahHakansson commented 1 year ago

Also encountered this.

jinzhongjia commented 1 year ago

now, I have found the reason which cause installer failure! mason use the mason-core.managers.cargo to install asm-lsp, in the last, installer work fine Due to the use of lock, some versions corresponding to dependencies are now missing, Only need to specify the command cargo install --root . asm-lsp when installing , it will compile successfully. But it's not clear to me which function of mason should be called, Can you help us? @williamboman

jinzhongjia commented 1 year ago

The temporary solution is to enter the init comment lock of cargo in manger under mason-core,After installing asm-lsp, restore

ntnunk commented 1 year ago

To clarify the comment above from @jinzhongjia, the temporary solution is:

  1. Find the installation directory :echo stdpath("data")
  2. Go to mason.nvim/lua/mason-core/managers/cargo
  3. Edit init.lua and temporarily comment out the --locked item inside ctx.spawn.cargo{}
kawaegle commented 1 year ago

To clarify the comment above from @jinzhongjia, the temporary solution is:

1. Find the installation directory `:echo stdpath("data")`

2. Go to `mason.nvim/lua/mason-core/managers/cargo`

3. Edit init.lua and temporarily comment out the `--locked` item inside `ctx.spawn.cargo{}`

I guess I can close this issue maybe a real solution will be release but for now this solution work so LGTM

williamboman commented 1 year ago

It seems to be failing for the same reasons here: https://github.com/mason-org/mason-registry/pull/85. I looked into the dependency chain before and it's not immediately clear to me why it's not picking up newer versions of socket2 (it does so locally for me).

amaanq commented 1 year ago

Just a heads up, I also cannot install asm-lsp but for a diff issue, log at the bottom.

It appears to me that the issue stems from the --locked flag. I believe removing this will update all deps from crates.io to install anything OpenSSL-related ok, as any machine that's updated to OpenSSL 3 seems affected, and perhaps that's why it's ok locally for you, just my two cents based on the error output here:

Log:

  The following warnings were emitted during compilation:

        warning: build/expando.c:4:24: error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
        warning:     4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
        warning:       |                        ^~~~~~~~~~~~~
        warning: build/expando.c:5:23: note: in expansion of macro ‘VERSION2’
        warning:     5 | #define VERSION(n, v) VERSION2(n, v)
        warning:       |                       ^~~~~~~~
        warning: build/expando.c:10:1: note: in expansion of macro ‘VERSION’
        warning:    10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
        warning:       | ^~~~~~~

        error: failed to run custom build command for `openssl-sys v0.9.58`

        Caused by:
          process didn't exit successfully: `/tmp/cargo-installdAp8hr/release/build/openssl-sys-e094771fd1c4dd0b/build-script-main` (exit status: 101)
          --- stdout
          cargo:rustc-cfg=const_fn
          cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
          X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
          cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
          OPENSSL_LIB_DIR unset
          cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
          X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
          cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
          OPENSSL_INCLUDE_DIR unset
          cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
          X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
          cargo:rerun-if-env-changed=OPENSSL_DIR
          OPENSSL_DIR unset
          cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
          cargo:rerun-if-env-changed=PKG_CONFIG
          cargo:rerun-if-env-changed=OPENSSL_STATIC
          cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
          cargo:rerun-if-env-changed=OPENSSL_STATIC
          cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
          cargo:rustc-link-lib=ssl
          cargo:rustc-link-lib=crypto
          cargo:rerun-if-env-changed=PKG_CONFIG
          cargo:rerun-if-env-changed=OPENSSL_STATIC
          cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
          OPT_LEVEL = Some("3")
          TARGET = Some("x86_64-unknown-linux-gnu")
          HOST = Some("x86_64-unknown-linux-gnu")
          CC_x86_64-unknown-linux-gnu = None
          CC_x86_64_unknown_linux_gnu = None
          HOST_CC = None
          CC = None
          CFLAGS_x86_64-unknown-linux-gnu = None
          CFLAGS_x86_64_unknown_linux_gnu = None
          HOST_CFLAGS = None
          CFLAGS = None
          CRATE_CC_NO_DEFAULTS = None
          DEBUG = Some("false")
          CARGO_CFG_TARGET_FEATURE = Some("fxsr,llvm14-builtins-abi,sse,sse2")
          running: "sccache" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/usr/include" "-Wall" "-Wextra" "-E" "build/expando.c"
          cargo:warning=build/expando.c:4:24: error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
          cargo:warning=    4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
          cargo:warning=      |                        ^~~~~~~~~~~~~
          cargo:warning=build/expando.c:5:23: note: in expansion of macro ‘VERSION2’
          cargo:warning=    5 | #define VERSION(n, v) VERSION2(n, v)
          cargo:warning=      |                       ^~~~~~~~
          cargo:warning=build/expando.c:10:1: note: in expansion of macro ‘VERSION’
          cargo:warning=   10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
          cargo:warning=      | ^~~~~~~
          exit status: 1

          --- stderr
          thread 'main' panicked at '
          Header expansion error:
          Error { kind: ToolExecError, message: "Command \"sccache\" \"cc\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-m64\" \"-I\" \"/usr/include\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args \"cc\" did not execute successfully (status code exit status: 1)." }

          Failed to find OpenSSL development headers.

          You can try fixing this setting the `OPENSSL_DIR` environment variable
          pointing to your OpenSSL installation or installing OpenSSL headers package
          specific to your distribution:

              # On Ubuntu
              sudo apt-get install libssl-dev
              # On Arch Linux
              sudo pacman -S openssl
              # On Fedora
              sudo dnf install openssl-devel

          See rust-openssl README for more information:

              https://github.com/sfackler/rust-openssl#linux
          ', /home/amaanq/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/main.rs:140:13
          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
        warning: build failed, waiting for other jobs to finish...
        error: failed to compile `asm-lsp v0.2.0`, intermediate artifacts can be found at `/tmp/cargo-installdAp8hr`
        spawn: cargo failed with exit code 101 and signal 0. 

I am on Arch Linux and of course have OpenSSL, but Arch updated to OpenSSL 3 in the last few months. Cheers, hope we can get this fixed!

kawaegle commented 1 year ago

Hey @amaanq I'm also on archlinux (latest update today).

Did you try to just execute cargo install asm-lsp (as mentioned here on the github

for me it build without problem from the command it automaticaly get the V0.2.0 maybe it's the locked that block the compile as we explain above. (I'm not that friendly with rust and cargo)

so as it's mentions above, you can edit manually: $(where is install mason on your install)/mason.nvim/lua/mason-core/managers/cargo/init.lua and the way cargo is executed to remove the locked parameter. (search for the function get_installed_created)

Hope it help a little Kawaegle

amaanq commented 1 year ago

yes I was able to install it by commenting the --locked flag, but this should still be fixed by either not having a restrictive --locked flag (because what's wrong with cargo updating deps if it can?) or adding an exclusion rule for asm-lsp :)

kawaegle commented 1 year ago

Maybe it need a look to the https://github.com/bergercookie/asm-lsp sources and investigate (I'm not really into rust and things like that) but maybe it's like in c/C++ there is some Header dependency that are actually not updated in some dependency of asm-lsp (but now it don't seem that cargo.toml inside the repos does error)

I'll see if I have time for investigate

Kawaegle

Decodetalkers commented 1 year ago

https://github.com/bergercookie/asm-lsp/pull/3 I make a pull request, may you take a try? But still need a lot effort to make changes, because during two years, a lot of things change, mainly about the crates upstream

Decodetalkers commented 1 year ago

Ok , now just quick-xml cannot be upgraded

Decodetalkers commented 1 year ago

Try it again, the author has already published a new version

kawaegle commented 1 year ago

LGTM

it seem to work as expected. Thank you @Decodetalkers

yossefsabry commented 6 months ago

To clarify the comment above from @jinzhongjia, the temporary solution is:

1. Find the installation directory `:echo stdpath("data")`

2. Go to `mason.nvim/lua/mason-core/managers/cargo`

3. Edit init.lua and temporarily comment out the `--locked` item inside `ctx.spawn.cargo{}`

I guess I can close this issue maybe a real solution will be release but for now this solution work so LGTM

`

2. mason.nvim/lua/mason-core/managers/cargo

i can't find any folder with this name: mason.nvim/lua/mason-core/managers/cargo when i echo stdpath("data") show its in ~/.local/share/nvim when i go for the dir i can't find and dir with this name

jinzhongjia commented 6 months ago

@yossefsabry This issue should be resolved by now

ilqvya commented 1 month ago

Still fails on commit e2f7f90, removing locked flag does not help

VuByte commented 1 month ago

@ilqvya try to compile asm_lsp from the source code, most likely you don't have any dependency installed. For me, these were the openssl development packages.