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

fail to build test on FreeBSD #47

Closed
miniupnp opened this issue Jan 25, 2018 · 1 comment
Closed

fail to build test on FreeBSD #47

miniupnp opened this issue Jan 25, 2018 · 1 comment
Labels
Milestone

Comments

@miniupnp
Copy link

$ uname -a
FreeBSD t420nnd.cls.to 10.3-RELEASE-p24 FreeBSD 10.3-RELEASE-p24 #0: Wed Nov 15 04:57:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
$ gmake -C test
gmake : on entre dans le répertoire « /home/nanard/code/git/base64/test »
rm -f benchmark test_base64 *.o
cc -std=c99 -O3 -Wall -Wextra -pedantic -o codec_supported.o -c codec_supported.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -o test_base64 test_base64.c codec_supported.o ../lib/libbase64.o
cc -std=c99 -O3 -Wall -Wextra -pedantic -o benchmark benchmark.c codec_supported.o ../lib/libbase64.o -lrt
benchmark.c:101:16: error: use of undeclared identifier 'CLOCK_REALTIME'
        clock_gettime(CLOCK_REALTIME, o_time);
                      ^
benchmark.c:99:35: warning: unused parameter 'o_time' [-Wunused-parameter]
base64_gettime (base64_timespec * o_time)
                                  ^
1 warning and 1 error generated.
gmake: *** [Makefile:24: benchmark] Error 1

Adding -D_XOPEN_SOURCE=600 does the trick

diff --git a/test/Makefile b/test/Makefile
index d104582..11c57a3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,6 +2,7 @@ CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic
 ifdef OPENMP
   CFLAGS += -fopenmp
 endif
+CFLAGS += -D_XOPEN_SOURCE=600
 
 TARGET := $(shell $(CC) -dumpmachine)
 ifneq (, $(findstring darwin, $(TARGET)))
@aklomp aklomp added the bug label Nov 16, 2019
@aklomp aklomp added this to the v0.4.0 milestone Nov 16, 2019
aklomp added a commit that referenced this issue Nov 20, 2019
On FreeBSD, an extra macro must be defined to make CLOCK_REALTIME available.
@aklomp
Copy link
Owner

aklomp commented Nov 20, 2019

Merged, finally. Sorry for the delay, I had moved on to other projects for a while. Thanks for the report!

@aklomp aklomp closed this as completed Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants