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

i586-pc-nto-qnx700 doesn't work because of missing cfg-if branch for 32-bit x86 #4241

Open
jonathanpallant opened this issue Jan 13, 2025 · 0 comments
Labels
C-bug Category: bug

Comments

@jonathanpallant
Copy link

Trying to build i586-pc-nto-qnx700 with this script:

#!/bin/bash
source ~/qnx700/qnxsdp-env.sh
export build_env='
         CC_aarch64_unknown_nto_qnx700=qcc
        CXX_aarch64_unknown_nto_qnx700=qcc
     CFLAGS_aarch64_unknown_nto_qnx700=-Vgcc_ntoaarch64le_cxx
         AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar
         CC_i586_pc_nto_qnx700=qcc
        CXX_i586_pc_nto_qnx700=qcc
     CFLAGS_i586_pc_nto_qnx700=-Vgcc_ntox86_cxx
         AR_i586_pc_nto_qnx700=ntox86-ar
'

env $build_env ./x.py build \
  --target aarch64-apple-darwin,aarch64-unknown-nto-qnx700,i586-pc-nto-qnx700 \
  rustc library/core library/alloc library/std src/tools/remote-test-server

produces this error:

error[E0432]: unresolved imports `crate::c_char`, `crate::c_long`, `crate::c_ulong`
   --> /Users/jonathan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.169/src/macros.rs:84:17
    |
65  | / macro_rules! prelude {
66  | |     () => {
67  | |         /// Frequently-used types that are available on all platforms
68  | |         ///
...   |
84  | |                 c_char, c_double, c_float, c_int, c_long, c_longlong, c_short, c_uchar, c_uint,
    | |                 ^^^^^^                            ^^^^^^ no `c_long` in the root
    | |                 |
    | |                 no `c_char` in the root
    | |                 help: a similar name exists in the module: `c_schar`
85  | |                 c_ulong, c_ulonglong, c_ushort, c_void, intptr_t, size_t, ssize_t, uintptr_t,
    | |                 ^^^^^^^ no `c_ulong` in the root
...   |
88  | |     };
89  | | }
    | |_- in this expansion of `prelude!`
    |
   ::: /Users/jonathan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.169/src/lib.rs:138:9
    |
138 |           prelude!();
    |           ---------- in this macro invocation
    |
    = help: consider importing this type alias instead:
            rustc_std_workspace_core::ffi::c_char
    = help: consider importing this type alias instead:
            rustc_std_workspace_core::ffi::c_long
    = help: consider importing this type alias instead:
            rustc_std_workspace_core::ffi::c_ulong

Building the aarch64 target works.

I believe the fault lies in this block, which is missing a branch for x86.

cfg_if! {
    if #[cfg(target_arch = "x86_64")] {
        mod x86_64;
        pub use self::x86_64::*;
    } else if #[cfg(target_arch = "aarch64")] {
        mod aarch64;
        pub use self::aarch64::*;
    } else {
        panic!("Unsupported arch");
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant