这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

1 Compilation issues

These are the known issues regarding Zabbix compilation from sources. For all other cases, see the Known issues page.

Compiling Zabbix agent on HP-UX

If you install the PCRE library from the popular HP-UX package site http://hpux.connect.org.uk (for example, from file pcre-8.42-ia64_64-11.31.depot), only the 64-bit version of the library will be installed in the /usr/local/lib/hpux64 directory.

In this case, for successful agent compilation, a customized option is needed for the configure script, for example:

CFLAGS="+DD64" ./configure --enable-agent --with-libpcre-include=/usr/local/include --with-libpcre-lib=/usr/local/lib/hpux64

Library in a non-standard location

Zabbix allows you to specify a library located in a non-standard location. In the example below, Zabbix will run curl-config from the specified non-standard location and use its output to determine the correct libcurl to use.

$ ./configure --enable-server --with-mysql --with-libcurl=/usr/local/bin/curl-config

This will work if it is the only libcurl installed in the system, but might not if there is another libcurl installed in a standard location (by the package manager, for example). Such is the case when you need a newer version of the library for Zabbix and the older one for other applications.

Therefore, specifying a component in a non-standard location will not always work when the same component also exists in a standard location.

For example, if you use a newer libcurl installed in /usr/local with the libcurl package still installed, Zabbix might pick up the wrong one and compilation will fail:

usr/bin/ld: ../../src/libs/zbxhttp/libzbxhttp.a(http.o): in function 'zbx_http_convert_to_utf8':
       /tmp/zabbix-master/src/libs/zbxhttp/http.c:957: undefined reference to 'curl_easy_header'
       collect2: error: ld returned 1 exit status

Here, the function curl_easy_header() is not available in the older /usr/lib/x86_64-linux-gnu/libcurl.so, but is available in the newer /usr/local/lib/libcurl.so.

The problem lies with the order of linker flags, and one solution is to specify the full path to the library in an LDFLAGS variable:

$ LDFLAGS="-Wl,--no-as-needed /usr/local/lib/libcurl.so" ./configure --enable-server --with-mysql --with-libcurl=/usr/local/bin/curl-config

Note the -Wl,--no-as-needed option which might be needed on some systems (see also: default linking options on Debian-based systems).