GNOME Bugzilla – Bug 791608
Cannot build at-spi2-core with meson on FreeBSD because of -D_POSIX_C_SOURCE
Last modified: 2018-03-03 17:27:29 UTC
Using -D_POSIX_C_SOURCE on FreeBSD means POSIX 1003.1-1988 with pre-C89 environment, which hides va_copy in C99 and causes linking error: [1/52] Compiling C object 'dbind/dbind@sta/dbind.c.o'. ../../source/at-spi2-core/dbind/dbind.c:58:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration] gettimeofday (&tv, NULL); ^ ../../source/at-spi2-core/dbind/dbind.c:144:3: warning: implicit declaration of function 'va_copy' is invalid in C99 [-Wimplicit-function-declaration] va_copy (args_demarshal, args); ^ 2 warnings generated. [6/52] Linking target dbind/dbind-test. FAILED: dbind/dbind-test clang -o dbind/dbind-test 'dbind/dbind-test@exe/dbtest.c.o' 'dbind/dbind-test@exe/.._atspi_atspi-gmain.c.o' -L/home/lantw44/gnome/devinstall/lib -L/usr/local/lib -Wl,--no-undefined -Wl,--as-needed -march=corei7 -B/home/lantw44/.local/bin -pipe -g3 -O0 -Wl,--start-group dbind/libdbind.a -L/usr/local/lib -ldbus-1 -L/home/lantw44/gnome/devinstall/lib -lglib-2.0 -lintl -Wl,--end-group -L/usr/local/lib -ldbus-1 -L/home/lantw44/gnome/devinstall/lib -lglib-2.0 -lintl dbind/libdbind.a(dbind.c.o): In function `dbind_method_call_reentrant_va': /home/lantw44/gnome/build/at-spi2-core/../../source/at-spi2-core/dbind/dbind.c:144: undefined reference to `va_copy' clang: error: linker command failed with exit code 1 (use -v to see invocation)
Created attachment 365530 [details] [review] meson: Specify version when defining _POSIX_C_SOURCE FreeBSD libc assumes defining _POSIX_C_SOURCE without specifying a version means a pre-C89 environment with the oldest version of POSIX standard, IEEE Std 1003.1-1988, causing va_copy in C99 to be hidden. To resolve this problem, simply provide a version number when defining _POSIX_C_SOURCE.
Ping ... at-spi2-core still fails to build on FreeBSD because of this problem.
Thanks for the patch. Pushed to master as commit ef43d2