tools icon indicating copy to clipboard operation
tools copied to clipboard

RPI4 Build - Panic Crash on Building AMDGPUGenAsmWriter

Open billmcilhargey opened this issue 7 months ago • 4 comments

It looks like when building for RPI it is attempting to buuld the AMDGPUGenAsmWriter.inc section and I don't believe this is needed for RPI? If this is correct, is there, away to skip this or any ideas on why this may be failing? Below is an excerpt of the logs from an RPI4 that this was building on.

[ 47% 1710/3592] Building AMDGPUGenAsmMatcher.inc...
FAILED: lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc /usr/obj/usr/ports/lang/rust/work/_build/aarch64-unknown-freebsd/llvm/build/lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc 
cd /usr/obj/usr/ports/lang/rust/work/_build/aarch64-unknown-freebsd/llvm/build && /usr/obj/usr/ports/lang/rust/work/_build/aarch64-unknown-freebsd/llvm/build/bin/llvm-tblgen -gen-asm-matcher -I /usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/llvm-project/llvm/lib/Target/AMDGPU -I/usr/obj/usr/ports/lang/rust/work/_build/aarch64-unknown-freebsd/llvm/build/include -I/usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/llvm-project/llvm/include -I /usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/llvm-project/llvm/lib/Target -no-warn-on-unused-template-args /usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.td --write-if-changed -o lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc -d lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc.d
[ 47% 1710/3592] Building AArch64GenSubtargetInfo.inc...
[ 47% 1710/3592] Building AMDGPUGenCallingConv.inc...
[ 47% 1710/3592] Building AMDGPUGenAsmWriter.inc...
ninja: build stopped: subcommand failed.

thread 'main' panicked at /usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/cmake-0.1.48/src/lib.rs:975:5:

command did not execute successfully, got: exit status: 1

build script failed, must exit now
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: cmake::fail
   3: cmake::run
   4: cmake::Config::build
   5: <bootstrap::core::build_steps::llvm::Llvm as bootstrap::core::builder::Step>::run
             at ./src/bootstrap/src/core/build_steps/llvm.rs:570:9
   6: bootstrap::core::builder::Builder::ensure
             at ./src/bootstrap/src/core/builder/mod.rs:1478:23
   7: <bootstrap::core::build_steps::compile::Assemble as bootstrap::core::builder::Step>::run
             at ./src/bootstrap/src/core/build_steps/compile.rs:1810:17
   8: bootstrap::core::builder::Builder::ensure
             at ./src/bootstrap/src/core/builder/mod.rs:1478:23
   9: bootstrap::core::builder::Builder::compiler
             at ./src/bootstrap/src/core/builder/mod.rs:1218:9
  10: <bootstrap::core::build_steps::dist::Rustc as bootstrap::core::builder::Step>::make_run
             at ./src/bootstrap/src/core/build_steps/dist.rs:371:39
  11: bootstrap::core::builder::StepDescription::maybe_run
             at ./src/bootstrap/src/core/builder/mod.rs:418:13
  12: bootstrap::core::builder::StepDescription::run
             at ./src/bootstrap/src/core/builder/mod.rs:468:21
  13: bootstrap::core::builder::Builder::run_step_descriptions
             at ./src/bootstrap/src/core/builder/mod.rs:1204:9
  14: bootstrap::core::builder::Builder::execute_cli
             at ./src/bootstrap/src/core/builder/mod.rs:1184:9
  15: bootstrap::Build::build
             at ./src/bootstrap/src/lib.rs:616:17
  16: bootstrap::main
             at ./src/bootstrap/src/bin/main.rs:97:5
  17: core::ops::function::FnOnce::call_once
             at /wrkdirs/usr/ports/lang/rust-bootstrap/work-aarch64/rustc-1.85.0-src/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
	finished in 10886.994 seconds
Traceback (most recent call last):
  File "/usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/x.py", line 53, in <module>
    bootstrap.main()
  File "/usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 1339, in main
    bootstrap(args)
  File "/usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 1314, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/usr/obj/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 236, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /usr/obj/usr/ports/lang/rust/work/_build/bootstrap/debug/bootstrap dist --jobs=4
*** Error code 1

Stop.
make[5]: stopped in /usr/ports/lang/rust
*** Error code 1

Stop.
make[4]: stopped in /usr/ports/devel/py-setuptools-rust
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/py-maturin
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/security/py-cryptography
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/py-pyjwt
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/py-redis

Thank you!

billmcilhargey avatar Jun 02 '25 01:06 billmcilhargey

If this is a rust build issue we don’t have much choice but to exclude all rust from RPI4 builds, but as mentioned before it needs a device ignore which isn’t much code but it needs to be done.

Cheers, Franco

fichtner avatar Jun 02 '25 05:06 fichtner

As your talking about a specific build include item

Not sure if it is worth or possible or just expected to install this

>>> Running build step: base
>>> Passing arguments: (none)
pkg: No package(s) matching u-boot-rpi4
>>> Required package 'u-boot-rpi4' is not installed.
*** Error code 1

>>> Running build step: base
>>> Passing arguments: (none)
pkg: No package(s) matching rpi-firmware
>>> Required package 'rpi-firmware' is not installed.
*** Error code 1

If you dont have the above packages on build request (when you run this command), you get the above errors

make base kernel packages arm-3G DEVICE=RPI DEBUG=1

Workaround / proper fix:

sudo pkg install -y u-boot-rpi4 rpi-firmware

Not sure if you want to detect and auto-install as part of the script when running DEVICE=RPI or just expect to have these?

billmcilhargey avatar Jun 06 '25 15:06 billmcilhargey

When the build complains these packages are missing the user can install them as you described. Installing automatically wouldn’t always work and clutter the system depending on which devices you build for and some packages may even have conflicts between each other.

The packages are required for a proper bootable ARM image which is what you seem to be trying to do. 😊

fichtner avatar Jun 06 '25 19:06 fichtner

Since stuck on the AMDGPUGenAsmWriter crashing item during the build process on an RPI, until a package can be ignored for building on the RP,I I am attempting to build on an Apple M2 in Parallels and will see if the package builds and then transfers successfully there and will keep you al updated

still running this command and let me know if it is outdated and appreciate all the help again!

sudo sh -c 'make base kernel packages arm-3G DEVICE=RPI DEBUG=1 2>&1 | tee /usr/tools/build.log'

FYI these two articles are needed to get the RPI 4 working on FreeBSD and Parallels working on Apple M processors

RPI 4 with 4GB+ memory: https://x.com/computeronix/status/1932088187599368427

FreeBSD running on Parallels on Apple Silicon https://x.com/computeronix/status/1930982309957673179

Will get OPNSense to work on an RPI limited IoT device and see how minimal we can get it to run 👍

billmcilhargey avatar Jun 21 '25 19:06 billmcilhargey

Haven't heard back. If we still need to do something let me know.

fichtner avatar Oct 30 '25 12:10 fichtner