交叉编译 – autotools:C编译器无法创建可执行文件
发布时间:2020-12-16 07:30:00 所属栏目:百科 来源:网络整理
导读:我在OS X上构建了一个x86_64-elf内核.我的构建系统是autotools.我在OS X上成功编译了 gcc以交叉编译x86_64-elf.当我运行从autotools生成的configure脚本时,我遇到了一个问题: configure: error: C compiler cannot create executablesSee `config.log' for
我在OS X上构建了一个x86_64-elf内核.我的构建系统是autotools.我在OS X上成功编译了
gcc以交叉编译x86_64-elf.当我运行从autotools生成的configure脚本时,我遇到了一个问题:
configure: error: C compiler cannot create executables See `config.log' for more details 所以我看一下config.log并看到: cannot find crt0.o: No such file or directory collect2: error: ld returned 1 exit status 这很有道理.交叉编译器不会生成可执行文件,因为没有关联的运行时.但我不需要或希望我的编译器生成可执行文件,我将为我的引导程序适当地链接它.我怎么告诉autotools不检查这个? 解决方法
运行configure脚本时,请确保指定以下gcc标志(将它们添加到CFLAGS环境变量):
-nostdlib -nostartfiles -nodefaultlibs -ffreestanding 如果您不知道如何将这些附加到CFLAGS的末尾,请尝试以下方法: export CFLAGS=$CFLAGS -nostdlib -nostartfiles -nodefaultlibs -ffreestanding (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |