nyurik
July 18, 2024, 5:56am
1
I am trying to backport Blackberry QNX support for 7.0, which uses a (sadly) ancient GCC-5.4 compiler. Some-magically-how the linker is invoked with a -lregex
parameter. This lib is not available for me, and some of its parts are actually part of libc
. How can I prevent rustc from generating that param? I can't seem to find where its coming from.
rust-lang:master
← nyurik:add-qnx-70-target
opened 05:33AM - 18 Jul 24 UTC
This backports the 7.1 implementation to 7.0.
* [ ] HELP! I need to find a w… ay to disable `-lregex` when calling `cc` -- no idea what generates it. For now I simply copy/paste another lib i don' use as `libregex.so`. Note that in this ancient GCC, `libc` might actually have the same functions as found in the modern `libregex`
* [x] use `libgcc.a` instead of `libgcc_s.so` (7.0 used ancient GCC 5.4 which didn't have gcc_s)
CC: to the folks who did the [initial implementation](https://doc.rust-lang.org/rustc/platform-support/nto-qnx.html): @flba-eb, @gh-tr, @jonathanpallant, @japaric
# Compile target
```bash
source /path/to/qnx7.0/qnxsdp-env.sh
export build_env='
CC_aarch64-unknown-nto-qnx700=qcc
CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx
CXX_aarch64-unknown-nto-qnx700=qcc
AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar'
env $build_env \
./x.py build \
--target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \
rustc library/core library/alloc library/std
rustup toolchain link stage1 build/host/stage1
```
# Compile "hello world"
```bash
source /path/to/qnx7.0/qnxsdp-env.sh
cargo new hello_world
cd hello_world
cargo +stage1 build --release --target aarch64-unknown-nto-qnx700
```
bjorn3
July 18, 2024, 1:18pm
2
This is likely
}
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
((major << 10) | (minor)) as ::dev_t
}
}
// Network related functions are provided by libsocket and regex
// functions are provided by libregex.
#[link(name = "socket")]
#[link(name = "regex")]
extern "C" {
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn mknodat(
__fd: ::c_int,
You will need to make that attribute and the functions provided by libregex conditional on the qnx version.
1 Like
nyurik
July 18, 2024, 5:09pm
3
@bjorn you rock, right on the target! Silly me, didn't realize libc would be the first non-rust repo to look at. Fixed in Disable `libregex` for QNX 7.0 by nyurik · Pull Request #3775 · rust-lang/libc · GitHub (pending review & merge)
system
Closed
October 16, 2024, 5:09pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.