jdah / jdh-8

An 8-bit minicomputer with a fully custom architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot build on a fresh Ubuntu VM

CountBleck opened this issue · comments

I used a fresh Ubuntu VM, with nothing but GCC, make, perl, VirtualBox Guest Additions, and clang installed.

After having to rename ssize_t to size_t, and installing libreadline-dev, I ran into this:

image

I have little experience writing/compiling C, so I'm pretty much stuck.
What do I need to do to get it built?

See #10

UPDATE :: Apparently Linux libraries that relate to POSIX only have posix compliance if you define that they do. You still have to rename _CLOCK_MONOTONIC_RAW however to CLOCK_MONOTONIC_RAW

@Kylogias I am having the same problem and I changed it from _CLOCK_MONOTONIC_RAW to CLOCK_MONOTONIC_RAW and now its the same error here u go:
ubuntu@default:/jdh-8$ make
mkdir -p bin
clang -o emu/kb.o -c emu/kb.c -std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wno-pointer-arith -Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments
clang -o emu/emu.o -c emu/emu.c -std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wno-pointer-arith -Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments
emu/emu.c:21:34: warning: implicit declaration of function 'fileno' is invalid in C99 [-Wimplicit-function-declaration]
struct pollfd pfds = { .fd = fileno(stdin), .events = POLLIN };
^
emu/emu.c:35:14: warning: implicit declaration of function 'strcasecmp' is invalid in C99 [-Wimplicit-function-declaration]
if (!strcasecmp(speed, "realtime")) {
^
emu/emu.c:99:5: warning: implicit declaration of function 'strlcpy' is invalid in C99 [-Wimplicit-function-declaration]
strlcpy(str, text, sizeof(str));
^
emu/emu.c:170:19: warning: implicit declaration of function 'fmemopen' is invalid in C99 [-Wimplicit-function-declaration]
FILE *f = fmemopen((void *) out, n, "wb");
^
emu/emu.c:170:15: warning: incompatible integer to pointer conversion initializing 'FILE *' (aka 'struct _IO_FILE *') with an expression of type 'int' [-Wint-conversion]
FILE *f = fmemopen((void *) out, n, "wb");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
clang -o emu/libemu.o -c emu/libemu.c -std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wno-pointer-arith -Wno-unused-parameter -Wno-gnu-zero-variadic-macro-arguments
emu/libemu.c:45:17: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
u64 start = NOW(),
^
emu/libemu.c:15:17: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:45:17: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW'
emu/libemu.c:15:31: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:10:21: note: expanded from macro 'MONO_CLOCK'
#define MONO_CLOCK CLOCK_MONOTONIC_RAW
^
emu/libemu.c:51:15: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
now = NOW();
^
emu/libemu.c:15:17: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:51:15: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW'
emu/libemu.c:15:31: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:10:21: note: expanded from macro 'MONO_CLOCK'
#define MONO_CLOCK CLOCK_MONOTONIC_RAW
^
emu/libemu.c:82:41: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
u64 sleep_time = ns_per_step - (NOW() - now);
^
emu/libemu.c:15:17: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:82:41: error: use of undeclared identifier 'CLOCK_MONOTONIC_RAW'
emu/libemu.c:15:31: note: expanded from macro 'NOW'
assert(!clock_gettime(MONO_CLOCK, &ts));
^
emu/libemu.c:10:21: note: expanded from macro 'MONO_CLOCK'
#define MONO_CLOCK CLOCK_MONOTONIC_RAW
^
emu/libemu.c:86:9: warning: implicit declaration of function 'nanosleep' is invalid in C99 [-Wimplicit-function-declaration]
SLEEP(sleep_time);
^
emu/libemu.c:25:13: note: expanded from macro 'SLEEP'
nanosleep(&req, &rem);
^
4 warnings and 3 errors generated.
make: *** [Makefile:57: emu/libemu.o] Error 1
ubuntu@default:~/jdh-8$
I am using multipass (as an ubuntu VM)

commented

This is the same issue as #21, moving discussion there.