Skip to content

[New Platform] Build fails on QNX with clang, missing intrinsics? #390

Description

@szclsya

We're trying to use mrustc to bootstrap a rust build environment on a selfhosted QNX system (huge kudos btw, I don't need to go all the way back to OCaml!). Albeit an unsupported environment, we actually went quite far (mrustc itself and minicargo seems to build just fine). We are currently stuck on building std, with the following error:

--- BUILDING std v0.0.0 (68.4% 1r,0w,5b,13c/19t)
> tools/bin/mrustc /var/home/qnx/src/mrustc/rustc-1.90.0-src/library/std/src/lib.rs -o output-1.90.0/libstd.rlib -C emit-depfile=output-1.90.0/libstd.rlib.d --cfg debug_assertions -O -L output-1.90.0 --crate-name std --crate-type rlib --crate-tag 0_0_0 --cfg backtrace_in_libstd --edition 2024 --extern alloc=output-1.90.0/liballoc.rlib --extern cfg_if=output-1.90.0/libcfg_if-1_0_1_H3.rlib --extern panic_abort=output-1.90.0/libpanic_abort.rlib --extern core=output-1.90.0/libcore.rlib --extern unwind=output-1.90.0/libunwind.rlib --extern hashbrown=output-1.90.0/libhashbrown-0_15_4_H1880d.rlib --extern std_detect=output-1.90.0/libstd_detect-0_1_5.rlib --extern rustc_demangle=output-1.90.0/librustc_demangle-0_1_25_H6.rlib --extern libc=output-1.90.0/liblibc-0_2_174_H19.rlib > output-1.90.0/libstd.rlib_dbg.txt
 (68.4% 1r,0w,5b,13c/19t): std v0.0.0
/var/home/qnx/src/mrustc/rustc-1.90.0-src/library/std/src/thread/current.rs:103-104 warn:0: Unexpected attribute cold on expression
/var/home/qnx/src/mrustc/rustc-1.90.0-src/library/std/src/../../backtrace/src/lib.rs:88-89 warn:0: Unexpected attribute no_std on item
MIR ERROR: ::"std-0_0_0"::sys::sync::once::queue::wait<'#omitted,> BB4/TERM: emit_intrinsic_call: Unknown intrinsic 'ptr_mask'
Process was terminated with signal 6
FAILING COMMAND: tools/bin/mrustc /var/home/qnx/src/mrustc/rustc-1.90.0-src/library/std/src/lib.rs -o output-1.90.0/libstd.rlib -C emit-depfile=output-1.90.0/libstd.rlib.d --cfg debug_assertions -O -L output-1.90.0 --crate-name std --crate-type rlib --crate-tag 0_0_0 --cfg backtrace_in_libstd --edition 2024 --extern alloc=output-1.90.0/liballoc.rlib --extern cfg_if=output-1.90.0/libcfg_if-1_0_1_H3.rlib --extern panic_abort=output-1.90.0/libpanic_abort.rlib --extern core=output-1.90.0/libcore.rlib --extern unwind=output-1.90.0/libunwind.rlib --extern hashbrown=output-1.90.0/libhashbrown-0_15_4_H1880d.rlib --extern std_detect=output-1.90.0/libstd_detect-0_1_5.rlib --extern rustc_demangle=output-1.90.0/librustc_demangle-0_1_25_H6.rlib --extern libc=output-1.90.0/liblibc-0_2_174_H19.rlib
Env:  OUT_DIR=/var/home/qnx/src/mrustc/output-1.90.0/build_std CARGO_CRATE_NAME=std CARGO_MANIFEST_DIR=/var/home/qnx/src/mrustc/rustc-1.90.0-src/library/std CARGO_PKG_NAME=std CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0
 (73.7% 0r,0w,5b,14c/19t):

Looks like it is complaining that there's no ptr_mask implementation in src/trans/codegen_c.cpp. However, I tried the same thing on Linux and it compiles without such intrinsics, so I'm really confused. Any idea what's going on?

btw is there any interest in accepting QNX-specific patches? To make it this far we have some local changes (mostly just adding a new platform).

fyi we are building 9fe54be with upstream LLVM/clang 21.1.3 with minimal changes (just enough to make it work on QNX).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions