nuta / resea

A microkernel-based hackable operating system.
Other
522 stars 29 forks source link

Can't compile project #2

Closed ghost closed 4 years ago

ghost commented 4 years ago

The make command says

CC kernel/main.c clang: error: unknown argument: '-fstack-size-section' Makefile:116: recipe for target 'build/kernel/kernel/main.o' failed make: *** [build/kernel/kernel/main.o] Error 1

After commenting out CFLAGS += -fstack-size-section I get a lot of

warning: unknown warning option '-Werror=pointer-integer-compare'; did you mean '-Werror=string-compare'? [-Wunknown-warning-option] 1 warning generated.

The compilation stops with

LD build/user/kvs.debug.elf SYMBOLS build/user/kvs.debug.elf STRIP build/user/kvs.elf make: llvm-objcopy: Command not found Makefile:187: recipe for target 'build/user/kvs.elf' failed make: *** [build/user/kvs.elf] Error 127

Fixed it by adding "-6.0" here OBJCOPY := $(LLVM_PREFIX)llvm-objcopy-6.0$(LLVM_SUFFIX)

Then I get

LD build/user/init.debug.elf SYMBOLS build/user/init.debug.elf STRIP build/user/init.elf OBJCOPY build/init.bin llvm-objcopy-6.0: Unknown command line argument '-j.initfs'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-stats'? llvm-objcopy-6.0: Unknown command line argument '-j.text'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-j'? llvm-objcopy-6.0: Unknown command line argument '-j.data'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-stats'? llvm-objcopy-6.0: Unknown command line argument '-j.rodata'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-mxgot'? llvm-objcopy-6.0: Unknown command line argument '-j.bss'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-j'? llvm-objcopy-6.0: Unknown command line argument '-Obinary'. Try: 'llvm-objcopy-6.0 -help' llvm-objcopy-6.0: Did you mean '-O'? Makefile:107: recipe for target 'build/init.bin' failed make: *** [build/init.bin] Error 1

After adding a space between all "-j" and "-O" make says

LD build/user/init.debug.elf SYMBOLS build/user/init.debug.elf STRIP build/user/init.elf OBJCOPY build/init.bin llvm-objcopy-6.0: 'build/user/init.elf': The file was not recognized as a valid object file Makefile:107: recipe for target 'build/init.bin' failed make: *** [build/init.bin] Error 1

I don't know what to do. I'm on Linux Mint x64. clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)

ghost commented 4 years ago

So I uncommented CFLAGS += -fstack-size-section and created a symlink sudo ln -s /usr/lib/llvm-9/bin/clang /usr/bin/clang and now make says

CC kernel/main.c CC kernel/task.c CC kernel/ipc.c CC kernel/syscall.c CC kernel/memory.c CC kernel/printk.c CC kernel/kdebug.c CC kernel/arch/x64/task.c CC kernel/arch/x64/vm.c CC kernel/arch/x64/serial.c CC servers/kvs/main.c CC libs/std/init.c CC libs/std/syscall.c CC libs/std/printf.c CC libs/std/malloc.c CC libs/std/io.c CC libs/std/lookup.c CC libs/std/session.c CC libs/std/async.c CC libs/std/arch/x64/start.S LD build/user/libs/std.o CC libs/stubs/tcpip.c LD build/user/libs/stubs.o CC libs/common/string.c CC libs/common/vprintf.c CC libs/common/ubsan.c CC libs/common/arch/x64/memcpy.S LD build/user/kvs.debug.elf SYMBOLS build/user/kvs.debug.elf STRIP build/user/kvs.elf CC servers/tcpip/main.c CC servers/tcpip/arp.c CC servers/tcpip/device.c CC servers/tcpip/dhcp.c CC servers/tcpip/ethernet.c CC servers/tcpip/ipv4.c CC servers/tcpip/mbuf.c CC servers/tcpip/tcp.c CC servers/tcpip/udp.c CC servers/tcpip/stats.c LD build/user/tcpip.debug.elf SYMBOLS build/user/tcpip.debug.elf STRIP build/user/tcpip.elf CC servers/ps2kbd/main.c LD build/user/ps2kbd.debug.elf SYMBOLS build/user/ps2kbd.debug.elf STRIP build/user/ps2kbd.elf CC servers/display/main.c LD build/user/display.debug.elf SYMBOLS build/user/display.debug.elf STRIP build/user/display.elf CC servers/e1000/main.c CC servers/e1000/e1000.c CC servers/e1000/pci.c LD build/user/e1000.debug.elf SYMBOLS build/user/e1000.debug.elf STRIP build/user/e1000.elf CC servers/shell/main.c LD build/user/shell.debug.elf SYMBOLS build/user/shell.debug.elf STRIP build/user/shell.elf CC servers/webapi/main.c LD build/user/webapi.debug.elf SYMBOLS build/user/webapi.debug.elf STRIP build/user/webapi.elf CC servers/benchmark/main.c LD build/user/benchmark.debug.elf SYMBOLS build/user/benchmark.debug.elf STRIP build/user/benchmark.elf CC servers/hello/main.c LD build/user/hello.debug.elf SYMBOLS build/user/hello.debug.elf STRIP build/user/hello.elf CC servers/init/main.c CC servers/init/pages.c LD build/user/init.debug.elf SYMBOLS build/user/init.debug.elf STRIP build/user/init.elf OBJCOPY build/init.bin llvm-objcopy-6.0: 'build/user/init.elf': The file was not recognized as a valid object file Makefile:107: recipe for target 'build/init.bin' failed make: *** [build/init.bin] Error 1

nuta commented 4 years ago

LLVM/Clang 6.x is too old to build Resea. Could you try with version 8.x or higher?

Also, LLVM_SUFFIX option would be helpful:

$ make LLVM_SUFFIX=-8 run