Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3481

LP:518076 - Building with hardening options yields double inclusion through libtool

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      When trying to build MariaDB on Debian/Lenny amd64 with hardening Options (hardening-wrapper + CFLAGS below) the linkage phase of most storage engines chokes on linkage phase due to double including of objects:

      i.galic@panic ~ % uname -a
      Linux panic 2.6.26-2-xen-amd64 #1 SMP Thu Nov 5 04:27:12 UTC 2009 x86_64 GNU/Linux
      i.galic@panic ~/maria/mariadb-5.1.42 % echo $CFLAGS ; echo $CXXFLAGS
      -mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC
      -mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC
      i.galic@panic ~/maria/mariadb-5.1.42 % gcc
      /usr/bin/gcc-4.3.real -fstack-protector -fPIE -pie -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
      gcc-4.3.real: no input files
      1 i.galic@panic ~/maria/mariadb-5.1.42 % g++
      /usr/bin/g++-4.3.real -fstack-protector -fPIE -pie -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
      g++-4.3.real: no input files
      i.galic@panic ~/maria/mariadb-5.1.42 % ld
      /usr/bin/ld.real -z relro
      /usr/bin/ld.real: no input files
      i.galic@panic ~/maria/mariadb-5.1.42 % ./configure --prefix=/opt/bw
      [/snip]
      config.status: creating netware/Makefile
      config.status: creating sql-bench/Makefile
      config.status: creating include/mysql_version.h
      config.status: creating plugin/Makefile
      config.status: creating win/Makefile
      config.status: creating include/config.h
      config.status: executing depfiles commands
      config.status: executing libtool commands
      /bin/rm: cannot remove `libtoolT': No such file or directory
      config.status: executing default commands
      config.status: executing my_config.h commands

      You can find information about MariaDB at
      http://askmonty.org/wiki/index.php/MariaDB

      Remember to check the platform specific part of the reference manual for
      hints about installing MariaDB on your platform. Also have a look at the
      files in the Docs directory.


      Configuration summary for version 5.1.42-MariaDB

      • Installation prefix: /opt/bw
      • System type: unknown-linux-gnu
      • Host CPU: x86_64
      • C Compiler: gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2
      • C++ Compiler: g++-4.3.real (Debian 4.3.2-1.1) 4.3.2
      • Debug enabled: no
      • Community Features: yes


      Thank you for choosing MariaDB!

      ./configure --prefix=/opt/bw 15.01s user 15.37s system 66% cpu 45.926 total
      i.galic@panic ~/maria/mariadb-5.1.42 % make
      <snip>
      /bin/sh ../../libtool --preserve-dup-deps --tag=CXX --mode=link g++ -mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC -fno-implicit-temp
      lates -fno-exceptions -fno-rtti -rdynamic -o ha_archive.la -module -rpath /opt/bw/lib/mysql/plugin ha_archive_la-ha_archive.lo ha_archive_l
      a-azio.lo -lpthread -lcrypt -lnsl -lm -lpthread
      libtool: link: g++ -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.
      o .libs/ha_archive_la-ha_archive.o .libs/ha_archive_la-azio.o -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2
      -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../.. -lstdc++
      -lm -lgcc_s -lc -lgcc_s -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../
      ../../../lib/crtn.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.o /usr/lib/gcc/x8
      6_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o -mtune=core2 -Wl,-soname -Wl,ha_archive.so.0 -o .libs/ha_archive.so.0.0.0
      /usr/bin/g+-4.3.real -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.o .libs/ha_archive_la-ha_archive.o .libs/ha_archive_la-azio.o -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../.. -lstdc+ -lm -lgcc_s -lc -lgcc_s -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o -mtune=core2 -Wl,-soname -Wl,ha_archive.so.0 -o .libs/ha_archive.so.0.0.0
      /usr/bin/ld.real -z relro --eh-frame-hdr -m elf_x86_64 --hash-style=both -shared -o .libs/ha_archive.so.0.0.0 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../.. -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../.. /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.o .libs/ha_archive_la-ha_archive.o .libs/ha_archive_la-azio.o -lpthread -lcrypt -lnsl -lm -lpthread -lstdc++ -lm -lgcc_s -lc -lgcc_s -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtbeginS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crtn.o -soname ha_archive.so.0
      /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o: In function `_init':
      /home/aurel32/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:25: multiple definition of `_init'
      /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/crti.o:/home/aurel32/glibc/glibc-2.7/build-tree/amd64-libc/csu/crti.S:25: first defined here
      /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o.dtors+0x0): multiple definition of `_DTOR_END_'
      /usr/lib/gcc/x86_64-linux-gnu/4.3.2/crtendS.o.dtors+0x0): first defined here
      collect2: ld returned 1 exit status
      make[2]: *** [ha_archive.la] Error 1
      make[2]: Leaving directory `/home/i.galic/maria/mariadb-5.1.42/storage/archive'
      make[1]: *** [all-recursive] Error 1
      make[1]: Leaving directory `/home/i.galic/maria/mariadb-5.1.42/storage'
      make: *** [all-recursive] Error 1
      make 98.05s user 22.24s system 89% cpu 2:14.47 total
      2 i.galic@panic ~/maria/mariadb-5.1.42 %

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            arjenlentz Arjen Lentz added a comment -

            Re: Building with hardening options yields double inclusion through libtool
            IIRC we already use those options for the package builds, see the ourdelta.org packages and lp:ourdelta for the build scripts. Did you try/check/review those? The in-tree build scripts won't get it right for Debian.

            Show
            arjenlentz Arjen Lentz added a comment - Re: Building with hardening options yields double inclusion through libtool IIRC we already use those options for the package builds, see the ourdelta.org packages and lp:ourdelta for the build scripts. Did you try/check/review those? The in-tree build scripts won't get it right for Debian.
            Hide
            knielsen Kristian Nielsen added a comment -

            Re: Building with hardening options yields double inclusion through libtool
            I can repeat as follows:

            tar zxf mariadb-5.1.42.tar.gz
            cd mariadb-5.1.42/
            DEB_BUILD_HARDENING=1 DEB_BUILD_HARDENING_DEBUG=1 CFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" CXXFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" ./configure --prefix=/opt/bw
            DEB_BUILD_HARDENING=1 DEB_BUILD_HARDENING_DEBUG=1 CFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" CXXFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" make

            The problem here is the DEB_BUILD_HARDENING_DEBUG=1

            This makes the hardening-wrapper output the whole command line. This seems to
            confuse libtool when it determines what to link (probably because it gets
            output twice). I guess libtool is just not compatible with DEB_BUILD_HARDENING_DEBUG=1?

            Remove the DEB_BUILD_HARDENING_DEBUG=1 and the build works.

            I think this should resolve the issue.

            Show
            knielsen Kristian Nielsen added a comment - Re: Building with hardening options yields double inclusion through libtool I can repeat as follows: tar zxf mariadb-5.1.42.tar.gz cd mariadb-5.1.42/ DEB_BUILD_HARDENING=1 DEB_BUILD_HARDENING_DEBUG=1 CFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" CXXFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" ./configure --prefix=/opt/bw DEB_BUILD_HARDENING=1 DEB_BUILD_HARDENING_DEBUG=1 CFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" CXXFLAGS="-mtune=core2 -fno-omit-frame-pointer -O2 -fpic -fPIC" make The problem here is the DEB_BUILD_HARDENING_DEBUG=1 This makes the hardening-wrapper output the whole command line. This seems to confuse libtool when it determines what to link (probably because it gets output twice). I guess libtool is just not compatible with DEB_BUILD_HARDENING_DEBUG=1? Remove the DEB_BUILD_HARDENING_DEBUG=1 and the build works. I think this should resolve the issue.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 518076

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 518076

              People

              • Assignee:
                knielsen Kristian Nielsen
                Reporter:
                igorgalić Igor Galić
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: