hzcx998 / XBook

This is the new kernel of Book OS, I hope it is a new start.
GNU General Public License v3.0
84 stars 18 forks source link

在 mac 上编译问题 #8

Closed MRNIU closed 2 years ago

MRNIU commented 4 years ago

你好: 我正在尝试在 mac 上跑 XBook,但是在编译过程中遇到了一个小问题,以下是错误报告:

/Library/Developer/CommandLineTools/usr/bin/make -C arch/x86/ -f /***/XBook/src/Makefile.build
/Library/Developer/CommandLineTools/usr/bin/make -C boot -f /***/XBook/src/Makefile.build
make[2]: Nothing to be done for `__build'.
/Library/Developer/CommandLineTools/usr/bin/make -C kernel -f /***/XBook/src/Makefile.build
[CC] arch/x86/kernel/arch.o
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:13:2: error: instruction requires: Not 64-bit mode
        pushl   %ebp
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:17:2: error: instruction requires: Not 64-bit mode
        pushl   %ebx
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:29:2: error: instruction requires: Not 64-bit mode
        pushl   %eax
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:30:2: error: instruction requires: Not 64-bit mode
        call    *%edx
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:43:2: error: instruction requires: Not 64-bit mode
        pushl   %eax
        ^
/var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:44:2: error: instruction requires: Not 64-bit mode
        call    *%edx
        ^
make[2]: *** [arch.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [arch/x86/] Error 2

我对原代码做出了如下修改:

diff --git a/src/makefile b/src/makefile
index a4d771f..f5a3eeb 100644
--- a/src/makefile
+++ b/src/makefile
@@ -14,10 +14,17 @@ all:
 BOCHS_DIR = ../bochs/

 # ar 是库打包工具
-AR     = ar
+ifneq ($(HOSTOS),macos)
+   AR          = gcc-ar-9
+   CC          = gcc-9
+   LD          = ld-9
+else
+   AR          = ar
+   CC          = gcc
+   LD          = ld
+endif
+
 NASM       = nasm
-CC         = gcc
-LD             = ld
 DD             = dd
 QEMU       = qemu-system-i386
 BOCHS      = bochs

 #----dir----
 #arch
@@ -75,7 +82,7 @@ TOPDIR    := $(CURDIR)
 ifeq ($(OS),Windows_NT)
    HOSTOS      := windows
 else
-   ifeq ($(shell uname),Darwin)
+   ifeq ($(shell uname),"Darwin")
        HOSTOS      := macos
    else
        ifeq ($(shell uname),Linux)

这看起来是目标文件格式不一致导致的,请问你有什么解决思路吗(当然能顺手解决掉更好)

谢谢!

hzcx998 commented 4 years ago

你好,     很高兴你能尝试使用这个系统,并且你还在mac平台下面做开发。我只使用过win和linux,mac都没用过,所以我对mac是一无所知,很难帮助到你!如果你成功在mac上运行,记得来信告诉我,帮助我在mac上搭建开发环境,很感谢! --BookOS主开发者拜上

---原始邮件--- 发件人: "Zone.N"<notifications@github.com> 发送时间: 2020年2月2日(星期日) 中午11:44 收件人: "huzichengdevelop/XBook"<XBook@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8)

你好: 我正在尝试在 mac 上跑 XBook,但是在编译过程中遇到了一个小问题,以下是错误报告: /Library/Developer/CommandLineTools/usr/bin/make -C arch/x86/ -f //XBook/src/Makefile.build /Library/Developer/CommandLineTools/usr/bin/make -C boot -f //XBook/src/Makefile.build make[2]: Nothing to be done for `__build'. /Library/Developer/CommandLineTools/usr/bin/make -C kernel -f //XBook/src/Makefile.build [CC] arch/x86/kernel/arch.o /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:13:2: error: instruction requires: Not 64-bit mode pushl %ebp ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:17:2: error: instruction requires: Not 64-bit mode pushl %ebx ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:29:2: error: instruction requires: Not 64-bit mode pushl %eax ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:30:2: error: instruction requires: Not 64-bit mode call %edx ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:43:2: error: instruction requires: Not 64-bit mode pushl %eax ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:44:2: error: instruction requires: Not 64-bit mode call %edx ^ make[2]: [arch.o] Error 1 make[1]: [kernel] Error 2 make: [arch/x86/] Error 2
我对原代码做出了如下修改: diff --git a/src/makefile b/src/makefile index a4d771f..f5a3eeb 100644 --- a/src/makefile +++ b/src/makefile @@ -14,10 +14,17 @@ all: BOCHS_DIR = ../bochs/ # ar 是库打包工具 -AR = ar +ifneq ($(HOSTOS),macos) +AR = gcc-ar-9 +CC= gcc-9 +LD = ld-9 +else +AR = ar +CC= gcc +LD = ld +endif + NASM = nasm -CC= gcc -LD = ld DD = dd QEMU = qemu-system-i386 BOCHS = bochs #----dir---- #arch @@ -75,7 +82,7 @@ TOPDIR:= $(CURDIR) ifeq ($(OS),Windows_NT) HOSTOS:= windows else -ifeq ($(shell uname),Darwin) +ifeq ($(shell uname),"Darwin") HOSTOS:= macos else ifeq ($(shell uname),Linux)
这看起来是目标文件格式不一致导致的,请问你有什么解决思路吗(当然能顺手解决掉更好)

谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MRNIU commented 4 years ago

好的,谢谢

发自我的iPhone

在 2020年2月2日,11:51,Jason Hu notifications@github.com 写道:

你好,     很高兴你能尝试使用这个系统,并且你还在mac平台下面做开发。我只使用过win和linux,mac都没用过,所以我对mac是一无所知,很难帮助到你!如果你成功在mac上运行,记得来信告诉我,帮助我在mac上搭建开发环境,很感谢! --BookOS主开发者拜上

---原始邮件--- 发件人: "Zone.N"<notifications@github.com> 发送时间: 2020年2月2日(星期日) 中午11:44 收件人: "huzichengdevelop/XBook"<XBook@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8)

你好: 我正在尝试在 mac 上跑 XBook,但是在编译过程中遇到了一个小问题,以下是错误报告: /Library/Developer/CommandLineTools/usr/bin/make -C arch/x86/ -f //XBook/src/Makefile.build /Library/Developer/CommandLineTools/usr/bin/make -C boot -f //XBook/src/Makefile.build make[2]: Nothing to be done for `__build'. /Library/Developer/CommandLineTools/usr/bin/make -C kernel -f //XBook/src/Makefile.build [CC] arch/x86/kernel/arch.o /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:13:2: error: instruction requires: Not 64-bit mode pushl %ebp ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:17:2: error: instruction requires: Not 64-bit mode pushl %ebx ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:29:2: error: instruction requires: Not 64-bit mode pushl %eax ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:30:2: error: instruction requires: Not 64-bit mode call %edx ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:43:2: error: instruction requires: Not 64-bit mode pushl %eax ^ /var/folders/mm/6t0gjqhs5_v9pkxwlpfvl0tm0000gn/T//ccGgr1xu.s:44:2: error: instruction requires: Not 64-bit mode call %edx ^ make[2]: [arch.o] Error 1 make[1]: [kernel] Error 2 make: [arch/x86/] Error 2 我对原代码做出了如下修改: diff --git a/src/makefile b/src/makefile index a4d771f..f5a3eeb 100644 --- a/src/makefile +++ b/src/makefile @@ -14,10 +14,17 @@ all: BOCHS_DIR = ../bochs/ # ar 是库打包工具 -AR = ar +ifneq ($(HOSTOS),macos) +AR = gcc-ar-9 +CC= gcc-9 +LD = ld-9 +else +AR = ar +CC= gcc +LD = ld +endif + NASM = nasm -CC= gcc -LD = ld DD = dd QEMU = qemu-system-i386 BOCHS = bochs #----dir---- #arch @@ -75,7 +82,7 @@ TOPDIR:= $(CURDIR) ifeq ($(OS),Windows_NT) HOSTOS:= windows else -ifeq ($(shell uname),Darwin) +ifeq ($(shell uname),"Darwin") HOSTOS:= macos else ifeq ($(shell uname),Linux) 这看起来是目标文件格式不一致导致的,请问你有什么解决思路吗(当然能顺手解决掉更好)

谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/huzichengdevelop/XBook/issues/8?email_source=notifications&email_token=ADC57SQLE7BXOB3OVH7N7ELRAY7NFA5CNFSM4KOXFXSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRNALI#issuecomment-581095469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADC57SUGI5S5GUMD6W54I3DRAY7NFANCNFSM4KOXFXSA.

Dorbmon commented 4 years ago

是不是因为gcc在macos下会自动使用64位模式构建程序?

hzcx998 commented 4 years ago

这个我不清楚,我没有用过mac系统。

