hikalium / liumos

A toy operating system which supports NVDIMM natively.
MIT License
270 stars 24 forks source link

`make` fails due to missing llvm@8 on M1 Mac #67

Open d0iasm opened 2 years ago

d0iasm commented 2 years ago

make command fails on M1 Mac because LLVM 8 requires the x86_64 architecture and the toolchain can't be installed.

(liumos) $ make
...

/opt/homebrew/opt/llvm@8/bin/clang++ -DLIUMOS_LOADER -target x86_64-pc-win32-coff -fno-stack-protector -fno-exceptions -fshort-wchar -fno-rtti -mno-red-zone -nostdlibinc -nostdlib -D_LIBCPP_HAS_NO_THREADS -D_LIBCPP_OBJECT_FORMAT_COFF -I../third_party/out/root_for_kernel/include -Wall -Wpedantic -Wextra -Wconditional-uninitialized -Wshorten-64-to-32 -Werror -Wno-keyword-macro -std=c++17 \
                -c -o acpi.o acpi.cc
make[2]: /opt/homebrew/opt/llvm@8/bin/clang++: No such file or directory
/opt/homebrew/opt/llvm@8/bin/clang++ -DLIUMOS_LOADER -target x86_64-pc-win32-coff -fno-stack-protector -fno-exceptions -fshort-wchar -fno-rtti -mno-red-zone -nostdlibinc -nostdlib -D_LIBCPP_HAS_NO_THREADS -D_LIBCPP_OBJECT_FORMAT_COFF -I../third_party/out/root_for_kernel/include -Wall -Wpedantic -Wextra -Wconditional-uninitialized -Wshorten-64-to-32 -Werror -Wno-keyword-macro -std=c++17 \
                -c -o apic.o apic.cc
make[2]: /opt/homebrew/opt/llvm@8/bin/clang++: No such file or directory
/opt/homebrew/opt/llvm@8/bin/clang -target x86_64-pc-win32-coff -fno-stack-protector -fno-exceptions -fshort-wchar -mno-red-zone -nostdlibinc -Wall -Wpedantic -Wextra -Wconditional-uninitialized -Wshorten-64-to-32 -Werror -Wno-keyword-macro -std=c11 -I../third_party/out/root_for_kernel/include \
                -c -o asm.o asm.S
make[2]: /opt/homebrew/opt/llvm@8/bin/clang: No such file or directory
$ brew install llvm@8
llvm@8: The x86_64 architecture is required for this software.
Error: llvm@8: An unsatisfied requirement failed this build.

This was solved by updating scripts/gen_tool_defs_macos.sh to specify a different llvm version. However, it may lead unexpected behavior depending on the environment.

// scripts/gen_tool_defs_macos.sh
LLVM_PREFIX=`brew --prefix llvm`

Can we consider to update LLVM version? At least /opt/homebrew/opt/llvm@13 can be installed on my M1 Mac.