luohaha / batboy-mini-kernel

一个简单操作系统,仅供玩耍
GNU General Public License v2.0
21 stars 14 forks source link

Mac OS上编译失败 #2

Open but0n opened 8 years ago

but0n commented 8 years ago
$ make
编译汇编文件 boot/boot.s ...
nasm -f elf -g -F stabs boot/boot.s
make: *** [boot/boot.o] Segmentation fault: 11
make: *** Deleting file `boot/boot.o'

我在编译 vx6 的时候也有类似问题 elf什么的,请问这个在mac上要如何解决? 目前还用不了虚拟机

but0n commented 8 years ago

貌似找到解决方法了, I'm gonna install a cross-compiler gcc suite capable of producing x86 ELF binaries.

luohaha commented 8 years ago

@but0n 我当时是在ubuntu上开发,编译和运行的,在mac上确实没试过。你现在可以了吗?

but0n commented 8 years ago

@luohaha 还没有弄好,

网上有一种说法是:

xcode默认带的gcc编译器都是lvmm做前端的,并非纯正的GNU gcc。

我刚才尝试用brew install gcc49, 但是到make bootstrap那一步电脑就开始烫起来,等了十几分钟还没弄好,我就只好结束进程了。

另外xv6 make时的报错:

***
*** Error: Couldn't find an i386-*-elf version of GCC/binutils.
*** Is the directory with i386-jos-elf-gcc in your PATH?
*** If your i386-*-elf toolchain is installed with a command
*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX
*** environment variable to that prefix and run 'make' again.
*** To turn off this error, run 'gmake TOOLPREFIX= ...'.
***
ld: unknown option: -V
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pic -O -nostdinc -I. -c bootmain.c
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pic -nostdinc -I. -c bootasm.S
ld -m  -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
ld: warning: option -m is obsolete and being ignored
ld: unknown option: -N
make: *** [bootblock] Error 1
luohaha commented 8 years ago

@but0n 我来在我的mac上试试

luohaha commented 8 years ago

@but0n hey!最近太忙忘了回你了。。。在mac上编译和运行这个程序要从新更新整个编译器和连接器等,不太想折腾了。。不过我猜你应该是对自己写一个系统内核比较感兴趣吧,我在写这个程序的时候对我帮助最大的是这个 教程 ,你可以来研究这个。

but0n commented 8 years ago

@luohaha 谢谢!