Compile on macOS?
hellisabove opened this issue · 4 comments
hellisabove commented
I'm wondering, how can I compile on macOS?
Supercip971 commented
For the moment we don't know how to do it because we don't have a way for testing compilation on macOS :^( .
leap0x7b commented
We provide LLVM compilation, so compiling in macOS should be possible
xez commented
Install dependencies via Homebrew: brew install qemu nasm xorriso llvm binutils
Fix toolchain paths (hack):
diff --git a/makefile b/makefile
index 8a21d3c..0fe9c5c 100644
--- a/makefile
+++ b/makefile
@@ -67,10 +67,8 @@ all: $(ISO)
run: $(ISO)
qemu-system-x86_64 \
-M q35 \
- -cpu host \
-smp 4 \
-m 256M \
- -enable-kvm \
-serial mon:stdio \
-no-reboot \
-no-shutdown \
diff --git a/meta/toolchain/llvm/.build.mk b/meta/toolchain/llvm/.build.mk
index 2a9348f..011764a 100644
--- a/meta/toolchain/llvm/.build.mk
+++ b/meta/toolchain/llvm/.build.mk
@@ -27,7 +27,7 @@ HOST_ARFLAGS=rcs
CROSS_AS=nasm
CROSS_ASFLAGS=-f elf64
-CROSS_CC=clang-12 -target $(CONFIG_ARCH)-none-elf
+CROSS_CC=/opt/homebrew/opt/llvm/bin/clang-12 -target $(CONFIG_ARCH)-none-elf
CROSS_CFLAGS= \
-MD \
$(CFLAGS_STD) \
@@ -54,7 +54,7 @@ CROSS_UCFLAGS= \
-nostdlib \
-D__brutal__=1
-CROSS_LD=ld.lld
+CROSS_LD=/opt/homebrew/opt/llvm/bin/ld.lld
CROSS_KLDFLAGS= \
-Tsources/host/kernel/$(CONFIG_ARCH)/link.ld \
-z max-page-size=0x1000
@@ -63,5 +63,5 @@ CROSS_ULDFLAGS= \
-Tsources/host/brutal/$(CONFIG_ARCH)/link.ld \
-z max-page-size=0x1000
-CROSS_AR=ar
+CROSS_AR=/opt/homebrew/opt/binutils/bin/ar
CROSS_ARFLAGS=rcs
Build and run Brutal: make run CONFIG_TOOLCHAIN=llvm
If you have an x86 Mac, instead of just disabling kvm you can try using hvf
for virtualization. But I didn't try.
sleepy-monax commented
Update: building brutal on MacOS is now fully supported ;)