rust: Rework and improve so SDK and target versions work
Quoted 36 lines · Richard Purdie via lists.openembedded.org
This patch:
* Uses RUST_{BUILD|HOST|TARGET}_SYS everywhere consistently within rust context
* Moves the on target libraries to rust's "sysroot" layout so the SDK can find libraries without prompting
* Moves the target SDK libraries into the target sysroot rather than the native one
* Enables the target rustc compiler to be built
* Replaces cargo-cross-canadian with nativesdk-cargo* Drops rust-cross-XXX and uses rust-target-config to generate json config in each WORKDIR
* Add nativeksdk-rust as the SDK compiler
* Simplifies rust-cross-canadian-XXX to be the environment and json config for the target only (no binaries)
* Drop rust-crosssdk since it isnt needed now
* Drop a lot of the virtual/ compiler dependency mess since we don't need it
* Cargo cross-canadian environment config is compiled with rust-cross-canadian
* Adds RUST_{BUILD|HOST|TARGET}_SYS to the variable ignore list for hash purposes (since it should be accounted for in the build paths)
* Adds a slightly hacky approach to make target llvm-config work which removes the need for patching llvm.
* Drop rust-tools-cross-canadian and just build the tools as part of the mainrust/nativesdk-rustrecipe to avoid rebuilding large chunks of the toolchainWork still remaining:
* Fully clean up the dependency simplification and removal of the virutal/ code.
* RemoveRUST_TARGETGENSsince I think it is the same everywhere now
* The rust recipe doesn't need to always build stage0
* The rust recipe doesn't need to always build libstd-rs since we have a separate recipe. May drop the separate recipe and just copy the pieces out of the target rust build
* Maybe drop RUSTC variable, not sure it is used?
* Delete now unneeded rust-llvm llcm-config patchAdding to an SDK looks like:
TOOLCHAIN_LANGS+= "rust"
Quoted 14 lines
Known issues:
* rust target compiler fails for musl:
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/5574
https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/5588
* rust target packages have buildpaths warnings:
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/5585/steps/11/logs/stdio
* mips n32 target rust config and libstd-rs fails:
https://autobuilder.yoctoproject.org/typhoon/#/builders/44/builds/5607
* May be multilib variant issues:
https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/5503
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/3280
* Sundeep reported ld loader symbol relocation issues for libstdc++
* Breaks mingw build as currently configured
https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/5591
The patches in master-next further tweak and improve things. I have fixed the musl issue and many of the buildpaths ones as well as multilib and mingw. This means that we have remaining:
1) buildpaths warnings:
https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/5606
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/5602
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/3294
[and likely a few more as the build completes]
down to two issues:
stdio: WARNING: rust-1.62.0-r0 do_package_qa: QA Issue: File /usr/bin/clippy-driver in package rust-tools-clippy contains reference to TMPDIR [buildpaths]
stdio: WARNING: rust-1.62.0-r0 do_package_qa: QA Issue: File /usr/lib64/librustc_driver-ba615092564ddb01.so in package rust contains reference to TMPDIR [buildpaths]
stdio: WARNING: lib32-rust-1.62.0-r0 do_package_qa: QA Issue: File /usr/lib/librustc_driver-a9887d06b965b287.so in package lib32-rust contains reference to TMPDIR [buildpaths]
stdio: WARNING: lib32-rust-1.62.0-r0 do_package_qa: QA Issue: File /usr/bin/clippy-driver in package lib32-rust-tools-clippy contains reference to TMPDIR [buildpaths]
clippy appears to have a sysroot path encoded into it, the rustc-driver is a path to llvm-config. I did try setting SYSROOT as an environment variable when building clippy with no success. I also tried making the llvm-config a script found via PATH but that failed to build. We may need to patch rust to deal with these.
2) mips n32 issue:
https://autobuilder.yoctoproject.org/typhoon/#/builders/44/builds/5624/steps/25/logs/stdio
| LLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:433> <MCOperand Reg:338>> | LLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:422> <MCOperand Reg:1>> | warning: `libc` (lib) generated 2 warnings (2 duplicates)
when building libstd-rs which may mean my guesses at the target data options are still wrong.
3) Sundeep reported ld loader symbol relocation issues for libstdc++
Fixing 1) is the priority as with that we can prepare the series for submission/review/merging. I'm taking some time away for the next few days so if anyone else wants to fix those...! :)
3) probably needs retesting against the current patches. For 2), not sure.
Cheers,
Richard
Quoted 89 lines · Richard Purdie via lists.openembedded.org
Quoted 36 lines · Richard Purdie via lists.openembedded.org
This patch:
* Uses RUST_{BUILD|HOST|TARGET}_SYS everywhere consistently within rust context
* Moves the on target libraries to rust's "sysroot" layout so the SDK can find libraries without prompting
* Moves the target SDK libraries into the target sysroot rather than the native one
* Enables the target rustc compiler to be built
* Replaces cargo-cross-canadian with nativesdk-cargo* Drops rust-cross-XXX and uses rust-target-config to generate json config in each WORKDIR
* Add nativeksdk-rust as the SDK compiler
* Simplifies rust-cross-canadian-XXX to be the environment and json config for the target only (no binaries)
* Drop rust-crosssdk since it isnt needed now
* Drop a lot of the virtual/ compiler dependency mess since we don't need it
* Cargo cross-canadian environment config is compiled with rust-cross-canadian
* Adds RUST_{BUILD|HOST|TARGET}_SYS to the variable ignore list for hash purposes (since it should be accounted for in the build paths)
* Adds a slightly hacky approach to make target llvm-config work which removes the need for patching llvm.
* Drop rust-tools-cross-canadian and just build the tools as part of the mainrust/nativesdk-rustrecipe to avoid rebuilding large chunks of the toolchainWork still remaining:
* Fully clean up the dependency simplification and removal of the virutal/ code.
* RemoveRUST_TARGETGENSsince I think it is the same everywhere now
* The rust recipe doesn't need to always build stage0
* The rust recipe doesn't need to always build libstd-rs since we have a separate recipe. May drop the separate recipe and just copy the pieces out of the target rust build
* Maybe drop RUSTC variable, not sure it is used?
* Delete now unneeded rust-llvm llcm-config patchAdding to an SDK looks like:
TOOLCHAIN_LANGS+= "rust"Quoted 14 lines
Known issues:
* rust target compiler fails for musl:
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/5574
https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/5588
* rust target packages have buildpaths warnings:
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/5585/steps/11/logs/stdio
* mips n32 target rust config and libstd-rs fails:
https://autobuilder.yoctoproject.org/typhoon/#/builders/44/builds/5607
* May be multilib variant issues:
https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/5503
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/3280
* Sundeep reported ld loader symbol relocation issues for libstdc++
* Breaks mingw build as currently configured
https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/5591The patches in master-next further tweak and improve things. I have fixed the musl issue and many of the buildpaths ones as well as multilib and mingw. This means that we have remaining:
1) buildpaths warnings:
https://autobuilder.yoctoproject.org/typhoon/#/builders/45/builds/5606https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/5602
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/3294
[and likely a few more as the build completes]
down to two issues:
stdio: WARNING: rust-1.62.0-r0do_package_qa: QA Issue: File/usr/bin/clippy-driverin package rust-tools-clippy contains reference to TMPDIR [buildpaths]
stdio: WARNING: rust-1.62.0-r0do_package_qa: QA Issue: File/usr/lib64/librustc_driver-ba615092564ddb01.soin package rust contains reference to TMPDIR [buildpaths]
stdio: WARNING: lib32-rust-1.62.0-r0do_package_qa: QA Issue: File/usr/lib/librustc_driver-a9887d06b965b287.soin package lib32-rust contains reference to TMPDIR [buildpaths]
stdio: WARNING: lib32-rust-1.62.0-r0do_package_qa: QA Issue: File/usr/bin/clippy-driverin package lib32-rust-tools-clippy contains reference to TMPDIR [buildpaths]clippy appears to have a sysroot path encoded into it, the rustc-driver is a path to llvm-config. I did try setting SYSROOT as an environment variable when building clippy with no success. I also tried making the llvm-config a script found via PATH but that failed to build. We may need to patch rust to deal with these.
2) mips n32 issue:
https://autobuilder.yoctoproject.org/typhoon/#/builders/44/builds/5624/steps/25/logs/stdioQuoted 3 lines
LLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:433> <MCOperand Reg:338>> LLVM ERROR: Not supported instr: <MCInst 0 <MCOperand Reg:422> <MCOperand Reg:1>>
warning:libc(lib) generated 2 warnings (2 duplicates)when building libstd-rs which may mean my guesses at the target data options are still wrong.
3) Sundeep reported ld loader symbol relocation issues for libstdc++
Quoted 6 lines
Fixing 1) is the priority as with that we can prepare the series for submission/review/merging. I'm taking some time away for the next few days so if anyone else wants to fix those...! :)
3) probably needs retesting against the current patches. For 2), not sure.
4)
https://autobuilder.yoctoproject.org/typhoon/#/builders/64/builds/5591/steps/11/logs/stdio
some kind of llvm-rust relocation error?
Cheers,
Richard