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

Inability to built Zabbix agent with statically linked curl library

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 7.0.16, 7.2.10, 7.4.0, 8.0.0alpha1 (master)
    • Agent (G)
    • Support backlog

      Our use case: we need to built Zabbix Agent for applience with Linux kernel 5.14.x and very limited set of packages; the agent should support metric 'web.page.get["http://USER:PASS@HOST:PORT/PATH"]'.
      As URL conains credentials, the agent should be linked with 'libcurl' library.
      We're trying to compile the agent from sources on the fresh installed SLES 15 sp5 system (+all current patches), it has just the same kernel version.

      Steps to reproduce:

      1. Download the needed sources of Zabbix and dependant libraries, then untar them into the "/opt" directory:
        1. pcre2 library (pcre2-10.45.tar.gz);
        2. curl library (curl-8.14.1.tar.gz);
        3. OpenSSL library (openssl-3.5.1.tar.gz);
        4. Zabbix v6.0.x and v7.0.x (for example, zabbix-7.0.16.tar.gz).
      2. Compile and install to "/opt" directory all libraries:
        1. pcre2:
          ./configure --prefix=/opt --enable-jit=auto --disable-shared
          make
          make install
          

          Result: files /opt/lib/libpcre2-8.a and /opt/bin/pcre2-config.

        2. OpenSSL:
          ./Configure --prefix=/opt --libdir=lib no-shared no-docs no-autoalginit no-autoerrinit no-autoload-config no-dso no-filenames no-makedepend no-module no-pinshared no-ssl-trace
          make
          make install
          

          Result: files libcrypto.a and libssl.a in the /opt/lib directory.

        3. curl:
          ./configure --prefix=/opt --disable-shared --without-libpsl --with-openssl=/opt --disable-openssl-auto-load-config \
            --disable-ipv6 --disable-netrc --disable-progress-meter --disable-unix-sockets --without-librtmp --disable-dict \
            --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-ldaps --disable-mqtt \
            --disable-pop3 --disable-rtsp --disable-smb --disable-smtp --disable-telnet --disable-tftp
          make
          make install
          

          Result: binaries curl and curl-config in the /opt/bin directory, library /opt/lib/libcurl.a.

      3. Compile Zabbix Agent (v6.0.x and v7.0.x) using these static libraries:
        ./configure --enable-agent --enable-static-libs --with-libpcre2-lib=/opt/lib --with-libcurl=/opt/bin/curl-config
        make
        
      4. Test compiled agent using any working web site:
        cd src/zabbix_agent
        ./zabbix_agentd -t 'web.page.get["http://user:[email protected]"]'
        

        Result:
        Both versions of Zabbix Agent are built without problems.
        Metric "web.page.get" on the v6.0.x works successfully, for example:

        web.page.get["http://user:[email protected]"] [t|HTTP/1.1 301 Moved Permanently
        Server: nginx/1.21.5
        Date: Wed, 21 Feb 2024 16:43:40 GMT
        Content-Type: text/html
        Content-Length: 169
        Connection: keep-alive
        Location: https://www.example.com/
        
        <html>
        <head><title>301 Moved Permanently</title></head>
        <body>
        <center><h1>301 Moved Permanently</h1></center>
        <hr><center>nginx/1.21.5</center>
        </body>
        </html>]
        

      However, Zabbix Agent v7.0.x just crashes with the following error:

      zabbix_agentd [24324]: ERROR: cannot find cURL function curl_easy_header(): ./zabbix_agentd: undefined symbol: curl_easy_header
      

      Expected:
      Successfully working Zabbix Agent with a functioning "web.page.get" metric.

      Additional info:
      This error message is NOT really accurate, as the Agent was built successfully (no any errors during configuring, compiling and linking).
      It seems like this is a consequence of changes introduced in the ZBXNEXT-3623: the feature check assumes that the "curl" library is always a dynamic library; but it does not take into account that it could be static.
      Probably, it is the result of attempts to check features of cURL library dynamically (lines 155-167 in the src/libs/zbxcurl/curl.c file), but in our case this library is static.
      So, it is a regression comparing to v6.0.x (we lost a functionality to build the Agent statically with a "curl" library).
      See also: ZBX-24140.

            zabbix.dev Zabbix Development Team
            constantin.oshmyan Konstantīns Ošmjans
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: