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

Compilation fails when specifying package with DIR using configure option --with-<package>=[DIR] if multiple versions of package are installed

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Minor Minor
    • 1.8.6
    • 1.8.7, 1.9.5 (alpha)
    • Proxy (P), Server (S)
    • None

      When you specify the location of package with configure option --with-package (e. g. --with-ssh2=/root/libssh2-1.2.8-install) and there is another one installed in the standard location of the system (/usr) compilation will use the one in the system. Take this example:

      (libssh2 version 0.17 in the system)

      1. rpm -q libssh2-devel
        libssh2-devel-0.17
      1. rpm -ql libssh2-devel | grep "\.so"
        /usr/lib64/libssh2.so

      (libssh2 version 1.2.8 in /root)

      1. ls /root/libssh2-1.2.8-install/lib/libssh2.so
        /root/libssh2-1.2.8-install/lib/libssh2.so
      1. ./configure --enable-server --with-ssh2=/root/libssh2-1.2.8-install --with-mysql

      Configure passes check for libssh2 version > 1.0 so it uses the one in /root . Next we run make:

      [...]
      gcc -g -O2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -I/root/libssh2-1.2.8-install/include -rdynamic -o zabbix_server -L/usr/lib64/mysql -L/usr/lib64 -L/root/libssh2-1.2.8-install/lib zabbix_server-actions.o zabbix_server-operations.o zabbix_server-events.o zabbix_server-zlog.o zabbix_server-server.o alerter/libzbxalerter.a dbsyncer/libzbxdbsyncer.a dbconfig/libzbxdbconfig.a discoverer/libzbxdiscoverer.a pinger/libzbxpinger.a poller/libzbxpoller.a housekeeper/libzbxhousekeeper.a timer/libzbxtimer.a trapper/libzbxtrapper.a nodewatcher/libzbxnodewatcher.a utils/libzbxutils.a httppoller/libzbxhttppoller.a watchdog/libzbxwatchdog.a escalator/libzbxescalator.a proxypoller/libzbxproxypoller.a selfmon/libzbxselfmon.a ../../src/libs/zbxsysinfo/libzbxserversysinfo.a ../../src/libs/zbxsysinfo/linux/libspecsysinfo.a ../../src/libs/zbxsysinfo/common/libcommonsysinfo.a ../../src/libs/zbxsysinfo/simple/libsimplesysinfo.a ../../src/libs/zbxlog/libzbxlog.a ../../src/libs/zbxdbcache/libzbxdbcache.a ../../src/libs/zbxmemory/libzbxmemory.a ../../src/libs/zbxalgo/libzbxalgo.a ../../src/libs/zbxnix/libzbxnix.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxmedia/libzbxmedia.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxcommshigh/libzbxcommshigh.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxexec/libzbxexec.a ../../src/libs/zbxself/libzbxself.a ../../src/libs/zbxserver/libzbxserver.a ../../src/libs/zbxicmpping/libzbxicmpping.a ../../src/libs/zbxdbhigh/libzbxdbhigh.a ../../src/libs/zbxdb/libzbxdb.a -lmysqlclient -lssh2 -lm -lresolv
      poller/libzbxpoller.a(checks_ssh.o): In function `waitsocket':
      /root/zabbix_svn/1.8/src/zabbix_server/poller/checks_ssh.c:64: undefined reference to `libssh2_session_block_directions'

      Let's check both libs for the function:

      1. objdump -T /usr/lib64/libssh2.so | grep libssh2_session_block_directions
      1. objdump -T /root/libssh2-1.2.8-install/lib/libssh2.so | grep libssh2_session_block_directions
        0000000000010270 g DF .text 0000000000000007 Base libssh2_session_block_directions

      The one in the system is missing the required subroutine. And why is our compilation process using the one from the system? See gcc options in that command above, the -L/usr/lib64 comes before /root/libssh2-1.2.8-install/lib . gcc takes the first it can find and that happens to be the libssh2 in the system, the wrong one.

      The solution is to reorder LDFLAGS so that if you specify package path with --with-package configure option these flags should come first.

            dimir dimir
            dimir dimir
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: