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

Add support for alternative QNX Neutrino network stack io-sock #4169

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flba-eb
Copy link
Contributor

@flba-eb flba-eb commented Dec 2, 2024

Description

QNX 7.1 supports two network stacks:

  1. io-pkt, which is default
  2. io-sock, which is optional and should be default in QNX 8.0

As one can see in the io-sock migration notes, this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl.

This change uses a new target which has a different value for target_env, so that e.g. libc can distinguish between both APIs. New target pull request for rustc: rust-lang/rust#133631

CC: @jonathanpallant @japaric @gh-tr @AkhilTThomas

Sources

  • Relevant tests in libc-test/semver have been updated
    ⚠️ QNX is unfortunately not ABI compatible between versions, hence semver checks are not possible.
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2024

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@flba-eb flba-eb force-pushed the add_iosock_1.0 branch 4 times, most recently from b9d6917 to 3f75bbc Compare December 3, 2024 09:44
@flba-eb flba-eb marked this pull request as ready for review December 11, 2024 08:21
@flba-eb flba-eb marked this pull request as draft December 11, 2024 08:22
@bors
Copy link
Contributor

bors commented Dec 17, 2024

☔ The latest upstream changes (presumably #4198) made this pull request unmergeable. Please resolve the merge conflicts.

@flba-eb flba-eb force-pushed the add_iosock_1.0 branch 3 times, most recently from 273da82 to 2410b84 Compare December 18, 2024 08:48
@bors
Copy link
Contributor

bors commented Dec 19, 2024

☔ The latest upstream changes (presumably #4202) made this pull request unmergeable. Please resolve the merge conflicts.

@flba-eb flba-eb force-pushed the add_iosock_1.0 branch 3 times, most recently from 6e08444 to f92715a Compare December 19, 2024 14:22
@flba-eb flba-eb force-pushed the add_iosock_1.0 branch 2 times, most recently from 21b7555 to c0d8cf1 Compare January 7, 2025 07:04
@flba-eb flba-eb marked this pull request as ready for review January 26, 2025 15:59
@flba-eb
Copy link
Contributor Author

flba-eb commented Feb 12, 2025

@tgross35 would it make sense to take over from @JohnTitor ? Asking because of 65d0ffb.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't look at the nto changes too deeply since I have nothing to reference, but the surface looks reasonable to me and you are a target maintainer. @jonathanpallant you're also listed as a maintainer, could you ack this?

@tgross35
Copy link
Contributor

Also, looks like the first two commits could be squashed

@flba-eb
Copy link
Contributor Author

flba-eb commented Feb 23, 2025

Also, looks like the first two commits could be squashed

Done. The test failures of freebsd tests seem to be unrelated.

Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Feb 23, 2025
@tgross35 tgross35 enabled auto-merge February 23, 2025 22:13
) -> c_int;
}
} else {
extern "C" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm these match qnx7/usr/include/io-sock/sys/socket.h

pub const USER_MAXID: c_int = 22;
pub const SO_OVERFLOWED: c_int = 0x1009;
} else {
pub const SCM_CREDS: c_int = 0x03;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I randomly sampled a selection of these and they all checked out against my header files.

@jonathanpallant
Copy link

Building libc_test also failed (I didn't expect it to run, because this host is not running QNX, but I expected it to build):

bash -c "source ~/qnx710/qnxsdp-env.sh && criticalup run cargo test --target=aarch64-unknown-nto-qnx710"
QNX_HOST=/Users/jonathan/qnx710/host/darwin/x86_64
QNX_TARGET=/Users/jonathan/qnx710/target/qnx7
MAKEFLAGS=-I/Users/jonathan/qnx710/target/qnx7/usr/include
   Compiling proc-macro2 v1.0.93
   Compiling unicode-ident v1.0.14
   Compiling libc v0.2.169
   Compiling serde v1.0.217
   Compiling memchr v2.7.4
   Compiling cfg-if v0.1.10
   Compiling serde_json v1.0.135
   Compiling semver v1.0.24
   Compiling unicode-xid v0.2.6
   Compiling itoa v1.0.14
   Compiling ryu v1.0.18
   Compiling shlex v1.3.0
   Compiling bitflags v1.3.2
   Compiling log v0.4.22
   Compiling regex-syntax v0.8.5
   Compiling cc v1.2.9
   Compiling libc v1.0.0-alpha.1 (/Users/jonathan/Documents/open-source/libc_testing/libc)
   Compiling unicode-width v0.2.0
   Compiling anstyle v1.0.10
   Compiling aho-corasick v1.1.3
   Compiling rustc_version v0.4.1
   Compiling annotate-snippets v0.11.5
   Compiling glob v0.3.2
   Compiling quote v1.0.38
   Compiling dirs-sys v0.3.7
   Compiling syn v2.0.96
   Compiling dirs v2.0.2
   Compiling term v0.6.1
warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:128:15
    |
128 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:137:11
    |
137 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:248:15
    |
248 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:279:15
    |
279 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:285:11
    |
285 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:614:15
    |
614 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:622:11
    |
622 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:653:15
    |
653 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:754:15
    |
754 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:766:11
    |
766 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
    --> src/unix/nto/mod.rs:1277:18
     |
1277 |     if #[cfg(not(target_env = "nto71_iosock"))] {
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
    --> src/unix/nto/mod.rs:2938:18
     |
2938 |     if #[cfg(not(target_env = "nto71_iosock"))] {
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: `libc` (lib) generated 12 warnings
   Compiling regex-automata v0.4.9
   Compiling serde_derive v1.0.217
   Compiling regex v1.11.1
   Compiling garando_pos v0.1.0
   Compiling garando_errors v0.1.0
   Compiling garando_syntax v0.1.1
   Compiling ctest2 v0.4.9
   Compiling libc-test v0.1.0 (/Users/jonathan/Documents/open-source/libc_testing/libc/libc-test)
warning: libc-test@0.1.0: warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: /Users/jonathan/Documents/open-source/libc_testing/libc/target/aarch64-unknown-nto-qnx710/debug/build/libc-test-93769fdecc84d0de/out/libcmsg.a the table of contents is empty (no object file members in the library define global symbols)
warning: libc-test@0.1.0: warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: /Users/jonathan/Documents/open-source/libc_testing/libc/target/aarch64-unknown-nto-qnx710/debug/build/libc-test-93769fdecc84d0de/out/libmain.a the table of contents is empty (no object file members in the library define global symbols)
error[E0432]: unresolved imports `libc::B230400`, `libc::DT_BLK`, `libc::DT_CHR`, `libc::DT_DIR`, `libc::DT_FIFO`, `libc::DT_LNK`, `libc::DT_REG`, `libc::DT_SOCK`, `libc::GRPQUOTA`, `libc::PRIO_MAX`, `libc::PRIO_MIN`, `libc::SA_ONSTACK`, `libc::SA_RESTART`, `libc::USRQUOTA`, `libc::cfmakeraw`, `libc::cfsetspeed`
   --> /Users/jonathan/Documents/open-source/libc_testing/libc/target/aarch64-unknown-nto-qnx710/debug/build/libc-test-93769fdecc84d0de/out/semver.rs:16:5
    |
16  |     B230400,
    |     ^^^^^^^
    |     |
    |     no `B230400` in the root
    |     help: a similar name exists in the module: `B2400`
...
38  |     DT_BLK,
    |     ^^^^^^ no `DT_BLK` in the root
39  |     DT_CHR,
    |     ^^^^^^ no `DT_CHR` in the root
40  |     DT_DIR,
    |     ^^^^^^ no `DT_DIR` in the root
41  |     DT_FIFO,
    |     ^^^^^^^ no `DT_FIFO` in the root
42  |     DT_LNK,
    |     ^^^^^^ no `DT_LNK` in the root
43  |     DT_REG,
    |     ^^^^^^ no `DT_REG` in the root
44  |     DT_SOCK,
    |     ^^^^^^^ no `DT_SOCK` in the root
...
152 |     GRPQUOTA,
    |     ^^^^^^^^ no `GRPQUOTA` in the root
...
276 |     PRIO_MAX,
    |     ^^^^^^^^ no `PRIO_MAX` in the root
277 |     PRIO_MIN,
    |     ^^^^^^^^
...
299 |     SA_ONSTACK,
    |     ^^^^^^^^^^
300 |     SA_RESETHAND,
301 |     SA_RESTART,
    |     ^^^^^^^^^^
...
404 |     USRQUOTA,
    |     ^^^^^^^^
...
485 |     cfmakeraw,
    |     ^^^^^^^^^
...
488 |     cfsetspeed,
    |     ^^^^^^^^^^

For more information about this error, try `rustc --explain E0432`.

@jonathanpallant
Copy link

I'm seeing build warnings that should probably be addressed?

manifest-version = 1

[products.ferrocene]
release = "stable-25.02.0"
packages = [
    "rustc-${rustc-host}",
    "rust-std-${rustc-host}",
    "cargo-${rustc-host}",
    "llvm-tools-${rustc-host}",
    "rust-src",
    "rust-std-aarch64-unknown-nto-qnx710",
]
$ bash -c "source ~/qnx710/qnxsdp-env.sh && criticalup run cargo build --target=aarch64-unknown-nto-qnx710"
QNX_HOST=/Users/jonathan/qnx710/host/darwin/x86_64
QNX_TARGET=/Users/jonathan/qnx710/target/qnx7
MAKEFLAGS=-I/Users/jonathan/qnx710/target/qnx7/usr/include
warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:128:15
    |
128 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:137:11
    |
137 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:248:15
    |
248 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:279:15
    |
279 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:285:11
    |
285 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:614:15
    |
614 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:622:11
    |
622 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:653:15
    |
653 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:754:15
    |
754 |     #[cfg(not(target_env = "nto71_iosock"))]
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
   --> src/unix/nto/mod.rs:766:11
    |
766 |     #[cfg(target_env = "nto71_iosock")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
    --> src/unix/nto/mod.rs:1277:18
     |
1277 |     if #[cfg(not(target_env = "nto71_iosock"))] {
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `nto71_iosock`
    --> src/unix/nto/mod.rs:2938:18
     |
2938 |     if #[cfg(not(target_env = "nto71_iosock"))] {
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: expected values for `target_env` are: ``, `aix`, `gnu`, `illumos`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, `uclibc`, and `wasi`
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: `libc` (lib) generated 12 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s

@flba-eb
Copy link
Contributor Author

flba-eb commented Feb 28, 2025

Most of the warnings are coming from a compiler which does not understand or know the selected target. The unresolved imports should also be caused by the compiler not understanding the target.
Can you try with a nightly?
On the other hand, you've already verified some of the new values. Maybe it is sufficient to review that the structure of the change is okay; I don't see too much value in (manually) verifying all values.

@jonathanpallant
Copy link

Oh, I see! Is this going to raise the MSRV on the libc crate, even for people who aren't using the new target? I was still building it with the old non-io-sock target.

Building with nightly shows that the warnings have gone.

@tgross35
Copy link
Contributor

tgross35 commented Mar 1, 2025

Oh, I see! Is this going to raise the MSRV on the libc crate, even for people who aren't using the new target? I was still building it with the old non-io-sock target.

It's not actually a problem since the warning will be quiet if you're not building the crate directly, but it would probably be good to add the environment to

libc/build.rs

Line 32 in b550c6b

("target_env", &["illumos", "wasi", "aix", "ohos"]),
for anyone working on libc+qnx.

Usually CI denies warnings and tests with the MSRV, but the relevant target_env uses are all gated within the nto module.

@tgross35
Copy link
Contributor

tgross35 commented Mar 2, 2025

@rustbot author

Could you add the check config mentioned above? After that I'm happy to merge.

This also needs a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants