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

v0.5.1 does not build on musl with --features all #405

Closed
jstarks opened this issue Mar 1, 2023 · 9 comments
Closed

v0.5.1 does not build on musl with --features all #405

jstarks opened this issue Mar 1, 2023 · 9 comments

Comments

@jstarks
Copy link
Contributor

jstarks commented Mar 1, 2023

This looks like it was broken in #359.

$ cargo check --target x86_64-unknown-linux-musl --features all
    Checking socket2 v0.5.1 (/home/john/src/socket2)
error[E0425]: cannot find value `DCCP_SOCKOPT_SERVICE` in crate `libc`
    --> src/sys/unix.rs:2452:23
     |
2452 |                 libc::DCCP_SOCKOPT_SERVICE,
     |                       ^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_SERVICE` in crate `libc`
    --> src/sys/unix.rs:2466:66
     |
2466 |         unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SERVICE) }
     |                                                                  ^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_CCID` in crate `libc`
    --> src/sys/unix.rs:2475:66
     |
2475 |         unsafe { setsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_CCID, ccid) }
     |                                                                  ^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_TX_CCID` in crate `libc`
    --> src/sys/unix.rs:2486:66
     |
2486 |         unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_TX_CCID) }
     |                                                                  ^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_RX_CCID` in crate `libc`
    --> src/sys/unix.rs:2497:66
     |
2497 |         unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RX_CCID) }
     |                                                                  ^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_SERVER_TIMEWAIT` in crate `libc`
    --> src/sys/unix.rs:2511:23
     |
2511 |                 libc::DCCP_SOCKOPT_SERVER_TIMEWAIT,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_SERVER_TIMEWAIT` in crate `libc`
    --> src/sys/unix.rs:2529:23
     |
2529 |                 libc::DCCP_SOCKOPT_SERVER_TIMEWAIT,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_SEND_CSCOV` in crate `libc`
    --> src/sys/unix.rs:2548:23
     |
2548 |                 libc::DCCP_SOCKOPT_SEND_CSCOV,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_SEND_CSCOV` in crate `libc`
    --> src/sys/unix.rs:2562:66
     |
2562 |         unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_SEND_CSCOV) }
     |                                                                  ^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_RECV_CSCOV` in crate `libc`
    --> src/sys/unix.rs:2577:23
     |
2577 |                 libc::DCCP_SOCKOPT_RECV_CSCOV,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_RECV_CSCOV` in crate `libc`
    --> src/sys/unix.rs:2591:66
     |
2591 |         unsafe { getsockopt(self.as_raw(), libc::SOL_DCCP, libc::DCCP_SOCKOPT_RECV_CSCOV) }
     |                                                                  ^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_QPOLICY_TXQLEN` in crate `libc`
    --> src/sys/unix.rs:2605:23
     |
2605 |                 libc::DCCP_SOCKOPT_QPOLICY_TXQLEN,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_QPOLICY_TXQLEN` in crate `libc`
    --> src/sys/unix.rs:2623:23
     |
2623 |                 libc::DCCP_SOCKOPT_QPOLICY_TXQLEN,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_AVAILABLE_CCIDS` in crate `libc`
    --> src/sys/unix.rs:2645:19
     |
2645 |             libc::DCCP_SOCKOPT_AVAILABLE_CCIDS,
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `DCCP_SOCKOPT_GET_CUR_MPS` in crate `libc`
    --> src/sys/unix.rs:2663:23
     |
2663 |                 libc::DCCP_SOCKOPT_GET_CUR_MPS,
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `socket2` due to 15 previous errors
@Thomasdezeeuw
Copy link
Collaborator

Seems like these constant definitions are missing from libc for musl or musl itself. We can workaround this by disabling this API for musl, but ideally these constants would be added to libc.

@nekopsykose
Copy link

from what i can tell these constants actually come from the kernel headers (<linux/dccp.h>), they're not in glibc either (possibly a re-export of kernel headers like glibc does sometimes). if the libc crate exports these for some reason, it doesn't seem like it should be based on libc == gnu, rather just os == linux.

@Thomasdezeeuw
Copy link
Collaborator

This should be fixed with a new release of libc which includes rust-lang/libc#3136.

@playmyswift
Copy link

same error for me, it's still open?

@Thomasdezeeuw
Copy link
Collaborator

@playmyswift yes. I don't think libc had a release which include the pr that fixed this issues.

Once a new release is out I'll close this issue. Might be worth update our libc version and adding a CI check for musl.

@nekopsykose
Copy link

nekopsykose commented Mar 15, 2023

if you want a momentary workaround, put the following:

[patch.crates-io]
libc = { git = 'https://github.com/rust-lang/libc.git', rev = "e71a4c0b1fd40050f50844e2a752576bcb6b5edb" }

into Cargo.toml of your project that uses this, and run cargo update (with -p libc if you prefer). assuming nothing in your dep tree also explicitly specifies a libc version (i don't know how this resolution works), it will force upgrade libc to that revision with the fixed interface. perhaps https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html would also be useful.

of course, this has no warranty, and is /generally/ not great practice. use it as a workaround only :)

0.2.140 was just released, so the next one is anywhere from a few weeks to months away, who knows. 0.2.141 will be the 'fixed' version.

@Thomasdezeeuw
Copy link
Collaborator

0.2.140 was just released, so the next one is anywhere from a few weeks to months away, who knows. 0.2.141 will be the 'fixed' version.

If someone opens a pr that bumps the version it could be hours away. It's very much a community driven project and it's usually very willing to make new releases.

@nekopsykose
Copy link

sure, that makes sense :) i just tend to not force people to make releases and wait, myself

@Thomasdezeeuw
Copy link
Collaborator

New release of libc was just merged rust-lang/libc#3177, so in a moment this will be fixed (after a manual update using cargo update).

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

4 participants