After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793291 - 2.55.2: meson build: incorrect check for res_nclose on linux
2.55.2: meson build: incorrect check for res_nclose on linux
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
2.55.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 790954
 
 
Reported: 2018-02-08 08:37 UTC by gabriele balducci
Modified: 2018-02-13 14:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Fix Meson checks for res_nclose() and res_ndestroy() (1.51 KB, patch)
2018-02-09 12:01 UTC, Philip Withnall
committed Details | Review

Description gabriele balducci 2018-02-08 08:37:00 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>.
Comment 1 Philip Withnall 2018-02-09 12:01:53 UTC
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>
Comment 2 Emmanuele Bassi (:ebassi) 2018-02-13 13:43:10 UTC
Review of attachment 368192 [details] [review]:

Looks good
Comment 3 Philip Withnall 2018-02-13 14:19:54 UTC
Thanks, pushed.

Attachment 368192 [details] pushed as 0cd5127 - build: Fix Meson checks for res_nclose() and res_ndestroy()