net-analyzer/zabbix-1.8-r1 fails to link the zabbix server binary due to unresolved ipmi symbols. This is probably related to my --as-needed LDFLAG Reproducible: Always Steps to Reproduce: # emerge zabbix ... x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../include -DZABBIX_DAEMON -march=nocona -Os -fomit-frame-pointer -pipe -I/usr/include/postgresql-8.4 -I. -I/usr/include -I/usr/include -MT zabbix_server-server.o -MD -MP -MF .deps/zabbix_server-server.Tpo -c -o zabbix_server-server.o `test -f 'server.c' || echo './'`server.c mv -f .deps/zabbix_server-actions.Tpo .deps/zabbix_server-actions.Po mv -f .deps/zabbix_server-zlog.Tpo .deps/zabbix_server-zlog.Po server.c: In function 'zbx_on_exit': server.c:702: warning: cast from pointer to integer of different size mv -f .deps/zabbix_server-server.Tpo .deps/zabbix_server-server.Po x86_64-pc-linux-gnu-gcc -DZABBIX_DAEMON -march=nocona -Os -fomit-frame-pointer -pipe -I/usr/include/postgresql-8.4 -I. -I/usr/include -I/usr/include -L/usr/lib64/postgresql-8.4/lib64 -lpq -liksemel -lcurl -lrt -lz -lgnutls -L/usr/lib64 -lnetsnmp -lcrypto -L/usr/lib64 -lnetsnmp -lcrypto -Wl,-O1 -Wl,--as-needed -L/usr/lib -lOpenIPMI -lOpenIPMIposix -o zabbix_server 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 ../../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/zbxnix/libzbxnix.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxemail/libzbxemail.a ../../src/libs/zbxsms/libzbxsms.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxserver/libzbxserver.a ../../src/libs/zbxicmpping/libzbxicmpping.a ../../src/libs/zbxdbhigh/libzbxdbhigh.a ../../src/libs/zbxdb/libzbxdb.a ../../src/libs/zbxjabber/libzbxjabber.a -liksemel -lcurl -lnetsnmp -lm -lresolv poller/libzbxpoller.a(checks_ipmi.o): In function `init_ipmi_host': checks_ipmi.c:(.text+0x4f7): undefined reference to `ipmi_ip_setup_con' checks_ipmi.c:(.text+0x5a7): undefined reference to `ipmi_open_domain' poller/libzbxpoller.a(checks_ipmi.o): In function `setup_done': checks_ipmi.c:(.text+0x6ab): undefined reference to `ipmi_domain_close' checks_ipmi.c:(.text+0x6c8): undefined reference to `ipmi_domain_add_entity_update_handler' poller/libzbxpoller.a(checks_ipmi.o): In function `entity_change': checks_ipmi.c:(.text+0x719): undefined reference to `ipmi_entity_add_sensor_update_handler' checks_ipmi.c:(.text+0x740): undefined reference to `ipmi_entity_add_control_update_handler' poller/libzbxpoller.a(checks_ipmi.o): In function `control_change': checks_ipmi.c:(.text+0x7cd): undefined reference to `ipmi_control_get_id_length' checks_ipmi.c:(.text+0x7f6): undefined reference to `ipmi_control_get_id' checks_ipmi.c:(.text+0x883): undefined reference to `ipmi_control_get_num_vals' poller/libzbxpoller.a(checks_ipmi.o): In function `sensor_change': checks_ipmi.c:(.text+0x9fb): undefined reference to `ipmi_sensor_get_event_reading_type' checks_ipmi.c:(.text+0xa4b): undefined reference to `ipmi_sensor_get_id_length' checks_ipmi.c:(.text+0xa74): undefined reference to `ipmi_sensor_get_id' poller/libzbxpoller.a(checks_ipmi.o): In function `set_ipmi_control_value': checks_ipmi.c:(.text+0xd1b): undefined reference to `ipmi_control_is_settable' checks_ipmi.c:(.text+0xd55): undefined reference to `ipmi_control_set_val' poller/libzbxpoller.a(checks_ipmi.o): In function `got_control_setting': checks_ipmi.c:(.text+0xe5f): undefined reference to `ipmi_control_get_entity' checks_ipmi.c:(.text+0xe67): undefined reference to `ipmi_entity_get_entity_id_string' checks_ipmi.c:(.text+0xe6f): undefined reference to `ipmi_control_get_type_string' poller/libzbxpoller.a(checks_ipmi.o): In function `got_thresh_reading': checks_ipmi.c:(.text+0x109f): undefined reference to `ipmi_sensor_get_entity' checks_ipmi.c:(.text+0x10a7): undefined reference to `ipmi_entity_get_entity_id_string' checks_ipmi.c:(.text+0x10b4): undefined reference to `ipmi_sensor_get_sensor_type_string' checks_ipmi.c:(.text+0x10c1): undefined reference to `ipmi_sensor_get_event_reading_type_string' checks_ipmi.c:(.text+0x10ce): undefined reference to `ipmi_sensor_get_base_unit_string' checks_ipmi.c:(.text+0x10db): undefined reference to `ipmi_sensor_get_percentage' checks_ipmi.c:(.text+0x10f4): undefined reference to `ipmi_sensor_get_modifier_unit_use' checks_ipmi.c:(.text+0x1110): undefined reference to `ipmi_sensor_get_modifier_unit_string' checks_ipmi.c:(.text+0x1122): undefined reference to `ipmi_sensor_get_modifier_unit_string' checks_ipmi.c:(.text+0x1132): undefined reference to `ipmi_sensor_get_rate_unit_string' poller/libzbxpoller.a(checks_ipmi.o): In function `get_value_ipmi': checks_ipmi.c:(.text+0x130c): undefined reference to `ipmi_control_is_readable' checks_ipmi.c:(.text+0x134f): undefined reference to `ipmi_sensor_get_event_reading_type' checks_ipmi.c:(.text+0x1367): undefined reference to `ipmi_sensor_get_reading' checks_ipmi.c:(.text+0x1400): undefined reference to `ipmi_control_get_val' poller/libzbxpoller.a(checks_ipmi.o): In function `got_control_reading': checks_ipmi.c:(.text+0x157d): undefined reference to `ipmi_control_get_entity' checks_ipmi.c:(.text+0x1585): undefined reference to `ipmi_entity_get_entity_id_string' checks_ipmi.c:(.text+0x1590): undefined reference to `ipmi_control_get_type_string' poller/libzbxpoller.a(checks_ipmi.o): In function `init_ipmi_handler': checks_ipmi.c:(.text+0x1602): undefined reference to `ipmi_posix_setup_os_handler' checks_ipmi.c:(.text+0x163c): undefined reference to `ipmi_init' collect2: ld returned 1 exit status make[3]: *** [zabbix_server] Error 1 make[3]: Leaving directory `/var/tmp/portage/net-analyzer/zabbix-1.8-r1/work/zabbix-1.8/src/zabbix_server' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/tmp/portage/net-analyzer/zabbix-1.8-r1/work/zabbix-1.8/src/zabbix_server' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/net-analyzer/zabbix-1.8-r1/work/zabbix-1.8/src' make: *** [all-recursive] Error 1 * ERROR: net-analyzer/zabbix-1.8-r1 failed: * emake failed * * Call stack: * ebuild.sh, line 54: Called src_compile * environment, line 3603: Called _eapi2_src_compile * ebuild.sh, line 646: Called die * The specific snippet of code: * emake || die "emake failed" This is a newly installed Gentoo system: # emerge --info Portage 2.1.7.17 (default/linux/amd64/10.0, gcc-4.3.4, glibc-2.11-r1, 2.6.32-gentoo-r5 x86_64) ================================================================= System uname: Linux-2.6.32-gentoo-r5-x86_64-Intel-R-_Core-TM-2_CPU_6600_@_2.40GHz-with-gentoo-2.0.1 Timestamp of tree: Tue, 16 Feb 2010 00:00:21 +0000 app-shells/bash: 4.1_p2 dev-lang/python: 2.6.4-r1, 3.1.1-r1 dev-util/cmake: 2.8.0-r2 sys-apps/baselayout: 2.0.1 sys-apps/openrc: 0.6.0-r1 sys-apps/sandbox: 2.2 sys-devel/autoconf: 2.13, 2.65 sys-devel/automake: 1.10.3, 1.11.1 sys-devel/binutils: 2.20 sys-devel/gcc: 4.3.4, 4.4.3 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6b virtual/os-headers: 2.6.32 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -Os -fomit-frame-pointer -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/X11/xkb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=nocona -Os -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acl acpi alsa amd64 avahi bash-completion berkdb bzip2 cairo cleartype cli consolekit cracklib crypt cups cxx dbus djvu dri fam fortran fuse gdbm glitz gnome gnome-keyring gnutls gpm gstreamer gtk hal iconv ipv6 jpeg libnotify lzma mmx modules mudflap multilib nautilus ncurses nls nptl nptlonly opengl openmp pam pcre perl png policykit pppd pulseaudio python readline reflection secure-delete session snmp spl sse sse2 ssl startup-notification svg sysfs tcpd threads tiff truetype unicode webdav webkit xattr xcb xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Sorry, forgot to include zabbix's custom USE flags: # grep zabbix /etc/portage/package.use net-analyzer/zabbix postgres -sqlite3 agent curl frontend jabber openipmi proxy server snmp >>> Emerging (1 of 1) net-analyzer/zabbix-1.8-r1 * zabbix-1.8.tar.gz RMD160 SHA1 SHA256 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] * CPV: net-analyzer/zabbix-1.8-r1 * REPO: gentoo * USE: agent amd64 curl elibc_glibc frontend ipv6 jabber kernel_linux multilib openipmi postgres proxy server snmp userland_GNU * * Using dev-lang/php-5.2.12
Yes, it is because of the --as-needed flag. If I change the order the libs are passed for linking the final binary moving "-lOpenIPMI -lOpenIPMIposix" to the end of the list, it links fine. (More info on: http://www.gentoo.org/proj/en/qa/asneeded.xml -> Importance of linking order. The gcc invocation that works is: x86_64-pc-linux-gnu-gcc -DZABBIX_DAEMON -march=nocona -Os -fomit-frame-pointer -pipe -I/usr/include/postgresql-8.4 -I. -I/usr/include -I/usr/include -L/usr/lib64/postgresql-8.4/lib64 -lpq -liksemel -lcurl -lrt -lz -lgnutls -L/usr/lib64 -lnetsnmp -lcrypto -L/usr/lib64 -lnetsnmp -lcrypto -Wl,-O1 -Wl,--as-needed -L/usr/lib -o zabbix_server 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 ../../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/zbxnix/libzbxnix.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxemail/libzbxemail.a ../../src/libs/zbxsms/libzbxsms.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxserver/libzbxserver.a ../../src/libs/zbxicmpping/libzbxicmpping.a ../../src/libs/zbxdbhigh/libzbxdbhigh.a ../../src/libs/zbxdb/libzbxdb.a ../../src/libs/zbxjabber/libzbxjabber.a -liksemel -lcurl -lnetsnmp -lm -lresolv -lOpenIPMI -lOpenIPMIposix
Created attachment 219957 [details, diff] zabbix-as-needed.patch This patch fixes compiling zabbix with --as-needed in LDFLAGS, all versions in portage are affected and this patch works with them.
Upstream bug URL: https://support.zabbix.com/browse/ZBX-494
+ 20 Feb 2010; Patrick Lauer <patrick@gentoo.org> zabbix-1.8-r1.ebuild, + +files/zabbix-as-needed.patch: + Fix for as-needed building by Yuri Vasilevski, fixes #305449
Created attachment 258570 [details, diff] Patch from upstream for 1.8.3 zabbix-1.8.3 still fails to build Patch from upstream bug (ZBX-494) helps.