---原始邮件--- 发件人: "Dorbmon"<notifications@github.com> 发送时间: 2020年3月10日(星期二) 晚上8:44 收件人: "huzichengdevelop/XBook"<XBook@noreply.github.com>; 抄送: "State change"<state_change@noreply.github.com>;"Jason Hu"<2323168280@qq.com>; 主题: Re: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8)

是不是因为gcc在macos下会自动使用64位模式构建程序?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

MRNIU commented 4 years ago

我记得我当时做过相关调整。。不过记不太清了,这几天有空我再试试

2020年3月10日 下午8:44,Dorbmon notifications@github.com<mailto:notifications@github.com> 写道:

是不是因为gcc在macos下会自动使用64位模式构建程序?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/huzichengdevelop/XBook/issues/8?email_source=notifications&email_token=ADC57SWMCOZG6EBV4QUSILDRGYY2DA5CNFSM4KOXFXSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLIAOI#issuecomment-597065785, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADC57SUDIMMGYGGF6XOCFY3RGYY2DANCNFSM4KOXFXSA.

hzcx998 commented 4 years ago

麻烦你了,希望你解决后可以告诉我,这样,以后有其他人在mac上开发就会少很多麻烦。

---原始邮件--- 发件人: "boss"<notifications@github.com> 发送时间: 2020年3月10日(星期二) 晚上9:04 收件人: "huzichengdevelop/XBook"<XBook@noreply.github.com>; 抄送: "State change"<state_change@noreply.github.com>;"Jason Hu"<2323168280@qq.com>; 主题: Re: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8)

我记得我当时做过相关调整。。不过记不太清了,这几天有空我再试试

2020年3月10日 下午8:44,Dorbmon <notifications@github.com<mailto:notifications@github.com>> 写道:

是不是因为gcc在macos下会自动使用64位模式构建程序?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://github.com/huzichengdevelop/XBook/issues/8?email_source=notifications&amp;email_token=ADC57SWMCOZG6EBV4QUSILDRGYY2DA5CNFSM4KOXFXSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLIAOI#issuecomment-597065785&gt;, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADC57SUDIMMGYGGF6XOCFY3RGYY2DANCNFSM4KOXFXSA&gt;.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

onion108 commented 2 years ago

麻烦你了,希望你解决后可以告诉我,这样,以后有其他人在mac上开发就会少很多麻烦。 ---原始邮件--- 发件人: "boss"<notifications@github.com> 发送时间: 2020年3月10日(星期二) 晚上9:04 收件人: "huzichengdevelop/XBook"<XBook@noreply.github.com>; 抄送: "State change"<state_change@noreply.github.com>;"Jason Hu"<2323168280@qq.com>; 主题: Re: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8) 我记得我当时做过相关调整。。不过记不太清了,这几天有空我再试试 2020年3月10日 下午8:44,Dorbmon <notifications@github.com<mailto:notifications@github.com>> 写道: 是不是因为gcc在macos下会自动使用64位模式构建程序? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#8;, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADC57SUDIMMGYGGF6XOCFY3RGYY2DANCNFSM4KOXFXSA&gt;. — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

我在这里坐等macos(M1)的环境配置教程 *摆烂*

MRNIU commented 2 years ago

建议去 xbook2 看看

2022年5月22日 18:07,27Onion Nebell @.**@.>> 写道:

麻烦你了,希望你解决后可以告诉我,这样,以后有其他人在mac上开发就会少很多麻烦。 …<x-msg://4/#> ---原始邮件--- 发件人: @.**@.>> 发送时间: 2020年3月10日(星期二) 晚上9:04 收件人: @.**@.>>; 抄送: "State @.**@.>>;"Jason @.**@.>>; 主题: Re: [huzichengdevelop/XBook] 在 mac 上编译问题 (#8https://github.com/hzcx998/XBook/issues/8) 我记得我当时做过相关调整。。不过记不太清了,这几天有空我再试试 2020年3月10日 下午8:44,Dorbmon @.**@*.**@*.**@.>>> 写道: 是不是因为gcc在macos下会自动使用64位模式构建程序? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#8https://github.com/hzcx998/XBook/issues/8;, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADC57SUDIMMGYGGF6XOCFY3RGYY2DANCNFSM4KOXFXSA. — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

我在这里坐等macos(M1)的环境配置教程 摆烂

— Reply to this email directly, view it on GitHubhttps://github.com/hzcx998/XBook/issues/8#issuecomment-1133862023, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADC57SRZHELKU4QBB6JOT2DVLIBNLANCNFSM4KOXFXSA. You are receiving this because you modified the open/close state.Message ID: @.***>