Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on a fresh Ubuntu VM #20

Closed
CountBleck opened this issue Jul 28, 2021 · 4 comments
Closed

Cannot build on a fresh Ubuntu VM #20

CountBleck opened this issue Jul 28, 2021 · 4 comments

Comments

@CountBleck
Copy link

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?

@Kylogias
Copy link
Contributor

See #10

@Kylogias
Copy link
Contributor

Kylogias commented Aug 4, 2021

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

@hdfsyu
Copy link

hdfsyu commented Sep 14, 2021

@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)

@jdah
Copy link
Owner

jdah commented Oct 22, 2021

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

@jdah jdah closed this as completed Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants