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

Update socket2 Rust dependency to fix Windows build #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

talklittle
Copy link

Fixes Windows compile by updating the socket2 Rust dependency to 0.3.19.

Fixes #21


Reproduce the error by running docker:

$ cd priv

# build the Windows Docker image
$ docker build -t rambo-windows -f Dockerfile.x86_64-pc-windows-gnu .

# attempt the Rambo build inside a Windows Docker container
$ docker run rambo-windows

Results in this Rust error:

   Compiling socket2 v0.3.11
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/socket2-0.3.11/src/sockaddr.rs:156:9
    |
156 |         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` (lib) due to 1 previous error

After adding a dependency on socket2 version 0.3.19 in Cargo.toml, and rebuilding the Docker image, the Rambo compilation succeeds.

Relevant socket2 issue: rust-lang/socket2#119 fixed in v0.3.16

@talklittle talklittle mentioned this pull request Jul 1, 2024
@talklittle
Copy link
Author

Updated. Adding explicit dependency wasn't needed; instead use $ cargo update -p socket2 to update the Cargo.lock file.

@dev10
Copy link

dev10 commented Sep 22, 2024

I can confirm this builds fine on Windows with the latest version of Rust(1.81.0)
I haven't tested in docker though as I don't use it on Windows.

@dev10 dev10 mentioned this pull request Sep 22, 2024
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 this pull request may close these issues.

Windows build fails
2 participants