这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

1 编译问题

这些是有关从源代码编译 Zabbix 的已知问题。对于其他情况,请参阅已知问题页面。

在 HP-UX 上编译 Zabbix agent

如果你从流行的 HP-UX 软件包站点 http://hpux.connect.org.uk 安装 PCRE 库(例如,从文件 pcre-8.42-ia64_64-11.31.depot 安装),那么只会安装 64 位版本的库到 /usr/local/lib/hpux64 目录中。

在这种情况下,为了成功编译 agent,需要为 configure 脚本添加自定义选项,例如:

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

非标准位置的库

Zabbix 允许您指定位于非标准位置的库。在下面的示例中,Zabbix 将从指定的非标准位置运行 curl-config,并使用其输出确定要使用的正确的 libcurl。

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

如果它是系统中唯一安装的 libcurl,则此方法可行,但如果系统中还安装了另一个位于标准位置的 libcurl(例如由软件包管理器安装的 libcurl),则可能会失败。当您需要为 Zabbix 使用更新的库并为其他应用程序使用旧版库时,就会出现这种情况。

因此,当相同的组件同时存在于标准位置时,在非标准位置指定组件并不总是有效。

例如,如果您在 /usr/local 中使用了更新的 libcurl,并且 libcurl 包仍然安装在系统中,则 Zabbix 可能会选择错误的 libcurl,并且编译将失败:

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

在这里,函数 curl_easy_header() 在较旧的 /usr/lib/x86_64-linux-gnu/libcurl.so 中不可用,但在较新的 /usr/local/lib/libcurl.so 中可用。

问题在于链接器标志的顺序,解决方法之一是在 LDFLAGS 变量中指定库的完整路径:

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

请注意,-Wl,--no-as-needed 选项可能在某些系统上需要(也请参阅:Debian-based 系统上的默认链接选项)。

Stack size too small on some systems

If Zabbix crashes or freezes due to stack overflows, you can increase the per-thread stack size using the --with-stacksize option when configuring the sources. This issue may occur on systems with low default thread stack limits, especially during preprocessing, where multiple threads are created.

The following example sets the stack size to 512 KB per thread:

./configure --enable-server --with-mysql --with-stacksize=512

You can check the system thread stack limits at runtime using the ulimit -s command on Linux-based systems.