[LLVMbugs] [Bug 16419] New: linker failure - std::allocator ; g++ produces a binary example included

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 22 07:24:16 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16419

            Bug ID: 16419
           Summary: linker failure - std::allocator ; g++ produces a
                    binary example included
           Product: clang
           Version: 3.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: netprobe at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10741
  --> http://llvm.org/bugs/attachment.cgi?id=10741&action=edit
pick.cc : increment a counter in random elements of a std::map

The included source file was compiled both with g++ and clang with the
following outcomes:

g++
mulander at craig-laptop:~/code/cpp/misc$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mulander at craig-laptop:~/code/cpp/misc$ g++ -Wall -pedantic pick.cc
mulander at craig-laptop:~/code/cpp/misc$ ./a.out 
'         A': 315
'         B': 336
'         C': 349
mulander at craig-laptop:~/code/cpp/misc$

clang
mulander at craig-laptop:~/code/cpp/misc$ clang --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
mulander at craig-laptop:~/code/cpp/misc$ clang -v pick.cc
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name pick.cc -mrelocation-model
static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.22 -momit-leaf-frame-pointer -v
-resource-dir /usr/bin/../lib/clang/3.0 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/include/c++/4.6
-internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu -internal-isystem
/usr/include/c++/4.6/backward -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -ferror-limit 19 -fmessage-length 177 -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/pick-RXgU3R.o -x c++ pick.cc
clang -cc1 version 3.0 based upon llvm 3.0 hosted on x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring nonexistent directory "/usr/include/c++/4.6//x86_64-linux-gnu/64"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/include/c++/4.6"
ignoring duplicate directory "/usr/include/c++/4.6/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/c++/4.6/backward"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.6
 /usr/include/c++/4.6/x86_64-linux-gnu
 /usr/include/c++/4.6/backward
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
 /usr/include/clang/3.0/include/
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include/
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/
End of search list.
 "/usr/bin/ld" -z relro --hash-style=gnu --as-needed --build-id --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.6
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib64 -L/lib/x86_64-linux-gnu
-L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. -L/lib/x86_64-linux-gnu -L/lib
-L/usr/lib/x86_64-linux-gnu -L/usr/lib /tmp/pick-RXgU3R.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
/tmp/pick-RXgU3R.o: In function `main':
pick.cc:(.text+0x8b): undefined reference to
`std::allocator<char>::allocator()'
pick.cc:(.text+0xa5): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
pick.cc:(.text+0x14c): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x15d): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x1e6): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x1f7): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x279): undefined reference to
`std::allocator<char>::allocator()'
pick.cc:(.text+0x293): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char const*,
std::allocator<char> const&)'
pick.cc:(.text+0x2ce): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x2df): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x324): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
pick.cc:(.text+0x335): undefined reference to
`std::allocator<char>::~allocator()'
pick.cc:(.text+0x3d5): undefined reference to `std::string::c_str() const'
pick.cc:(.text+0x4b8): undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function `std::map<std::string, int,
std::less<std::string>, std::allocator<std::pair<std::string const, int> >
>::operator[](std::string const&)':
pick.cc:(.text._ZNSt3mapISsiSt4lessISsESaISt4pairIKSsiEEEixERS3_[_ZNSt3mapISsiSt4lessISsESaISt4pairIKSsiEEEixERS3_]+0x150):
undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree_iterator<std::pair<std::string
const, int> >::operator++()':
pick.cc:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEv[_ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEppEv]+0x1b):
undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair(std::string const&, int const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ERS0_RKi[_ZNSt4pairIKSsiEC2ERS0_RKi]+0x24):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree<std::string,
std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const,
int> >, std::less<std::string>, std::allocator<std::pair<std::string const,
int> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base
const*, std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_baseSB_RKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_baseSB_RKS2_]+0xc4):
undefined reference to `std::_Rb_tree_insert_and_rebalance(bool,
std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/tmp/pick-RXgU3R.o: In function
`std::_Rb_tree_const_iterator<std::pair<std::string const, int>
>::operator--()':
pick.cc:(.text._ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEmmEv[_ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEmmEv]+0x1b):
undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base
const*)'
/tmp/pick-RXgU3R.o: In function
`std::_Rb_tree_const_iterator<std::pair<std::string const, int>
>::operator++()':
pick.cc:(.text._ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEppEv[_ZNSt23_Rb_tree_const_iteratorISt4pairIKSsiEEppEv]+0x1b):
undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base
const*)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree_iterator<std::pair<std::string
const, int> >::operator--()':
pick.cc:(.text._ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEmmEv[_ZNSt17_Rb_tree_iteratorISt4pairIKSsiEEmmEv]+0x1b):
undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/tmp/pick-RXgU3R.o: In function `std::_Rb_tree<std::string,
std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const,
int> >, std::less<std::string>, std::allocator<std::pair<std::string const,
int> > >::_M_create_node(std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xa0):
undefined reference to `__cxa_begin_catch'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xbb):
undefined reference to `__cxa_rethrow'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0xce):
undefined reference to `__cxa_end_catch'
pick.cc:(.text._ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_[_ZNSt8_Rb_treeISsSt4pairIKSsiESt10_Select1stIS2_ESt4lessISsESaIS2_EE14_M_create_nodeERKS2_]+0x102):
undefined reference to `std::terminate()'
/tmp/pick-RXgU3R.o: In function
`__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, int>
> >::deallocate(std::_Rb_tree_node<std::pair<std::string const, int> >*,
unsigned long)':
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE10deallocateEPS5_m[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE10deallocateEPS5_m]+0x1c):
undefined reference to `operator delete(void*)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair(std::pair<std::string const, int> const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ERKS1_[_ZNSt4pairIKSsiEC2ERKS1_]+0x2b):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function
`__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::string const, int>
> >::allocate(unsigned long, void const*)':
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv]+0x33):
undefined reference to `std::__throw_bad_alloc()'
pick.cc:(.text._ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKSsiEEE8allocateEmPKv]+0x40):
undefined reference to `operator new(unsigned long)'
/tmp/pick-RXgU3R.o: In function `bool std::operator< <char,
std::char_traits<char>, std::allocator<char> >(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)':
pick.cc:(.text._ZStltIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_[_ZStltIcSt11char_traitsIcESaIcEEbRKSbIT_T0_T1_ES8_]+0x19):
undefined reference to `std::string::compare(std::string const&) const'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const,
int>::pair<std::string, int>(std::pair<std::string, int> const&)':
pick.cc:(.text._ZNSt4pairIKSsiEC2ISsiEERKS_IT_T0_E[_ZNSt4pairIKSsiEC2ISsiEERKS_IT_T0_E]+0x2b):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string, int>::pair(std::string
const&, int const&)':
pick.cc:(.text._ZNSt4pairISsiEC2ERKSsRKi[_ZNSt4pairISsiEC2ERKSsRKi]+0x24):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::string const&)'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string, int>::~pair()':
pick.cc:(.text._ZNSt4pairISsiED2Ev[_ZNSt4pairISsiED2Ev]+0x11): undefined
reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string()'
/tmp/pick-RXgU3R.o: In function `std::pair<std::string const, int>::~pair()':
pick.cc:(.text._ZNSt4pairIKSsiED2Ev[_ZNSt4pairIKSsiED2Ev]+0x11): undefined
reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string()'
/tmp/pick-RXgU3R.o:(.eh_frame+0x13): undefined reference to
`__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mulander at craig-laptop:~/code/cpp/misc$

-- 
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/20130622/f6dd67a4/attachment.html>


More information about the llvm-bugs mailing list