Xv64 / OS

A UNIX-like OS targeting AMD64 compatible processors
https://www.xv64.org
MIT License
11 stars 4 forks source link

Compilation error on both MacOS and Debian #4

Open anta40 opened 10 months ago

anta40 commented 10 months ago

On MacOS Monterey (with x86_64-elf-gcc installed):

x86_64-elf-gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -O -o out/bootmain.o -g -c kernel/bootmain.c
x86_64-elf-gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -o out/bootasm.o -c kernel/bootasm.S
x86_64-elf-ld -m elf_i386 -nodefaultlibs -N -e start -Ttext 0x7C00 -o out/bootblock.o out/bootasm.o out/bootmain.o
x86_64-elf-ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)
make: *** [out/bootblock] Error 1

Modified Makefile:

# Cross-compiling (e.g., on Mac OS X)
# TOOLPREFIX = /opt/cross/bin/x86_64-elf-
TOOLPREFIX=x86_64-elf-

And on Debian 12. Makefile is't modified at all, and already have gcc-multilib installed:

gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -O -o out/bootmain.o -g -c kernel/bootmain.c
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -o out/bootasm.o -c kernel/bootasm.S
ld -m elf_i386 -nodefaultlibs -N -e start -Ttext 0x7C00 -o out/bootblock.o out/bootasm.o out/bootmain.o
jwhitehorn commented 2 months ago

To confirm, are you trying to build this natively one your machine? Or are you using the bundled build.sh script? I ask because the toolchain for building this OS is specific versions and built with specific options.