brutal-org/brutal

Unused parameter 'magic' while building on MacOS

br337 opened this issue · 5 comments

br337 commented

I have followed the given build instructions (building.md) but have been running into the same problem while trying to build on MacOS (ARM).

sources/kernel/x86_64/boot.c:25:51: error: unused parameter 'magic' [-Werror,-Wunused-parameter]
void arch_entry_main(Handover *handover, uint64_t magic)
                                                  ^
1 error generated.
make: *** [bin/devel/x86_64-kernel-llvm/kernel/x86_64/boot.c.o] Error 1

The needed packages are already installed:

➜  brutal git:(main) brew install qemu nasm xorriso llvm binutils wget pkg-config sdl2
Warning: qemu 7.1.0 is already installed and up-to-date.
To reinstall 7.1.0, run:
  brew reinstall qemu
Warning: nasm 2.15.05 is already installed and up-to-date.
To reinstall 2.15.05, run:
  brew reinstall nasm
Warning: xorriso 1.5.4 is already installed and up-to-date.
To reinstall 1.5.4, run:
  brew reinstall xorriso
Warning: llvm 15.0.3 is already installed and up-to-date.
To reinstall 15.0.3, run:
  brew reinstall llvm
Warning: binutils 2.39_1 is already installed and up-to-date.
To reinstall 2.39_1, run:
  brew reinstall binutils
Warning: wget 1.21.3 is already installed and up-to-date.
To reinstall 1.21.3, run:
  brew reinstall wget
Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
Warning: sdl2 2.24.1 is already installed and up-to-date.
To reinstall 2.24.1, run:
  brew reinstall sdl2

The needed environment variables have also been set.

What is the output of clang --version ?

br337 commented
➜  ~ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Yeah you need at least clang 13 for building brutal, make sure the clang version you installed with homebrew is in your path ;)

br337 commented

I just took a second look and you are right, the environment variables weren't pointing at the right binaries.
I'm not sure how this behaves on other macos machines, but I'd suggest editing the building.md to address this issue.
Otherwise, this is what I changed and now that problem is fixed, although in doing that, I stumbled upon a different problem that I will address in a different issue (#132).

export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

Well, homebrew show you a warning when you install llvm telling you that you have to add llvm to your PATH explicitly