首页 > 解决方案 > 构建 Jonesforth - asm/unistd.h:没有这样的文件或目录

问题描述

尝试在 Ubuntu 16.04.4 64 位(Xenial Xerus)上构建Jonesforth(32 位 GNU 汇编程序)时,我看到以下内容:

~/src/jonesforth $ make
gcc -m32 -nostdlib -static -o jonesforth jonesforth.S
jonesforth.S:1154:24: fatal error: asm/unistd.h: No such file or directory
compilation terminated.
Makefile:11: recipe for target 'jonesforth' failed

查看文件jonesforth.S,我注意到以下几行:

//#include <asm-i386/unistd.h>  // You might need this instead
#include <asm/unistd.h>

我尝试过使用asm-i386/unistd.h,但这似乎也没有帮助。

是通过安装更多标头的最佳做法sudo apt install linux-headers...吗?如果是这样,我应该选择哪个?应该linux-headers-generic够了吧?

或者,我应该更改jonesforth.S所指的标题吗?

标签: ubuntugccassemblygnu-assemblerforth

解决方案


添加-I /usr/include/x86_64-linux-gnu到 make recipe 似乎已经解决了这个问题:

jonesforth: jonesforth.S
        gcc -I /usr/include/x86_64-linux-gnu -m32 -nostdlib -static $(BUILD_ID_NONE) -o $@ $<

感谢上面Peter Cordes的建议!


推荐阅读