add aarch64_unknown_nto_qnx700 target - QNX 7.0 support for aarch64le by nyurik · Pull Request #127897 · rust-lang/rust (original) (raw)

This backports the QNX 7.1 aarch64 implementation to 7.0.

This PR bumps libc dependency to 0.2.158

CC: to the folks who did the initial implementation: @flba-eb, @gh-tr, @jonathanpallant, @japaric

Compile target

Note that until qnx700 gets properly released, use BOOTSTRAP_SKIP_TARGET_SANITY=1

Configure qcc build environment

source path/to/qnx7.0/qnxsdp-env.sh

Tell rust to use qcc when building QNX 7.0 targets

export build_env=' BOOTSTRAP_SKIP_TARGET_SANITY=1 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'

Build rust compiler, libs, and the remote test server

env $build_env ./x.py build
--target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700
rustc library/core library/alloc library/std src/tools/remote-test-server

rustup toolchain link stage1 build/host/stage1

Compile "hello world"

source path/to/qnx7.0/qnxsdp-env.sh

cargo new hello_world cd hello_world cargo +stage1 build --release --target aarch64-unknown-nto-qnx700

Configure a remote for testing

Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds.

# ./remote-test-server
starting test server
thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29:
called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Specifying --bind param actually fixes that, and so does setting TMPDIR properly.

Copy remote-test-server to remote device. You may need to use sftp instead.

ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason

scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server qnxdevice:/path/

Connect to the remote device to start the remote tester

The port forwarding (-L) is only needed if the device is not accessible directly via TCP/IP.

Port forwarding allows the tester to connect to the local port instead

ssh -L 12345:127.0.0.1:12345 qnxdevice

on the device, run

rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345

Run test suit

Assume all previous environment variables are still set, or re-init them

export TEST_DEVICE_ADDR="localhost:12345"

tidy needs to be skipped due to using un-published libc dependency

export exclude_tests=' --exclude src/bootstrap --exclude src/tools/error_index_generator --exclude src/tools/linkchecker --exclude src/tools/tidy --exclude tests/ui-fulldeps --exclude rustc --exclude rustdoc --exclude tests/run-make-fulldeps'

env buildenv./x.pytestbuild_env ./x.py test buildenv./x.pytestexclude_tests --stage 1 --target aarch64-unknown-nto-qnx700

try-job: dist-x86_64-msvc