Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to compile, macos, zig 0.13.0 #6

Open
LucasMW opened this issue Nov 18, 2024 · 4 comments
Open

fails to compile, macos, zig 0.13.0 #6

LucasMW opened this issue Nov 18, 2024 · 4 comments

Comments

@LucasMW
Copy link

LucasMW commented Nov 18, 2024

mkdir -p /tmp/zorro_iso/EFI/BOOT
mkdir /tmp/zorro_iso/Drivers/
cp --force /tmp/limine/BOOTX64.EFI /tmp/limine/limine-uefi-cd.bin /tmp/limine/limine-bios-cd.bin /tmp/limine/limine-bios.sys boot/x86_64/* ramdks.cpio ryu/Ryu /tmp/zorro_iso
cp: illegal option -- -

zig version
0.13.0

@TalonFloof
Copy link
Owner

TalonFloof commented Nov 18, 2024

I build using Ubuntu 24.10, and I don't personally own a Mac so I don't have a way of easily testing this, though I will still try to look into it regardless.

@anta40
Copy link

anta40 commented Nov 27, 2024

@LucasMW I'm also on macOS (15.1.1 ARM) with zig 0.13.0 installed

After tweaking the make iso part a bit like this:

iso-on-macos: build ramdks
	git clone --branch v7.x-binary --depth 1 https://github.com/limine-bootloader/limine /tmp/limine
	mkdir -p /tmp/zorro_iso/EFI/BOOT
	mkdir /tmp/zorro_iso/Drivers/
	cp -f /tmp/limine/BOOTX64.EFI /tmp/limine/limine-uefi-cd.bin /tmp/limine/limine-bios-cd.bin /tmp/limine/limine-bios.sys boot/x86_64/* ramdks.cpio ryu/Ryu /tmp/zorro_iso
	cp -f drivers/out/* /tmp/zorro_iso/Drivers
	mv /tmp/zorro_iso/BOOTX64.EFI /tmp/zorro_iso/EFI/BOOT/BOOTX64.EFI
	xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label /tmp/zorro_iso -o zorroOS.iso
	zig cc /tmp/limine/limine.c -o /tmp/limine/limine
	/tmp/limine/limine bios-install zorroOS.iso
	rm -Rf /tmp/limine
	rm -Rf /tmp/zorro_iso	

It succesfully generate the ISO:

cp -f /tmp/limine/BOOTX64.EFI /tmp/limine/limine-uefi-cd.bin /tmp/limine/limine-bios-cd.bin /tmp/limine/limine-bios.sys boot/x86_64/* ramdks.cpio ryu/Ryu /tmp/zorro_iso
cp -f drivers/out/* /tmp/zorro_iso/Drivers
mv /tmp/zorro_iso/BOOTX64.EFI /tmp/zorro_iso/EFI/BOOT/BOOTX64.EFI
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label /tmp/zorro_iso -o zorroOS.iso
GNU xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.

Drive current: -outdev 'stdio:zorroOS.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 29.4g free
Added to ISO image: directory '/'='/tmp/zorro_iso'
xorriso : UPDATE :      15 files added in 1 seconds
xorriso : UPDATE :      15 files added in 1 seconds
ISO image produced: 2016 sectors
Written to medium : 2016 sectors at LBA 0
Writing to 'stdio:zorroOS.iso' completed successfully.

zig cc /tmp/limine/limine.c -o /tmp/limine/limine
/tmp/limine/limine bios-install zorroOS.iso
Physical block size of 512 bytes.
Installing to GPT. Logical block size of 512 bytes.
Secondary header at LBA 0x1f7f.
Secondary header valid.
GPT partition NOT specified. Attempting GPT embedding.
New maximum count of partition entries: 44.
Stage 2 to be located at 0x1a00 and 0x3e9a00.
Reminder: Remember to copy the limine-bios.sys file in either
          the root, /boot, /limine, or /boot/limine directories of
          one of the partitions on the device, or boot will fail!
Limine BIOS stages installed successfully!
rm -Rf /tmp/limine
rm -Rf /tmp/zorro_iso

Perhaps there's some syntax difference on Linux and macOS's cp. But running the iso:

qemu-system-x86_64 -cdrom zorroOS.iso -smp 2 gives you a crash:

SCR-20241127-ifpq

No idea why. I'll try to build the ISO on Linux perhaps tonight.

@TalonFloof
Copy link
Owner

TalonFloof commented Nov 27, 2024

@anta40 I just applied the changes you mentioned here to the Makefile in commit b7b578b. Not sure what's going on with the integer overflow though.

I haven't had any issues with it, I just built the ISO and it works just fine
Screenshot 2024-11-26 214244

@anta40
Copy link

anta40 commented Nov 27, 2024

@TalonFloof building the ISO on Debian, then running the ISO on Mac works, though

SCR-20241127-oufu

Perhaps the issue is on Zig itself. Oh well, another reason to (still) use Linux :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants