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

Missing SO_INCOMING_CPU compiling with armv7-unknown-linux-musleabi #213

Closed
zonyitoo opened this issue Mar 17, 2021 · 12 comments · Fixed by rust-lang/libc#2115
Closed

Missing SO_INCOMING_CPU compiling with armv7-unknown-linux-musleabi #213

zonyitoo opened this issue Mar 17, 2021 · 12 comments · Fixed by rust-lang/libc#2115

Comments

@zonyitoo
Copy link

Compiling socket2 v0.3.19
Running `rustc --crate-name socket2 --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.19/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C codegen-units=1 -C metadata=9516879405a31528 -C extra-filename=-9516879405a31528 --out-dir /tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps --target armv7-unknown-linux-musleabi -C linker=armv6-linux-musleabi-gcc -L dependency=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps -L dependency=/tmp/cargo-installQyepjN/release/deps --extern cfg_if=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps/libcfg_if-a21588f9f01fd146.rmeta --extern libc=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps/liblibc-2305531b0b6bff17.rmeta --cap-lints allow -C relocation-model=pic -C prefer-dynamic=off -C target-feature=+crt-static,-vfp2,-vfp3`
Compiling socket2 v0.4.0
Running `rustc --crate-name socket2 --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 --cfg 'feature="all"' -C metadata=4b78b189cd4beac3 -C extra-filename=-4b78b189cd4beac3 --out-dir /tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps --target armv7-unknown-linux-musleabi -C linker=armv6-linux-musleabi-gcc -L dependency=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps -L dependency=/tmp/cargo-installQyepjN/release/deps --extern libc=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps/liblibc-2305531b0b6bff17.rmeta --cap-lints allow -C relocation-model=pic -C prefer-dynamic=off -C target-feature=+crt-static,-vfp2,-vfp3`
error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc` --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/sys/unix.rs:1201:69 | 1201 | getsockopt::<c_int>(self.inner, libc::SOL_SOCKET, libc::SO_INCOMING_CPU) | ^^^^^^^^^^^^^^^ not found in `libc`
error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc` --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/sys/unix.rs:1217:23 | 1217 | libc::SO_INCOMING_CPU, | ^^^^^^^^^^^^^^^ not found in `libc`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
error: could not compile `socket2` Caused by:
process didn't exit successfully: `rustc --crate-name socket2 --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 --cfg 'feature="all"' -C metadata=4b78b189cd4beac3 -C extra-filename=-4b78b189cd4beac3 --out-dir /tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps --target armv7-unknown-linux-musleabi -C linker=armv6-linux-musleabi-gcc -L dependency=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps -L dependency=/tmp/cargo-installQyepjN/release/deps --extern libc=/tmp/cargo-installQyepjN/armv7-unknown-linux-musleabi/release/deps/liblibc-2305531b0b6bff17.rmeta --cap-lints allow -C relocation-model=pic -C prefer-dynamic=off -C target-feature=+crt-static,-vfp2,-vfp3` (exit code: 1) warning: build failed, waiting for other jobs to finish...
error

This was originally found in shadowsocks/shadowsocks-rust#459 .

bors added a commit to rust-lang/libc that referenced this issue Mar 17, 2021
Add SO_INCOMING_CPU for targets arm-unknown-linux-*

- fixes rust-lang/socket2#213
- ref shadowsocks/shadowsocks-rust#459
@zonyitoo
Copy link
Author

Changed in libc is already merged. Consider fixed the lowest libc version in the next release.

@Thomasdezeeuw
Copy link
Collaborator

Thanks for finding and solving the problem @zonyitoo.

@oherrala
Copy link
Contributor

Sorry to borrow this issue, but I found out aarch64-unknown-linux-musl and x86_64-unknown-linux-musl targets are also broken the same way and made a pull request to libc crate to get SO_INCOMING_CPU implemented there.

PR: rust-lang/libc#2119

thomaseizinger added a commit to comit-network/xmr-btc-swap that referenced this issue Mar 22, 2021
@fbecart
Copy link

fbecart commented Mar 26, 2021

Until the next version of libc is released, is there a known workaround, such as pinning a specific version of libc or socket2?

@Thomasdezeeuw
Copy link
Collaborator

@fbecart can you run cargo update, updating the libc crate? That should resolve this issue.

@fbecart
Copy link

fbecart commented Mar 26, 2021

Thank you @Thomasdezeeuw for pointing me in the right direction. I realize the problem is currently fixed for a specific set of architectures only. I'm building for i686-unknown-linux-musl, for which an issue likely still exists. I'll redirect my attention to libc.

bors added a commit to rust-lang/libc that referenced this issue Mar 26, 2021
Define SO_INCOMING_CPU for i686-unknown-linux-musl

Following the examples from #2119 and #2123, to fix the same issue with `socket2`: rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Mar 26, 2021
Define SO_INCOMING_CPU for i686-unknown-linux-musl

Following the examples from #2119 and #2123, to fix the same issue with `socket2`: rust-lang/socket2#213
@zonyitoo zonyitoo reopened this Mar 31, 2021
@zonyitoo
Copy link
Author

There are still many architectures missing SO_INCOMING_CPU in the libc crate. Could @Thomasdezeeuw make sure that all Linux-like platforms have this definition in libc?

@zonyitoo
Copy link
Author

I am not sure that target-env = "uclibc" has SO_INCOMING_CPU definition. It is left for others to make patches. :)

@Thomasdezeeuw
Copy link
Collaborator

I think this issue is really with libc, not with socket2.

bors added a commit to rust-lang/libc that referenced this issue Apr 1, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 1, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
@JinAirsOs
Copy link

I meet this issue too.

error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc`
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/sys/unix.rs:1201:69
     |
1201 |             getsockopt::<c_int>(self.inner, libc::SOL_SOCKET, libc::SO_INCOMING_CPU)
     |                                                                     ^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SO_INCOMING_CPU` in crate `libc`
    --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.0/src/sys/unix.rs:1217:23
     |
1217 |                 libc::SO_INCOMING_CPU,
     |                       ^^^^^^^^^^^^^^^ not found in `libc`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
error: could not compile `socket2`

To learn more, run the command again with --verbose.

@JinAirsOs
Copy link

how to work around?

@Thomasdezeeuw
Copy link
Collaborator

@JinAirsOs you can disable the all feature for now to work around it. Otherwise I think rust-lang/libc#2135 would fix this issue.

bors added a commit to rust-lang/libc that referenced this issue Apr 2, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 2, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 2, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 2, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 2, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213
bors added a commit to rust-lang/libc that referenced this issue Apr 5, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213

Fixes #2133
bors added a commit to rust-lang/libc that referenced this issue Apr 5, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213

Fixes #2133
bors added a commit to rust-lang/libc that referenced this issue Apr 5, 2021
Unified all Linux sockopts definitions by arch

- ref rust-lang/socket2#213

Fixes #2133
@zonyitoo zonyitoo closed this as completed Apr 6, 2021
zonyitoo added a commit to shadowsocks/shadowsocks-rust that referenced this issue Apr 7, 2021
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.

5 participants