GNOME Bugzilla – Bug 786306
build failure on freebsd
Last modified: 2017-10-05 15:42:48 UTC
Hello, on FreeBSD 11.1, with clang 4.0.0, build produces warnings and eventually errors about undeclared <math.h> functions such as lrint or round. _POSIX_C_SOURCE defaults to 199009 on this platform which predates these C99 functions, which are then excluded by the CPP. So you need to either set a value to _POSIX_C_SOURCE or you may simply just drop it, with _DEFAULT_SOURCE and may be even the c99 flag (unless you really want to stick to that version and prohibit C11 stuff).
Setting _POSIX_C_SOURCE to 200809L would fix the build except for tests/pixbuf-readonly-to-mutable.c because undefined MAP_ANON (easy to replace with a fd to /dev/zero) and undefined _SC_PAGE_SIZE for which I'm not able to find a solution.
Hi, this still blocking on 3.26.
I'd need a patch to fix this.
Created attachment 360145 [details] [review] proposed fix for FreeBSD I'm not sure if the question is for me because it's up to the maintainer to chose which standards he wants to stick with, but here's something that works on FreeBSD. - I bump the POSIX requirement to build everything by bringing in the C99 math functions - I fix one example by using the correct sysconf argument (Linux man says that it's an alias) and mapping /dev/zero instead of MAP_ANON (I could not find it in any standard supporting thi macro). Tested only on FreeBSD 11.1 with clang 4.0 (I believe that anyone running clang on linux would also be able to reproduce this): - build OK - system-monitor runs fine
Created attachment 360970 [details] [review] tests: Fix read-only to mutable on FreeBSD
Attachment 360970 [details] pushed as f133b06 - tests: Fix read-only to mutable on FreeBSD