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

lld-link error could not open USER32.lib No such file or directory #8

Closed
omac777 opened this issue Aug 24, 2021 · 3 comments · Fixed by #9
Closed

lld-link error could not open USER32.lib No such file or directory #8

omac777 opened this issue Aug 24, 2021 · 3 comments · Fixed by #9

Comments

@omac777
Copy link

omac777 commented Aug 24, 2021

Using your Dockerfile recommended for use with xwin:
https://gist.github.com/omac777/1f231073f4b313e20376c386f48c6dc3

I ran the following to attempt to build windows samples rs' message box sample:

sudo service docker restart
docker build --network host -t playxwinimg .

git clone https://github.com/microsoft/windows-samples-rs.git
sudo chmod -R 777 windows-samples-rs
docker run --rm --network host -v /home/loongson/tryredox/playxwin/windows-samples-rs:/srv/windows-samples-rs -i -t playxwinimg:latest /bin/bash
cd /srv/windows-samples-rs/message_box
cargo build --target x86_64-pc-windows-msvc --release

here is the output:

$ docker run --rm --network host -v /home/loongson/tryredox/playxwin/windows-samples-rs:/srv/windows-samples-rs -i -t playxwinimg:latest /bin/bash
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
root@righteous:/# cd /srv/windows-samples-rs/message_box
cd /srv/windows-samples-rs/message_box
root@righteous:/srv/windows-samples-rs/message_box# cargo build --target x86_64-pc-windows-msvc --release
se
    Updating crates.io index
  Downloaded proc-macro2 v1.0.28
  Downloaded quote v1.0.9
  Downloaded unicode-xid v0.2.2
  Downloaded const-sha1 v0.2.0
  Downloaded syn v1.0.74
  Downloaded windows v0.19.0
  Downloaded windows_gen v0.19.0
  Downloaded windows_quote v0.19.0
  Downloaded windows_macros v0.19.0
  Downloaded windows_reader v0.19.0
  Downloaded 10 crates (7.4 MB) in 0.55s (largest was `windows_reader` at 6.1 MB)
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling windows_quote v0.19.0
   Compiling windows_reader v0.19.0
   Compiling const-sha1 v0.2.0
   Compiling quote v1.0.9
   Compiling windows_gen v0.19.0
   Compiling windows_macros v0.19.0
   Compiling windows v0.19.0
   Compiling bindings v0.0.0 (/srv/windows-samples-rs/message_box/bindings)
   Compiling sample v0.0.0 (/srv/windows-samples-rs/message_box)
error: linking with `lld-link` failed: exit status: 1
  |
  = note: "lld-link" "/NOLOGO" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.0.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.1.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.2.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.3.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.4.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.5.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.sample.btbz376a-cgu.6.rcgu.o" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.1ply0khv4hpz03zo.rcgu.o" "/LIBPATH:/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps" "/LIBPATH:/srv/windows-samples-rs/message_box/target/release/deps" "/LIBPATH:/xwin/crt/lib/x86_64" "/LIBPATH:/xwin/sdk/lib/um/x86_64" "/LIBPATH:/xwin/sdk/lib/ucrt/x86_64" "/LIBPATH:/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/libbindings-d522218b93e33381.rlib" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/libwindows-a4a1543edf041f6e.rlib" "/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/libconst_sha1-57b2725c5a650a77.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd-3d786a338e3fbd3c.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libpanic_unwind-c7722f94ca812e0f.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd_detect-f6ac1aae8e3d5b95.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_demangle-8244d5c29082f380.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libhashbrown-c29ed8b388a545d6.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_std_workspace_alloc-daec0207219073db.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libunwind-e1164c8529217a2a.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcfg_if-78991d36592dccee.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liblibc-3e2bb97c5be118b7.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/liballoc-d5bd6400adb9fa95.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/librustc_std_workspace_core-07dcecfd1f459221.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcore-f0c150dc0abba70a.rlib" "/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib/libcompiler_builtins-0f3806ca1d72c7be.rlib" "USER32.lib" "KERNEL32.lib" "OLEAUT32.lib" "OLE32.lib" "KERNEL32.lib" "OLEAUT32.lib" "KERNEL32.lib" "kernel32.lib" "ws2_32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:/usr/local/rustup/toolchains/1.54.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib" "/OUT:/srv/windows-samples-rs/message_box/target/x86_64-pc-windows-msvc/release/deps/sample.exe" "/OPT:REF,ICF" "/DEBUG"
  = note: lld-link: error: could not open 'USER32.lib': No such file or directory
          lld-link: error: could not open 'KERNEL32.lib': No such file or directory
          lld-link: error: could not open 'OLEAUT32.lib': No such file or directory
          lld-link: error: could not open 'OLE32.lib': No such file or directory
          lld-link: error: could not open 'KERNEL32.lib': No such file or directory
          lld-link: error: could not open 'OLEAUT32.lib': No such file or directory
          lld-link: error: could not open 'KERNEL32.lib': No such file or directory
          

error: aborting due to previous error

error: could not compile `sample`

To learn more, run the command again with --verbose.
root@righteous:/srv/windows-samples-rs/message_box# 

What do you recommend for this? Thank you.

@Jake-Shadle
Copy link
Owner

I'll push a fix for this since windows-rs is using SCREAMING case in their link declarations.

@Jake-Shadle
Copy link
Owner

I've released this in the 0.1.1 version of the crate, thanks for the report!

@omac777
Copy link
Author

omac777 commented Aug 26, 2021

I've updated the Dockerfile to point to your new version tag and stuff compiles successfully. Thank you.
From: 0.1.0
To: xwin-0.1.1

https://gist.github.com/omac777/1f231073f4b313e20376c386f48c6dc3#file-dockerfile-L49

xwin_version="xwin-0.1.1"; 

As a result this works without issues:

sudo service docker restart
sudo service docker status
docker image ls
docker rmi -f 2089c03a47ca
docker build --network host -t playxwinimg .
docker container ls --all

git clone https://github.com/microsoft/windows-samples-rs.git
sudo chmod -R 777 windows-samples-rs
docker run --rm --network host -v /home/loongson/tryredox/playxwin/windows-samples-rs:/srv/windows-samples-rs -i -t playxwinimg:latest /bin/bash
cd /srv/windows-samples-rs/message_box
cargo build --target x86_64-pc-windows-msvc --release

But this one required tweaking to windows crate 0.19.0 in 2 Cargo.toml files one in topmost, the other in directory bindings.
After the tweak, it cross-compiles successfully:

git clone https://github.com/robmikh/minesweeper-rs.git
sudo chmod -R 777 minesweeper-rs
docker run --rm --network host -v /home/loongson/tryredox/playxwin/minesweeper-rs:/srv/minesweeper-rs -i -t playxwinimg:latest /bin/bash
cd /srv/minesweeper-rs
cargo build --target x86_64-pc-windows-msvc --release

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

Successfully merging a pull request may close this issue.

2 participants