尝试构建 Jonesforth 时(32 位 GNU 汇编程序)在 Ubuntu 16.04.4 64 位(Xenial Xerus)上,我看到以下内容:
~/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... 安装更多 header 的最佳做法是吗?如果是这样,我应该选择哪个? linux-headers-generic
应该足够了吗?
或者,我应该更改 jonesforth.S
引用的 header 吗?
最佳答案
将 -I/usr/include/x86_64-linux-gnu
添加到 make 配方中似乎已经解决了问题:
jonesforth: jonesforth.S
gcc -I /usr/include/x86_64-linux-gnu -m32 -nostdlib -static $(BUILD_ID_NONE) -o $@ $<
感谢Peter Cordes的建议上面!
关于ubuntu - 建筑琼斯福斯 - asm/unistd.h : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53685776/