Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5197

zabbix-2.0.0 fails to build on uclibc due to res_send()

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Major Major
    • None
    • 2.0.0
    • Installation (I)
    • Alpine Linux. (uClibc rather than glibc)

      Build fails with:

      ...
      ccache gcc -DZABBIX_DAEMON -DSYSCONFDIR="\"/etc\"" -march=i486 -Os -fomit-frame-pointer -pipe    -I/usr/include     -I. -I/usr/include       -rdynamic -Wl,--as-needed  -o zabbix_agentd zabbix_agentd-active.o zabbix_agentd-stats.o zabbix_agentd-cpustat.o zabbix_agentd-diskdevices.o zabbix_agentd-perfstat.o zabbix_agentd-vmstats.o zabbix_agentd-logfiles.o zabbix_agentd-zabbix_agentd.o zabbix_agentd-zbxconf.o zabbix_agentd-listener.o ../../src/libs/zbxsysinfo/libzbxagentsysinfo.a ../../src/libs/zbxsysinfo/linux/libspecsysinfo.a ../../src/libs/zbxsysinfo/agent/libagentsysinfo.a ../../src/libs/zbxsysinfo/common/libcommonsysinfo.a ../../src/libs/zbxsysinfo/simple/libsimplesysinfo.a ../../src/libs/zbxlog/libzbxlog.a ../../src/libs/zbxalgo/libzbxalgo.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxnix/libzbxnix.a ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxexec/libzbxexec.a   -lcurl  -lm   -liconv
      ../../src/libs/zbxsysinfo/common/libcommonsysinfo.a(net.o): In function `dns_query.isra.0':
      net.c:(.text+0x312): undefined reference to `res_send'
      collect2: ld returned 1 exit status
      make[2]: *** [zabbix_agent] Error 1
      make[2]: *** Waiting for unfinished jobs....
      ../../src/libs/zbxsysinfo/common/libcommonsysinfo.a(net.o): In function `dns_query.isra.0':
      net.c:(.text+0x312): undefined reference to `res_send'
      collect2: ld returned 1 exit status
      make[2]: *** [zabbix_agentd] Error 1
      

      The problem is that res_send() is not implemented in uclibc (and probably never will). The use of res_send() was introduced due to ZBXNEXT-467.

      An option would be to test for res_send() separately and if not found only disable the retrans and timeout options and use res_query() like it was in 1.8.

      Index: src/libs/zbxsysinfo/common/net.c
      ===================================================================
      --- src/libs/zbxsysinfo/common/net.c	(revision 28283)
      +++ src/libs/zbxsysinfo/common/net.c	(working copy)
      @@ -418,6 +418,7 @@
       #else	/* not _WINDOWS */
       	res_init();	/* initialize always, settings might have changed */
       
      +#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND)
       	if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
       		return SYSINFO_RET_FAIL;
       
      @@ -436,7 +437,12 @@
       	_res.retry = retry;
       
       	res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
      -
      +#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */
      +	/* retrand and retry are ignored */
      +	if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer))))
      +		return SYSINFO_RET_FAIL;
      +#endif
      +	
       	hp = (HEADER *)answer.buffer;
       
       	if (1 == short_answer)
      Index: configure.in
      ===================================================================
      --- configure.in	(revision 28283)
      +++ configure.in	(working copy)
      @@ -149,6 +149,10 @@
       	AC_MSG_ERROR([Unable to DNS lookup functions "${found_resolv}"])
       fi
       LIBS="${LIBS} ${RESOLV_LIBS}"
      +AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
      +AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
      +AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
      +AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
       
       dnl *****************************************************************
       dnl *                                                               *
      

      A better long-time approach would probably to be to use an external library like c-ares to do the DNS things. I think that would also allow you to control if dns request goes via udp or tcp so you could have both net.udp.dns and net.tcp.dns. That should probably be posted in a separate issue for ZBXNEXT.

            Unassigned Unassigned
            ncopa Natanael Copa
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: