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

linking fails when LTO is used

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 5.4.5rc1, 6.0.0alpha3, 6.0 (plan)
    • 5.4.2
    • Agent (G)
    • None
    • Linux 86_64
    • Team A
    • Sprint 79 (Aug 2021), Sprint 80 (Sep 2021)
    • 0.5

      Making all in zabbix_get
      make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/zabbix-5.4.2/x86_64-redhat-linux-gnu-mysql/src/zabbix_get'
      /bin/sh ../../libtool  --tag=CC   --mode=link /usr/bin/gcc  -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none   -L/usr/lib   -rdynamic -Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin     -o zabbix_get zabbix_get.o ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxlog/libzbxlog.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxnix/libzbxnix.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxcompress/libzbxcompress.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxalgo/libzbxalgo.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxregexp/libzbxregexp.a -lz -lpthread -lssl -lcrypto -lz -lpthread -lm  -lresolv -lxml2   -lpcre
      libtool: link: /usr/bin/gcc -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -rdynamic -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -o zabbix_get zabbix_get.o  -L/usr/lib ../../src/libs/zbxcomms/libzbxcomms.a ../../src/libs/zbxlog/libzbxlog.a ../../src/libs/zbxcrypto/libzbxcrypto.a ../../src/libs/zbxsys/libzbxsys.a ../../src/libs/zbxnix/libzbxnix.a ../../src/libs/zbxconf/libzbxconf.a ../../src/libs/zbxcompress/libzbxcompress.a ../../src/libs/zbxjson/libzbxjson.a ../../src/libs/zbxalgo/libzbxalgo.a ../../src/libs/zbxcommon/libzbxcommon.a ../../src/libs/zbxregexp/libzbxregexp.a -lssl -lcrypto -lz -lpthread -lm -lresolv -lxml2 -lpcre
      /usr/bin/ld: /usr/bin/ld: DWARF error: invalid abstract instance DIE ref
      /tmp/ccd6YLWC.lto.o: in function `zbx_xml_node_free':
      <artificial>:(.text.zbx_xml_node_free[.text.zbx_xml_node_free.group]+0x5c): undefined reference to `zbx_str_free'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_node_free[.text.zbx_xml_node_free.group]+0x78): undefined reference to `zbx_vector_str_clear_ext'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_node_free[.text.zbx_xml_node_free.group]+0x80): undefined reference to `zbx_vector_str_destroy'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `version':
      <artificial>:(.text.version[.text.version.group]+0x73): undefined reference to `zbx_tls_version'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `vector_to_json':
      <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x78): undefined reference to `zbx_json_close'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x143): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x1a3): undefined reference to `zbx_json_addobject'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x1de): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x23d): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x2b8): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x2c4): undefined reference to `zbx_json_close'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x36a): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x37c): undefined reference to `zbx_json_close'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x3e7): undefined reference to `zbx_json_addarray'
      /usr/bin/ld: <artificial>:(.text.vector_to_json[.text.vector_to_json.group]+0x44f): undefined reference to `zbx_json_addstring'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_create_token':
      <artificial>:(.text.zbx_create_token[.text.zbx_create_token.group]+0x62): undefined reference to `zbx_md5_init'
      /usr/bin/ld: <artificial>:(.text.zbx_create_token[.text.zbx_create_token.group]+0x74): undefined reference to `zbx_md5_append'
      /usr/bin/ld: <artificial>:(.text.zbx_create_token[.text.zbx_create_token.group]+0x84): undefined reference to `zbx_md5_append'
      /usr/bin/ld: <artificial>:(.text.zbx_create_token[.text.zbx_create_token.group]+0x8f): undefined reference to `zbx_md5_finish'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `json_to_xmlnode':
      <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x13d): undefined reference to `zbx_json_pair_next'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x15e): undefined reference to `zbx_json_decodevalue'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x228): undefined reference to `zbx_json_brackets_open'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x286): undefined reference to `zbx_json_next_value'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x304): undefined reference to `zbx_json_valuetype'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x479): undefined reference to `zbx_json_next'
      /usr/bin/ld: <artificial>:(.text.json_to_xmlnode[.text.json_to_xmlnode.group]+0x48b): undefined reference to `zbx_json_valuetype'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_vector_xml_node_ptr_create':
      <artificial>:(.text.zbx_vector_xml_node_ptr_create[.text.zbx_vector_xml_node_ptr_create.group]+0x7): undefined reference to `zbx_default_mem_malloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_vector_xml_node_ptr_create[.text.zbx_vector_xml_node_ptr_create.group]+0x21): undefined reference to `zbx_default_mem_realloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_vector_xml_node_ptr_create[.text.zbx_vector_xml_node_ptr_create.group]+0x2c): undefined reference to `zbx_default_mem_free_func'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `xml_to_vector':
      <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x29): undefined reference to `zbx_default_mem_malloc_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x47): undefined reference to `zbx_default_mem_realloc_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x53): undefined reference to `zbx_default_mem_free_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0xa8): undefined reference to `zbx_default_mem_malloc_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0xc6): undefined reference to `zbx_default_mem_realloc_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0xd8): undefined reference to `zbx_default_mem_free_func'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0xf1): undefined reference to `zbx_vector_str_create'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x2a3): undefined reference to `zbx_vector_str_append'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x2ff): undefined reference to `zbx_vector_str_append'
      /usr/bin/ld: <artificial>:(.text.xml_to_vector[.text.xml_to_vector.group]+0x321): undefined reference to `zbx_vector_str_append'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `comms_parse_response':
      <artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x1a4): undefined reference to `str_base64_decode'
      /usr/bin/ld: <artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x29a): undefined reference to `str_base64_decode'
      /usr/bin/ld: <artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x2f4): undefined reference to `str_base64_decode'
      /usr/bin/ld: <artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x358): undefined reference to `str_base64_decode'
      /usr/bin/ld: <artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x3af): undefined reference to `str_base64_decode'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o:<artificial>:(.text.comms_parse_response[.text.comms_parse_response.group]+0x40b): more undefined references to `str_base64_decode' follow
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_xml_to_json':
      <artificial>:(.text.zbx_xml_to_json[.text.zbx_xml_to_json.group]+0x92): undefined reference to `zbx_json_init'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_to_json[.text.zbx_xml_to_json.group]+0x99): undefined reference to `zbx_default_mem_malloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_to_json[.text.zbx_xml_to_json.group]+0xb4): undefined reference to `zbx_default_mem_realloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_to_json[.text.zbx_xml_to_json.group]+0xc9): undefined reference to `zbx_default_mem_free_func'
      /usr/bin/ld: <artificial>:(.text.zbx_xml_to_json[.text.zbx_xml_to_json.group]+0x123): undefined reference to `zbx_json_free'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_json_to_xml':
      <artificial>:(.text.zbx_json_to_xml[.text.zbx_json_to_xml.group]+0x68): undefined reference to `zbx_json_open'
      /usr/bin/ld: <artificial>:(.text.zbx_json_to_xml[.text.zbx_json_to_xml.group]+0x171): undefined reference to `zbx_json_strerror'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_vector_var_create':
      <artificial>:(.text.zbx_vector_var_create[.text.zbx_vector_var_create.group]+0x7): undefined reference to `zbx_default_mem_malloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_vector_var_create[.text.zbx_vector_var_create.group]+0x21): undefined reference to `zbx_default_mem_realloc_func'
      /usr/bin/ld: <artificial>:(.text.zbx_vector_var_create[.text.zbx_vector_var_create.group]+0x2c): undefined reference to `zbx_default_mem_free_func'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_variant_clear':
      <artificial>:(.text.zbx_variant_clear[.text.zbx_variant_clear.group]+0x4d): undefined reference to `zbx_vector_dbl_destroy'
      /usr/bin/ld: /tmp/ccd6YLWC.lto.o: in function `zbx_variant_copy':
      <artificial>:(.text.zbx_variant_copy[.text.zbx_variant_copy.group]+0x57): undefined reference to `zbx_vector_dbl_create'
      /usr/bin/ld: <artificial>:(.text.zbx_variant_copy[.text.zbx_variant_copy.group]+0x69): undefined reference to `zbx_vector_dbl_append_array'
      collect2: error: ld returned 1 exit status
      make[2]: *** [Makefile:534: zabbix_get] Error 1
      make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/zabbix-5.4.2/x86_64-redhat-linux-gnu-mysql/src/zabbix_get'
      make[1]: *** [Makefile:530: all-recursive] Error 1
      make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/zabbix-5.4.2/x86_64-redhat-linux-gnu-mysql/src'
      make: *** [Makefile:614: all-recursive] Error 1
      

      To reproduce that please use below script:

      CFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
      CXXFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
      LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now  -flto=auto -flto-partition=none -fuse-linker-plugin'
      CC=/usr/bin/gcc
      CXX=/usr/bin/g++
      AR=/usr/bin/gcc-ar
      NM=/usr/bin/gcc-nm
      RANLIB=/usr/bin/gcc-ranlib
      export CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS CC CXX FC AR NM RANLIB
      ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --disable-silent-rules --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/zabbix --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-agent --enable-ipv6 --enable-proxy --enable-server --without-jabber --disable-java --with-ldap --with-libcurl --with-libxml2 --with-mysql --with-net-snmp --with-openipmi --with-openssl --without-oracle --without-postgresql --with-ssh2 --with-unixodbc
      make

            vso Vladislavs Sokurenko
            kloczek Tomasz Kłoczko
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: