Skip to content

0.4.8 doesn't build on windows #408

@crepererum

Description

@crepererum

Originally observed here: https://github.com/apache/arrow-rs/actions/runs/4322328830/jobs/7544614055:

Details
   Compiling socket2 v0.4.8
error[E0425]: cannot find value `SOCKET_ERROR` in this scope
   --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.4.8\src\sys\windows.rs:484:17
    |
484 |                 SOCKET_ERROR
    |                 ^^^^^^^^^^^^
    |
   ::: C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\winapi-0.3.9\src\shared\ws2def.rs:75:1
    |
75  | pub const SO_ERROR: c_int = 0x1007;
    | ------------------------- similarly named constant `SO_ERROR` defined here
    |
help: a constant with a similar name exists
    |
484 |                 SO_ERROR
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::SOCKET_ERROR;
    |
9   | use winapi::um::winsock2::SOCKET_ERROR;
    |

error[E0425]: cannot find value `WSAESHUTDOWN` in this scope
   --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.4.8\src\sys\windows.rs:489:44
    |
489 |                     Some(code) if code == (WSAESHUTDOWN as i32) || code == (WSAEMSGSIZE as i32) => {
    |                                            ^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::WSAESHUTDOWN;
    |
9   | use winapi::shared::winerror::WSAESHUTDOWN;
    |
9   | use winapi::um::winsock2::WSAESHUTDOWN;
    |

error[E0425]: cannot find value `WSAEMSGSIZE` in this scope
   --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.4.8\src\sys\windows.rs:489:77
    |
489 |                     Some(code) if code == (WSAESHUTDOWN as i32) || code == (WSAEMSGSIZE as i32) => {
    |                                                                             ^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::WSAEMSGSIZE;
    |
9   | use winapi::shared::winerror::WSAEMSGSIZE;
    |
9   | use winapi::um::winsock2::WSAEMSGSIZE;
    |

   Compiling num_cpus v1.15.0
   Compiling slab v0.4.8
   Compiling futures-task v0.3.26
   Compiling futures-channel v0.3.26
   Compiling futures-sink v0.3.26
   Compiling futures-util v0.3.26
error[E0599]: no function or associated item named `try_init` found for struct `SockAddr` in the current scope
   --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.4.8\src\sys\windows.rs:472:19
    |
472 |         SockAddr::try_init(|storage, addrlen| {
    |                   ^^^^^^^^
    |                   |
    |                   function or associated item not found in `SockAddr`
    |                   help: there is an associated function with a similar name: `init`
    |
   ::: C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\socket2-0.4.8\src\sockaddr.rs:17:1
    |
17  | pub struct SockAddr {
    | ------------------- function or associated item `try_init` not found for this struct

   Compiling futures-macro v0.3.26
Some errors have detailed explanations: E0425, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `socket2` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

However this can also be reproduced locally. I only have a Linux installation, but cross-compiling triggers the issue as well:

$ git clone https://github.com/rust-lang/socket2.git
$ cd socket2
$ git checkout v0.4.8
$ rustup target add x86_64-pc-windows-gnu
$ cargo --version
cargo 1.67.1 (8ecd4f20a 2023-01-10)
$ cargo build --target x86_64-pc-windows-gnu
    Updating crates.io index
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling winapi v0.3.9
   Compiling socket2 v0.4.8 (/home/mneumann/src/socket2)
error[E0425]: cannot find value `SOCKET_ERROR` in this scope
   --> src/sys/windows.rs:484:17
    |
484 |                 SOCKET_ERROR
    |                 ^^^^^^^^^^^^
    |
   ::: /home/mneumann/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.3.9/src/shared/ws2def.rs:75:1
    |
75  | pub const SO_ERROR: c_int = 0x1007;
    | ------------------------- similarly named constant `SO_ERROR` defined here
    |
help: a constant with a similar name exists
    |
484 |                 SO_ERROR
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::SOCKET_ERROR;
    |
9   | use winapi::um::winsock2::SOCKET_ERROR;
    |

error[E0425]: cannot find value `WSAESHUTDOWN` in this scope
   --> src/sys/windows.rs:489:44
    |
489 |                     Some(code) if code == (WSAESHUTDOWN as i32) || code == (WSAEMSGSIZE as i32) => {
    |                                            ^^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::WSAESHUTDOWN;
    |
9   | use winapi::shared::winerror::WSAESHUTDOWN;
    |
9   | use winapi::um::winsock2::WSAESHUTDOWN;
    |

error[E0425]: cannot find value `WSAEMSGSIZE` in this scope
   --> src/sys/windows.rs:489:77
    |
489 |                     Some(code) if code == (WSAESHUTDOWN as i32) || code == (WSAEMSGSIZE as i32) => {
    |                                                                             ^^^^^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
9   | use crate::sys::sock::WSAEMSGSIZE;
    |
9   | use winapi::shared::winerror::WSAEMSGSIZE;
    |
9   | use winapi::um::winsock2::WSAEMSGSIZE;
    |

error[E0599]: no function or associated item named `try_init` found for struct `SockAddr` in the current scope
   --> src/sys/windows.rs:472:19
    |
472 |         SockAddr::try_init(|storage, addrlen| {
    |                   ^^^^^^^^
    |                   |
    |                   function or associated item not found in `SockAddr`
    |                   help: there is an associated function with a similar name: `init`
    |
   ::: src/sockaddr.rs:17:1
    |
17  | pub struct SockAddr {
    | ------------------- function or associated item `try_init` not found for this struct

Some errors have detailed explanations: E0425, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `socket2` due to 4 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions