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

error: could not open 'kernel32.lib': No such file or directory #75

Closed
HKalbasi opened this issue Mar 10, 2023 · 1 comment
Closed

error: could not open 'kernel32.lib': No such file or directory #75

HKalbasi opened this issue Mar 10, 2023 · 1 comment

Comments

@HKalbasi
Copy link

Hi, thanks for this project. I followed your blog post instruction but failed with this error. I'm very newbie with build systems so this is probably a trivial problem.

The output of cargo build --target=x86_64-pc-windows-msvc is here:

   Compiling ra-run v0.1.0 (/home/hamid/oss/ra-run)
error: linking with `lld-link` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/hamid/.wasmer/bin:/home/hamid/.wasmtime/bin:/home/hamid/.deno/bin:/home/hamid/.wasmer/bin:/home/hamid/.wasmtime/bin:/home/hamid/.deno/bin:/home/hamid/.nvm/versions/node/v16.14.2/bin:/home/hamid/.cargo/bin:/home/hamid/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/hamid/.dotnet/tools:/home/hamid/.wasmer/globals/wapm_packages/.bin:/home/hamid/.wasmer/globals/wapm_packages/.bin" VSLANG="1033" "lld-link" "-flavor" "link" "/NOLOGO" "/tmp/rustcPF02Um/symbols.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.370mowunmskngb40.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.3m4vdmlolq0fnnoe.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.43wqbv6cmxezo5iu.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.4mo8zh2mfgx2kezh.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.564mgay8mqaonrg9.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.5g9lvrbiowshlvia.rcgu.o" "/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.sxm4i7jjh3bxiyh.rcgu.o" "/LIBPATH:/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps" "/LIBPATH:/home/hamid/oss/ra-run/target/debug/deps" "/LIBPATH:/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd-def8e53046de335b.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libpanic_unwind-62d160d4fb1f3e35.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_demangle-13ad55cee4080447.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd_detect-1735606bdcca0248.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libhashbrown-ed3da6b061bf16b2.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libminiz_oxide-798a382c9e175c85.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libadler-f40bb6e991434635.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_std_workspace_alloc-e0d1795fe60da182.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libunwind-05143401f2cd6cbf.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcfg_if-d0fa84d9f351cf16.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liblibc-c00d1f51981f09f6.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liballoc-6231dd8f826d6fe5.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_std_workspace_core-b7b22741583360f1.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcore-a8962116ce00a4da.rlib" "/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcompiler_builtins-58e2de43e9b1a814.rlib" "kernel32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "msvcrt.lib" "legacy_stdio_definitions.lib" "/NXCOMPAT" "/LIBPATH:/home/hamid/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "/OUT:/home/hamid/oss/ra-run/target/x86_64-pc-windows-msvc/debug/deps/ra_run.exe" "/OPT:REF,NOICF" "/DEBUG"

My guess is that these paths "kernel32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "msvcrt.lib" should be absolute. I have these file in my disk on /xwin/sdk/lib/um/x86_64.

I tried to carefully follow your blog post, but I'm not in a docker image. I can provide additional information if needed.

@Jake-Shadle
Copy link
Owner

You need to tell the linker where to find the libraries to link, for example

CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS="-Lnative=/xwin/crt/lib/x86_64 -Lnative=/xwin/sdk/lib/um/x86_64 -Lnative=/xwin/sdk/lib/ucrt/x86_64"

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

2 participants