maestro-os / maestro

Unix-like kernel written in Rust
https://blog.lenot.re
GNU Affero General Public License v3.0
2.96k stars 96 forks source link

Be able to build from `aarch64` #10

Open brandonros opened 10 months ago

brandonros commented 10 months ago
$ cargo build
   Compiling macros v0.1.0 (/Users/brandon/Desktop/maestro/macros)
   Compiling maestro v0.1.0 (/Users/brandon/Desktop/maestro)
error: failed to run custom build command for `maestro v0.1.0 (/Users/brandon/Desktop/maestro)`

Caused by:
  process didn't exit successfully: `/Users/brandon/.cargo/target/debug/build/maestro-7fa53f85575e3aad/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=config.toml

  --- stderr
  Configuration file not found

  Please make sure the configuration file at `config.toml` exists`
  An example configuration file can be found in `default.config.toml`
MacBook-Air:maestro brandon 2024-01-07 11:54:32 $ 

Kind of a confusing error because there is a .cargo/config.toml:

 $ ls .cargo/config.toml
.cargo/config.toml

but I'm guessing it expects something different

Doing this:

$ cp default.config.toml config.toml
$ cargo build

gets me further. not sure if this could be documented somewhere more clear

but then I get a whole bunch of weird cc/clang errors:

warning: src/boot/remap.s:44:6: error: malformed expression
warning: unexpected token in operand mov $0x088888, %esisrc/util/libc/memset.s
warning:  : 22unexpected token in operand:2
warning: :  or $1, %alerror: 
warning: invalid instruction, did you mean: b? 
warning:     mov $(0xc0000000 + boot_stack_begin), %esp 
warning:       
warning:   shl %cl, %ebx  src/memory/vmem/paging.s :   jbe 1f 
warning:  45 : 2^
warning:  : error: invalid instruction
warning:  ret
warning:   ^   
warning:  ^
warning:  src/util/libc/memset.s:24:   src/boot/gdt.s :673  :   error: :  ^

It's probably because I'm on aarch64 and it's trying to use $CC without realizing it needs to "cross-compile" I guess?

  exit status: 1
  cargo:warning=ToolExecError: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/idt.o" "-c" "src/idt/idt.s" with args "cc" did not execute successfully (status code exit status: 1).
  exit status: 1
  cargo:warning=ToolExecError: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/syscall.o" "-c" "src/idt/syscall.s" with args "cc" did not execute successfully (status code exit status: 1).
  exit status: 1
  cargo:warning=ToolExecError: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/kernel.o" "-c" "src/kernel.s" with args "cc" did not execute successfully (status code exit status: 1).
  exit status: 1
  cargo:warning=ToolExecError: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/context_switch.o" "-c" "src/process/regs/context_switch.s" with args "cc" did not execute successfully (status code exit status: 1).
  exit status: 0

  --- stderr

  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/context_switch.o" "-c" "src/process/regs/context_switch.s" with args "cc" did not execute successfully (status code exit status: 1).

Not sure if the build.rs script or whatever can detect it needs to find x86/x86_64 compiler if one isn't available natively. I would have guessed changing the build target in .cargo/config.toml was enough

llenotre commented 10 months ago

Hi! Thanks for the report

It may be possible to make the error message a bit clearer, yes.

The compilation issue comes from the fact that the assembly code is using the GNU as syntax. If you are using nasm as an assembler, then you will be trying to compile with the wrong syntax, since nasm uses the Intel syntax.

You can try to use a different assembler by setting the path to it with the AS environment variable I believe (I didn't try it. If it doesn't work, you should try changing the C compiler with CC).

Rewriting all the assembly code under the Intel syntax would be relevant since the inline assembly in the Rust code is already written using the Intel syntax (for consistency).

However I have to think about a way to make sure compilation is possible with both GNU as and nasm.

brandonros commented 10 months ago
 $ CC=/opt/homebrew/bin/i686-elf-gcc AR=/opt/homebrew/bin/i686-elf-ar AS=/opt/homebrew/bin/i686-elf-as cargo build
   Compiling maestro v0.1.0 (/Users/brandon/Desktop/maestro)
error: failed to run custom build command for `maestro v0.1.0 (/Users/brandon/Desktop/maestro)`

Caused by:
  process didn't exit successfully: `/Users/brandon/.cargo/target/debug/build/maestro-7fa53f85575e3aad/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=config.toml
  cargo:rustc-cfg=config_debug_debug
  cargo:rerun-if-changed=src/memory/stack.s
  cargo:rerun-if-changed=src/memory/vmem/paging.s
  cargo:rerun-if-changed=src/boot/remap.s
  cargo:rerun-if-changed=src/boot/a20.s
  cargo:rerun-if-changed=src/boot/boot.s
  cargo:rerun-if-changed=src/boot/gdt.s
  cargo:rerun-if-changed=src/util/libc/memset.s
  cargo:rerun-if-changed=src/util/libc/memcmp.c
  cargo:rerun-if-changed=src/util/libc/strlen.c
  cargo:rerun-if-changed=src/util/libc/memcpy.s
  cargo:rerun-if-changed=src/util/libc/memmove.c
  cargo:rerun-if-changed=src/cpu/control.s
  cargo:rerun-if-changed=src/cpu/cpuid.s
  cargo:rerun-if-changed=src/idt/idt.s
  cargo:rerun-if-changed=src/idt/interrupt.s
  cargo:rerun-if-changed=src/idt/syscall.s
  cargo:rerun-if-changed=src/kernel.s
  cargo:rerun-if-changed=src/process/regs/context_switch.s
  cargo:rerun-if-changed=src/process/regs/regs.s
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_i686-unknown-none
  CC_i686-unknown-none = None
  cargo:rerun-if-env-changed=CC_i686_unknown_none
  CC_i686_unknown_none = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("/opt/homebrew/bin/i686-elf-gcc")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = None
  cargo:rerun-if-env-changed=CFLAGS_i686-unknown-none
  CFLAGS_i686-unknown-none = None
  cargo:rerun-if-env-changed=CFLAGS_i686_unknown_none
  CFLAGS_i686_unknown_none = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/memory/stack.o" "-c" "src/memory/stack.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/memory/vmem/paging.o" "-c" "src/memory/vmem/paging.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/remap.o" "-c" "src/boot/remap.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/a20.o" "-c" "src/boot/a20.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/boot.o" "-c" "src/boot/boot.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/gdt.o" "-c" "src/boot/gdt.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memset.o" "-c" "src/util/libc/memset.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memcmp.o" "-c" "src/util/libc/memcmp.c"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/strlen.o" "-c" "src/util/libc/strlen.c"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memcpy.o" "-c" "src/util/libc/memcpy.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memmove.o" "-c" "src/util/libc/memmove.c"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/cpu/control.o" "-c" "src/cpu/control.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/cpu/cpuid.o" "-c" "src/cpu/cpuid.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/idt.o" "-c" "src/idt/idt.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/interrupt.o" "-c" "src/idt/interrupt.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/syscall.o" "-c" "src/idt/syscall.s"
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/kernel.o" "-c" "src/kernel.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/context_switch.o" "-c" "src/process/regs/context_switch.s"
  running: "/opt/homebrew/bin/i686-elf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-Wall" "-Wextra" "-nostdlib" "-ffreestanding" "-fno-stack-protector" "-mno-red-zone" "-Wall" "-Wextra" "-Tarch/x86/linker.ld" "-o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/regs.o" "-c" "src/process/regs/regs.s"
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  cargo:rerun-if-env-changed=AR_i686-unknown-none
  AR_i686-unknown-none = None
  cargo:rerun-if-env-changed=AR_i686_unknown_none
  AR_i686_unknown_none = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = Some("/opt/homebrew/bin/i686-elf-ar")
  cargo:rerun-if-env-changed=ARFLAGS_i686-unknown-none
  ARFLAGS_i686-unknown-none = None
  cargo:rerun-if-env-changed=ARFLAGS_i686_unknown_none
  ARFLAGS_i686_unknown_none = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  running: ZERO_AR_DATE="1" "/opt/homebrew/bin/i686-elf-ar" "cq" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/libcasm.a" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/memory/stack.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/memory/vmem/paging.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/remap.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/a20.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/boot.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/boot/gdt.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memset.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memcmp.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/strlen.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memcpy.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/util/libc/memmove.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/cpu/control.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/cpu/cpuid.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/idt.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/interrupt.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/idt/syscall.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/kernel.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/context_switch.o" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/src/process/regs/regs.o"
  exit status: 0
  running: "/opt/homebrew/bin/i686-elf-ar" "s" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/libcasm.a"
  exit status: 0
  cargo:rustc-link-lib=static=casm
  cargo:rustc-link-search=native=/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out
  cargo:rerun-if-changed=vdso/linker.ld
  cargo:rerun-if-changed=vdso/x86.s

  --- stderr
  thread 'main' panicked at build_impl/compile.rs:24:42:
  called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

By all means please do not feel obligated to waste precious cycles trying to figure out how to compile this from Apple Silicon Mac OS X (probably not a super common usecase), just thought I'd provide an example of why even with a bunch of brew packages install, I still can't get cargo build to "just work" (If I missed some documentation on expectations for requirements built system wise, I apologize)

brandonros commented 10 months ago

Seems like there's an issue here:

https://github.com/llenotre/maestro/blob/master/build_impl/compile.rs#L23-L24

Not sure if it's because I'm using

export CARGO_TARGET_DIR="$HOME/.cargo/target"

If i change out_dir to let out_dir = PathBuf::from(format!("/tmp/"));, I then get this:

  running: "/opt/homebrew/bin/i686-elf-ar" "s" "/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out/libcasm.a"
  exit status: 0
  cargo:rustc-link-lib=static=casm
  cargo:rustc-link-search=native=/Users/brandon/.cargo/target/x86/debug/build/maestro-5b5a8234f3b77c53/out
  cargo:rerun-if-changed=vdso/linker.ld
  cargo:rerun-if-changed=vdso/x86.s

  --- stderr
  ld: unknown/unsupported architecture name for: -arch armv4t
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)

I have 0 clue where -arch armv4t is coming from...