[LLVMbugs] [Bug 24115] New: llvm-nm fails to build with gcc 5.1's libstdc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 14 02:54:59 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24115

            Bug ID: 24115
           Summary: llvm-nm fails to build with gcc 5.1's libstdc++
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-nm
          Assignee: unassignedbugs at nondot.org
          Reporter: bero at linaro.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14586
  --> https://llvm.org/bugs/attachment.cgi?id=14586&action=edit
Patch

Current (svn rev. 242129) llvm-nm fails to build with gcc 5.1's STL -- looks
like gcc 5.1's std::sort is too picky about its arguments:


cd /home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/tools/llvm-nm &&
/usr/bin/clang++   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Oz -gdwarf-4 -Wstrict-aliasing=2
-pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4  -fPIC -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers
-pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++1y
-ffunction-sections -fdata-sections -Oz -gdwarf-4 -Wstrict-aliasing=2 -pipe
-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4  -fPIC
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/tools/llvm-nm
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/include
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include    -o
CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -c
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp:19:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/IR/Function.h:23:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/IR/Argument.h:17:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/ADT/Twine.h:13:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/ADT/SmallVector.h:22:
In file included from
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/algorithm:61:
In file included from
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/stl_algobase.h:71:
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/predefined_ops.h:123:31:
error: indirection requires pointer operand ('(anonymous namespace)::NMSymbol'
invalid)
        { return bool(_M_comp(*__it1, *__it2)); }
                              ^~~~~~
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:1981:27:
note: in instantiation of function template specialization
'__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)>
>::operator()<(anonymous namespace)::NMSymbol, (anonymous
namespace)::NMSymbol>' requested here
        using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
                                 ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:1990:2:
note: in instantiation of template type alias '_Invoke' requested here
        using _Callable
        ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:2057:30:
note: in instantiation of template type alias '_Callable' requested here
               typename = _Requires<_Callable<_Functor>, void>>
                                    ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:2058:2:
note: in instantiation of default argument for
'function<__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const
(anonymous namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >
>' required here
        function(_Functor);
        ^~~~~~~~
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/predefined_ops.h:130:14:
note: while substituting deduced template arguments into function template
'function' [with _Functor =
__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >, $1 = (no
value)]
    { return _Iter_comp_iter<_Compare>(__comp); }
             ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/stl_algo.h:4729:54:
note: in instantiation of function template specialization
'__gnu_cxx::__ops::__iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >' requested
here
      std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
                                                     ^
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp:499:10:
note: in instantiation of function template specialization
'std::sort<__gnu_cxx::__normal_iterator<(anonymous namespace)::NMSymbol *,
std::vector<(anonymous namespace)::NMSymbol, std::allocator<(anonymous
namespace)::NMSymbol> > >, std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >' requested
here
    std::sort(SymbolList.begin(), SymbolList.end(), Cmp);
         ^
1 error generated.
tools/llvm-nm/CMakeFiles/llvm-nm.dir/build.make:65: recipe for target
'tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o' failed


The patch I'm attaching solves the problem for me, at the cost of making the
code somewhat ugly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150714/c06d0287/attachment.html>


More information about the llvm-bugs mailing list