问题描述
我正在尝试使用交叉编译器编译用 C++ 编写的内核,但是每当我尝试链接文件时,它都会引发上述错误。有这样的问题,但没有一个提供有效的解决方案。
make file(我依次调用 make kernel、make buildimg 和 make run)
ld 命令的完整输出:
ld: i386 architecture of input file `lib/kernel.o' is incompatible with i386:x86-64 output
make: *** [Makefile:33: link] Error 1
gcc 版本:
i686-elf-gcc (GCC) 10.2.0
copyright (C) 2020 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
经过进一步检查,它会抛出此错误,因为它将内核编译为 32 bit intel 80386
,而将其他所有内容编译为 64 bit x86-64
,这令人困惑,因为对两者都运行完全相同的命令,只是它正在编译的文件是不一样
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)