问题
When attempting to build Jonesforth (32-bit GNU Assembler program) on Ubuntu 16.04.4 64-bit (Xenial Xerus), I'm seeing the following:
~/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
Looking in the file jonesforth.S
, I noticed the following lines:
//#include <asm-i386/unistd.h> // You might need this instead
#include <asm/unistd.h>
I've tried using asm-i386/unistd.h
instead, but that also didn't seem to help.
Is the best course of action to install more headers via sudo apt install linux-headers...
? If so, which should I go with? Should linux-headers-generic
be sufficient?
Or, should I change the header that jonesforth.S
is referring to?
回答1:
Adding -I /usr/include/x86_64-linux-gnu
to the make recipe seems to have solved the issue:
jonesforth: jonesforth.S
gcc -I /usr/include/x86_64-linux-gnu -m32 -nostdlib -static $(BUILD_ID_NONE) -o $@ $<
Thanks to the suggestion from Peter Cordes above!
回答2:
You need to install package multilib
.
来源:https://stackoverflow.com/questions/53685776/building-jonesforth-asm-unistd-h-no-such-file-or-directory