QNX operation system support

Greetings, Rust community!
I have one simple question: does Rust compiles on QNX OS? I saw a few questions about it, but they were quite old. Any updates about that?

1 Like

Hello :slight_smile:
What do you mean exactly?
Do you want rust compiler for QNX or maybe you're asking about the possibility to compile rust source code for qnx operating system?
As you can see my english isn't that good so you'll have to give me some more details. :slight_smile:
Best regards

My guess is that the question was meant more along the line of "Is is possible to build Rust programs for QNX [regardless of whether this means native tools or cross-compiling]?".

I am interested in this as well, but from what I've gathered: Rust depends heavily on LLVM for target platform support, and [official] LLVM doesn't support QNX. RIM do support LLVM on QNX7, but I haven't seen any signs that they are upstreaming and maintainting their changes -- likely they ported one LLVM version to QNX and are sticking with that.

I don't know how well newer versions of Rust work with old versions of LLVM.

It's pretty strange that RIM aren't supporting, and promoting, Rust on QNX -- it's like the most obvious combo ever.

Hi :slight_smile:
So far I was able to compile example rust code for target platform but I've got problem with linker. As we know we can specify linker for specific target which I did but there are some flags generated for that target for example to link with pthread (-lpthread) which are not appropriate for QNX because there is no pthread library on QNX.
https://www.openqnx.com/newsgroups/viewtopic.php?t=19067

I found this command on internet:
$ rustc +nightly -Z unstable-options --target=aarch64-unknown-linux-gnu --print target-spec-json
{
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "aarch64",
"data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
"dynamic-linking": true,
"env": "gnu",
"executables": true,
"has-elf-tls": true,
"has-rpath": true,
"is-builtin": true,
"linker-flavor": "gcc",
"linker-is-gnu": true,
"llvm-target": "aarch64-unknown-linux-gnu",
"max-atomic-width": 128,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"relro-level": "full",
"target-c-int-width": "32",
"target-endian": "little",
"target-family": "unix",
"target-mcount": "\u0001_mcount",
"target-pointer-width": "64",
"vendor": "unknown"
}

but it does not mention anything about those libraries like pthread. Can anybody tell me where I can find those settings?

Best regards.

These get added by the std build script.

Yikes that's an old post you found -- recent QNX most definitely has support for pthreads. I've used pthreads on 6.5.0 at least.

Hi :slight_smile:

Sorry but that is not true at least not for all supported architectures. For example I have some commercial qnx license and in my case there is no libpthread for aarch64le but I can use multithreading without any problem and I have most recent QNX version which is 7.0.

Ah, ok -- I misunderstood. You meant the actual physical library libpthread.so? In QNX the pthread support is baked into libc.so if I recall correctly. So it has a /usr/include/pthread.h, but no libpthread.so. A least the armv7le version of QNX 6.5.0 has pthreads (in libc.so).

Unfortunately I don't have access to QNX 7 :frowning: ... yet.. :slight_smile:

Ah, ok -- I misunderstood. You meant the actual physical library libpthread.so?

yes

It was already said on that link I provided before :wink:

All our pthread stuff is in libc so you don't need to link against extra
libraries.

and as jethrogb mention before target for aarch64-unknown-linux-gnu tries to link with following libraries:
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=rt");
println!("cargo:rustc-link-lib=pthread");
which is not correct for QNX. :slight_smile:

1 Like

Hi again :slight_smile:
Apologies for double posting but I've got a question.
How can I use this existing target for example aarch64-unknown-linux-gnu but remove those unwanted linker flags like pthread, dl and rt? Are there any tools that can help me do that?
Any links how it is done would be much appreciated. :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.