Bug 14849

Summary: rust cross-canadian is not working for all architectures
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Peter Bergin <peter>
Component: devtools / tool chainAssignee: Sundeep KOKKONDA <sundeep.kokkonda>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie, ross.burton
Version: unspecified   
Target Milestone: 4.1 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Peter Bergin 2022-06-29 08:42:18 UTC
With input from Richard Purdie in this thread (https://lists.yoctoproject.org/g/yocto/topic/91864950#57400) it is stated that cross-canadian support for rust is not working.

Here is one example of a non working setup built on a x86_64 machine:

$ cat conf/auto.conf 
MACHINE = "qemuarm64"
SDKMACHINE = "aarch64"
$ bitbake rust-cross-canadian-aarch64

It fails with this error:

<snip>
| Couldn't find required command: ninja (or ninja-build)
| 
| You should install ninja as described at
| <https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages>,
| or set `ninja = false` in the `[llvm]` section of `config.toml`.
| Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
| to download LLVM rather than building it.
| 
| Traceback (most recent call last):
|   File "/work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/rustc-1.60.0-src/src/bootstrap/bootstrap.py", line 1342, in <module>
|     main()
|   File "/work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/rustc-1.60.0-src/src/bootstrap/bootstrap.py", line 1325, in main
|     bootstrap(help_triggered)
|   File "/work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/rustc-1.60.0-src/src/bootstrap/bootstrap.py", line 1311, in bootstrap
|     run(args, env=env, verbose=build.verbose, is_bootstrap=True)
|   File "/work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/rustc-1.60.0-src/src/bootstrap/bootstrap.py", line 185, in run
|     raise RuntimeError(err)
| RuntimeError: failed to run: /work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/rustc-1.60.0-src/build/bootstrap/debug/bootstrap -j 8 build --stage 2 --verbose
| WARNING: /work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/temp/run.do_compile.4136476:177 exit 1 from 'python3 src/bootstrap/bootstrap.py -j 8 "$@" --verbose'
| WARNING: Backtrace (BB generated script):
| 	#1: rust_runx, /work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/temp/run.do_compile.4136476, line 177
| 	#2: do_compile, /work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/temp/run.do_compile.4136476, line 160
| 	#3: main, /work/yocto/poky3/build/tmp/work/aarch64-nativesdk-pokysdk-linux/rust-cross-canadian-aarch64/1.60.0-r0/temp/run.do_compile.4136476, line 200
Comment 1 Randy MacLeod 2022-06-30 14:36:42 UTC
SDKMACHINE=aarch64 MACHINE=qemuarm64 still breaks even the patch give on the email list so please confirm that and work on a more general fix.
Comment 2 Peter Bergin 2022-06-30 14:49:09 UTC
(In reply to comment #1)
> SDKMACHINE=aarch64 MACHINE=qemuarm64 still breaks even the patch give on the
> email list so please confirm that and work on a more general fix.

The fix on the list was not aimed to fix this issue. It was aimed for SDKMACHINE="x86_64" and MACHINE="qemuarm64". This issue was spotted by Richard and has no solution.
Comment 3 Randy MacLeod 2022-08-11 09:15:58 UTC
Sundeep, Peter, 

Please report on whether the rust re-write that Richard has done resolves this problem.
Comment 4 Sundeep KOKKONDA 2022-09-05 12:32:54 UTC
Hello Randy,

With latest sources this problem is solved and build is success without any issues.
Comment 5 Randy MacLeod 2022-09-06 14:09:40 UTC
Sundeep, Great. Please provide an oe-core link to master.
Peter, Does this fix work for you?
Comment 6 Peter Bergin 2022-09-06 18:41:50 UTC
Randy, it has worked for me all the time. I opened this on your request to track the observation from Richard that this was broken. I appreciate all the work done by everyone to get the rust support in a better shape in oe-core.
Comment 7 Randy MacLeod 2022-09-06 21:46:04 UTC
Thanks Peter. Sorry for the noise, i have too much going on and was just trying to ensure that you were happy! 

Sundeep, Please provide the link and resolve the defect.
Comment 8 Sundeep KOKKONDA 2022-09-12 07:11:59 UTC
Issue fixed on latest sources. Checked with patch https://git.openembedded.org/openembedded-core/commit/?h=master-next&id=7cd6faf4e0147eef557f83fb266a25935e26efff on master-next.
Comment 9 Randy MacLeod 2022-09-12 20:46:42 UTC
Sundeep,

Not all commits to master-next are merged to master so please ONLY use commit links to the master or other release branches.

The right link here seems to be:

https://git.openembedded.org/openembedded-core/commit/?id=7cd6faf4e0147eef557f83fb266a25935e26efff

Right?