GNOME Bugzilla – Bug 793291
2.55.2: meson build: incorrect check for res_nclose on linux
Last modified: 2018-02-13 14:19:59 UTC
hello, build of 2.55.2 on linux (system specs below) stops with: ../gio/gthreadedresolver.c: In function `do_lookup_records': ../gio/gthreadedresolver.c:877:2: error: #error "Your platform has res_ninit() \ but not res_nclose() or res_ndestroy(). Please file a bug at https://bugzilla.g\ nome.org/enter_bug.cgi?product=glib" #error "Your platform has res_ninit() but not res_nclose() or res_ndestroy(). \ Please file a bug at https://bugzilla.gnome.org/enter_bug.cgi?product=glib" ^~~~~ Turns out that the reason is meson not finding res_nclose, where it should: [...] Checking if "res_init()" links: YES Checking if "res_nclose()" links: NO [...] In turn, this wrong check for res_nclose is due to the test code in gio/meson.build: # res_nclose() if cc.links('''#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int main (int argc, char ** argv) { struct __res_state res; return res_nclose(&res); }''', args : network_args, name : 'res_nclose()') which fails with: error: void value not ignored as it ought to be return res_nclose(&res); ^~~~~~~~~~ since res_nclose(&res) returns void. The following workaround allows my build to complete successfully: diff -c gio/meson.build.FIX_RES_NCLOSE gio/meson.build *** gio/meson.build.FIX_RES_NCLOSE 2018-02-07 18:22:08.171457763 +0100 --- gio/meson.build 2018-02-07 18:22:08.175457772 +0100 *************** *** 94,100 **** #include <resolv.h> int main (int argc, char ** argv) { struct __res_state res; ! return res_nclose(&res); }''', args : network_args, name : 'res_nclose()') glib_conf.set('HAVE_RES_NCLOSE', 1) endif --- 94,100 ---- #include <resolv.h> int main (int argc, char ** argv) { struct __res_state res; ! res_nclose(&res);return; }''', args : network_args, name : 'res_nclose()') glib_conf.set('HAVE_RES_NCLOSE', 1) endif System specs: => uname -a Linux 4.15.1 #1 SMP Sun Feb 4 13:36:48 CET 2018 x86_64 GNU/Linux => gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/stow.d/versions/gcc-7.3.0/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/balducci/tmp/install-us-d/gcc-5.5.0.d/gcc-7.3.0/configure --prefix=/opt/stow.d/versions/gcc-7.3.0/usr --libdir=/opt/stow.d/versions/gcc-7.3.0/usr/lib64 --libexecdir=/opt/stow.d/versions/gcc-7.3.0/usr/lib64 --enable-shared --disable-bootstrap --enable-languages=c,c++,objc,fortran --enable-multilib Thread model: posix gcc version 7.3.0 (GCC) => python --version Python 3.7.0b1 (default, Feb 1 2018, 17:14:54) [GCC 7.3.0] => meson --version 0.44.0 => /lib64/libc.so.6 GNU C Library (GNU libc) stable release version 2.27. Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 7.3.0. libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>.
Created attachment 368192 [details] [review] build: Fix Meson checks for res_nclose() and res_ndestroy() The checks wouldn’t compile, and hence would always fail. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 368192 [details] [review]: Looks good
Thanks, pushed. Attachment 368192 [details] pushed as 0cd5127 - build: Fix Meson checks for res_nclose() and res_ndestroy()