0

I've been trying to install cargo-leptos on my machine. I've installed it without issues on another machine before (also windows) but now I'm running into some issues.

When I run

cargo install --locked cargo-leptos everything seems to compile fine up until it tries to build cargo-leptos (bin)

After that, the install fails with this error:

error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\rustcVKF0uP\\symbols.o" "<1 object files omitted>" "-Wl,-Bstatic" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\rustcVKF0uP/{libwindows_strings-9e938c87243a8807.rlib,libwindows_result-587511ed53959467.rlib,libring-b148c0998e7ffe4f.rlib,libwasm_opt_cxx_sys-9a3559f22ee7229d.rlib,libwasm_opt_sys-0c9166593a730986.rlib,libcxx-b0c96df18ac0cb8e.rlib,liblink_cplusplus-94c74ccf6784a8f4.rlib,libchrono-b32e1a0da14dbf54.rlib,libstacker-b1045a81716e4419.rlib,libpsm-14e9ae13f2c43ed9.rlib,libproc_macro-492aa1eb31f42058.rlib,libgetrandom-269e21c4ebdd8eb1.rlib,liblibgit2_sys-0ea272955479d717.rlib,liblibssh2_sys-096d8affa520be93.rlib,liblibz_sys-fc3f750804760aff.rlib,libstd-0571dc2878ba5cea.rlib,libpanic_unwind-9950fa4b65ca944f.rlib,libobject-bb7afc90598c48a8.rlib,libmemchr-5a748fa78171472a.rlib,libaddr2line-a65aadb6f7926ec8.rlib,libgimli-229a974ea5ae125d.rlib,libwindows_targets-8de7f376fe97e72b.rlib,librustc_demangle-1286c4d86cb708a0.rlib,libstd_detect-e24aed5e6146d4ea.rlib,libhashbrown-d6d5b33c17665939.rlib,librustc_std_workspace_alloc-b4e4d80d69d1f628.rlib,libminiz_oxide-4c25270a42158ecc.rlib,libadler2-739d7154ee9ea431.rlib,libunwind-49b861ae16fcb6da.rlib,libcfg_if-a98ac491dd5e8a3d.rlib,liblibc-ea336b74ce0566d8.rlib,liballoc-c19b25752f7a3d6b.rlib,librustc_std_workspace_core-3fa6d154b11615b4.rlib,libcore-f5bfb3409411ed67.rlib}.rlib" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib/{libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-ladvapi32" "-lkernel32" "-lktmw32" "-luser32" "-lwindows.0.52.0" "-lwindows.0.53.0" "-lstdc++" "-lbcrypt" "-ladvapi32" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_opengl32" "-lwinapi_winspool" "-lwinhttp" "-lrpcrt4" "-lole32" "-lcrypt32" "-lsecur32" "-ladvapi32" "-lbcrypt" "-lcrypt32" "-luser32" "-lntdll" "-lwindows.0.52.0" "-lwindows.0.52.0" "-lwindows.0.52.0" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\\Users\\Elijah Ang\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\windows_x86_64_gnu-0.52.6\\lib" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\libgit2-sys-7bcd4239acba6b23\\out\\build" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\libssh2-sys-b1603e8abf333cde\\out\\build" "-L" "C:/tools/msys64/mingw64/bin/../lib" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\libz-sys-19dd14139921c0f3\\out\\lib" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\libz-sys-19dd14139921c0f3\\out\\lib" "-L" "C:\\Users\\Elijah Ang\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\winapi-x86_64-pc-windows-gnu-0.4.0\\lib" "-L" "C:\\tools\\msys64\\mingw64\\lib" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\ring-b5e2089bd1791c64\\out" "-L" "C:\\Users\\Elijah Ang\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\windows_x86_64_gnu-0.53.0\\lib" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\stacker-daf92462b71d6a64\\out" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\psm-1a7cbc46a8f04345\\out" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\wasm-opt-cxx-sys-9c0da407b25a9541\\out" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\cxx-ee405e816deee2a4\\out" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\link-cplusplus-fd3e66e4a51cf297\\out" "-L" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\build\\wasm-opt-sys-ed928466be6cb2fd\\out" "-o" "C:\\Users\\ELIJAH~1\\AppData\\Local\\Temp\\cargo-installyDBnGu\\release\\deps\\cargo_leptos-c799e4a2d18dfdc7.exe" "-Wl,--gc-sections" "-no-pie" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_sys-0c9166593a730986.rlib(8a4a3ecfb9b47c67-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE[.text$_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE]+0x0): multiple definition of `wasm::Pass::runOnFunction(wasm::Module*, wasm::Function*)'; C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_cxx_sys-9a3559f22ee7229d.rlib(6a65131bdc4b0de2-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE[_ZN4wasm4Pass13runOnFunctionEPNS_6ModuleEPNS_8FunctionE]+0x0): first defined here␍
          C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_sys-0c9166593a730986.rlib(8a4a3ecfb9b47c67-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass3runEPNS_6ModuleE[.text$_ZN4wasm4Pass3runEPNS_6ModuleE]+0x0): multiple definition of `wasm::Pass::run(wasm::Module*)'; C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_cxx_sys-9a3559f22ee7229d.rlib(6a65131bdc4b0de2-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass3runEPNS_6ModuleE[_ZN4wasm4Pass3runEPNS_6ModuleE]+0x0): first defined here␍
          C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_sys-0c9166593a730986.rlib(8a4a3ecfb9b47c67-wasm-validator.o):wasm-validator:(.text$_ZN4wasm4Pass6createEv[.text$_ZN4wasm4Pass6createEv]+0x0): multiple definition of `wasm::Pass::create()'; C:\Users\ELIJAH~1\AppData\Local\Temp\rustcVKF0uP\libwasm_opt_cxx_sys-9a3559f22ee7229d.rlib(6a65131bdc4b0de2-lib.rs.o):lib.rs.cc:(.text$_ZN4wasm4Pass6createEv[_ZN4wasm4Pass6createEv]+0x0): first defined here␍
          collect2.exe: error: ld returned 1 exit status

Which is a bit of a handful, but after parsing out the error a bit (with the help of ChatGPT), I think it boils down to multiple definitions of

wasm::Pass::runOnFunction(wasm::Module*, wasm::Function*)
wasm::Pass::run(wasm::Module*)
wasm::Pass::create()

in both libwasm_opt_sys-0c9166593a730986.rlib and libwasm_opt_cxx_sys-9a3559f22ee7229d.rlib.

(Should this be an issue in wasm-opt instead?)

If you need this info, I'm using the 64 bit GNU toolchain of Rust (x86_64-pc-windows-gnu) where I installed gcc with MSYS2 and MSYS2 with Chocolatey.

I think I'm most likely doing something wrong on my end, and I apologize, but I'd appreciate any help!

Thanks

P. S. Previously, I ran into some errors with openssl-sys not compiling properly. Maybe it's related?

https://users.rust-lang.org/t/how-do-you-fix-cargo-leptos-installation-errors-because-of-openssl-sys/129752/2?u=eliaxelang007

I have a hunch that because I set these environment variables:

OPENSSL_INCLUDE_DIR="C:\tools\msys64\mingw64\include" OPENSSL_LIB_DIR="C:\tools\msys64\mingw64\lib"

openssl-sys is including all the headers from C:\tools\msys64\mingw64\include and linking all the libraries from C:\tools\msys64\mingw64\lib and it's somehow messing with wasm-opt, but I have no proof to back that up.

4
  • You have two versions of the wasm_opt_cxx_sys crate that conflict with each other. Not sure why though. Commented May 21 at 12:11
  • If it worked fine once, then the issue is with files on the second machine. You may be able to copy the working install or at least the libs that worked. Commented May 21 at 12:11
  • I can't unfortunately, that laptop of mine broke Commented May 21 at 22:49
  • @Jmb, do you think one of my other cargo installations has a different version of wasm_opt_cxx_sys that's conflicting with cargo-leptos's? Or is that not a thing that's possible? I have rust-script v0.34.0, tauri-cli v2.0.4, trunk v0.21.1, and wasm-bindgen-cli v0.2.95 installed. Commented May 21 at 23:42

1 Answer 1

0

This isn't really a great answer to my initial question, but I downloaded cargo-leptos through cargo-binstall and it seems to work fine.

https://github.com/cargo-bins/cargo-binstall

The original issue is still unresolved, but if you need a quick way to set cargo-leptos up, cargo-binstall might work for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.