http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52900

             Bug #: 52900
           Summary: Compile source using Boost header with -static -flto
                    -std=c++11 breaks
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: gccb...@haatschii.de


A minimal source creating the error is:

#include "boost/program_options.hpp"

int main ( int argC, char* argV[] )
{
    return 0;
}

Where "boost/program_options.hpp" is the Boost header file (Version 104700).

When compiling this source using:
g++-4.7 test.cpp -I ../includes -std=c++0x -static -flto

I get the following errors:
`_ZTIN9__gnu_cxx24__concurrence_lock_errorE' referenced in section
`.text._ZN9__gnu_cxx30__throw_concurrence_lock_errorEv[_ZN9__gnu_cxx30__throw_concurrence_lock_errorEv]'
of /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in
discarded section `.gnu.linkonce.t._ZTIN9__gnu_cxx24__concurrence_lock_errorE'
of /tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.text.__cxa_allocate_exception' of
/usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in discarded
section `.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.text.__cxa_free_exception' of
/usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in discarded
section `.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.text.__cxa_allocate_dependent_exception' of
/usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in discarded
section `.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.text.__cxa_free_dependent_exception' of
/usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in discarded
section `.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx24__concurrence_lock_errorE' referenced in section
`.data.rel.ro._ZTVN9__gnu_cxx24__concurrence_lock_errorE[_ZTVN9__gnu_cxx24__concurrence_lock_errorE]'
of /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in
discarded section `.gnu.linkonce.t._ZTIN9__gnu_cxx24__concurrence_lock_errorE'
of /tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.data.rel.ro._ZTVN9__gnu_cxx26__concurrence_unlock_errorE[_ZTVN9__gnu_cxx26__concurrence_unlock_errorE]'
of /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(eh_alloc.o): defined in
discarded section
`.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx26__concurrence_unlock_errorE' referenced in section
`.text._ZN9__gnu_cxx32__throw_concurrence_unlock_errorEv[_ZN9__gnu_cxx32__throw_concurrence_unlock_errorEv]'
of /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(locale.o): defined in
discarded section
`.gnu.linkonce.t._ZTIN9__gnu_cxx26__concurrence_unlock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
`_ZTIN9__gnu_cxx24__concurrence_lock_errorE' referenced in section
`.text._ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetEm' of
/usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a(locale.o): defined in discarded
section `.gnu.linkonce.t._ZTIN9__gnu_cxx24__concurrence_lock_errorE' of
/tmp/ccEoPVoT.o (symbol from plugin)
collect2: error: ld returned 1 exit status

However it compiles fine when I omit either -static, -flto or -std=c++0x. Only
if all three options are present the error occurs. I am on Debian Wheezy. I
have tested the error with two g++ versions:
g++ (Debian 4.6.3-1) 4.6.3
g++-4.7 (Debian 4.7.0-1) 4.7.0

Hope this helps and feel free to contact me.

Reply via email to