ubuntu - 建筑琼斯福斯 - asm/unistd.h : No such file or directory

标签 ubuntu gcc assembly gnu-assembler forth

尝试构建 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/

相关文章:

ubuntu - autoconf 配置警告 :/usr/bin/file: No such file or directory

clock_gettime() 在 PC 上运行良好,但在服务器上它会中止编译

c - 为什么在使用 getchar 输入时 putchar 不返回新行?

c - arm gcc const 字符串数组未放置在rodata 中

linux - 如何将此 linux 汇编代码更改为兼容的 UNIX 汇编代码?

string - DASM 汇编器中的 ASCII 到 C64 屏幕代码

C - 在服务器和客户端之间创建无限套接字连接 (Linux)

ubuntu - 在 Ubuntu virtualenv 上 pip 安装 Pillow 时出错

linux - 通过 crontab -e 运行时脚本不运行

c++ - 哪种虚拟机调度方法更有效?