[MacPorts] #27925: g++ 4.5.2 64-bit linking error

MacPorts noreply at macports.org
Tue Jan 11 02:22:01 PST 2011


#27925: g++ 4.5.2 64-bit linking error
--------------------------------------------------------------------------------------+
 Reporter:  lowtech@…                                                                 |       Owner:  mww@…           
     Type:  defect                                                                    |      Status:  new             
 Priority:  Normal                                                                    |   Milestone:                  
Component:  ports                                                                     |     Version:  1.9.2           
 Keywords:  gcc g++ 4.5.2 link libstdc++.dylib libgcc_ext.10.5.dylib libgcc.a 64-bit  |        Port:  gcc45           
--------------------------------------------------------------------------------------+
Changes (by ryandesign@…):

  * owner:  macports-tickets@… => mww@…


Old description:

> Building a 64-bit binary with g++ 4.5.2 fails with linking error
> (Core2Duo, OS X 10.5.8, MacPorts 1.9.2, gcc 4.5.2_0)
>
> '''ld warning: in /opt/local/lib/gcc45/libstdc++.dylib, file is not of
> required architecture'''[[BR]]
> '''ld warning: in /opt/local/lib/gcc45/libgcc_ext.10.5.dylib, missing
> required architecture x86_64 in file'''[[BR]]
> '''ld warning: in /opt/local/lib/gcc45/gcc/i386-apple-
> darwin9/4.5.2/libgcc.a, file is not of required architecture'''
>

>
> C++ example code for testing from
> http://en.literateprograms.org/Sieve_of_Eratosthenes_%28C_Plus_Plus%29
>
> '''32-bit version from above example builds well:'''[[BR]]
> $ g++-mp-4.5 -O3 -o test32 test.cpp Sieve.cpp -m32[[BR]]
> $ ./test32 25
>
> Sieved over integers 1 to 25 in 0.036 ms (1440 ns per integer)
>
> 2
> 3
> 5
> 7
> 11
> 13
> 17
> 19
> 23
>

> '''64-bit build process with errors:'''[[BR]]
> $ g++-mp-4.5 -O3 -o test64 test.cpp Sieve.cpp -m64[[BR]]
>
> ld warning: in /opt/local/lib/gcc45/libstdc++.dylib, file is not of
> required architecture[[BR]]
> ld warning: in /opt/local/lib/gcc45/libgcc_ext.10.5.dylib, missing
> required architecture x86_64 in file[[BR]]
> ld warning: in /opt/local/lib/gcc45/gcc/i386-apple-
> darwin9/4.5.2/libgcc.a, file is not of required architecture
> Undefined symbols:
>   "operator new(unsigned long)", referenced from:
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
> const&) in cc9ixqLk.o
>       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned long*,
> std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned
> long const&) in ccajKxKL.o
>   "___gxx_personality_v0", referenced from:
>       EH_frame1 in cc9ixqLk.o
>       EH_frame1 in ccajKxKL.o
>   "operator delete(void*)", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::~vector() in cc9ixqLk.o
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
> const&) in cc9ixqLk.o
>       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
>       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
>       std::vector<bool, std::allocator<bool> >::~vector() in ccajKxKL.o
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::~vector() in ccajKxKL.o
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned long*,
> std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned
> long const&) in ccajKxKL.o
>   "std::basic_ostream<char, std::char_traits<char> >::put(char)",
> referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::ios_base::Init::~Init()", referenced from:
>       global constructors keyed to test.cpp in cc9ixqLk.o
>   "std::basic_ostream<char, std::char_traits<char> >&
> std::basic_ostream<char, std::char_traits<char>
> >::_M_insert<double>(double)", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::ctype<char>::_M_widen_init() const", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::basic_ostream<char, std::char_traits<char> >::flush()",
> referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::basic_ostream<char, std::char_traits<char> >&
> std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned
> long>(unsigned long)", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::ios_base::Init::Init()", referenced from:
>       global constructors keyed to test.cpp in cc9ixqLk.o
>   "std::__throw_bad_cast()", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::basic_ostream<char, std::char_traits<char> >&
> std::__ostream_insert<char, std::char_traits<char>
> >(std::basic_ostream<char, std::char_traits<char> >&, char const*,
> long)", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>   "std::__throw_bad_alloc()", referenced from:
>       std::vector<unsigned long, std::allocator<unsigned long>
> >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
> const&) in cc9ixqLk.o
>   "std::cout", referenced from:
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
>       _main in cc9ixqLk.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status

New description:

 Building a 64-bit binary with g++ 4.5.2 fails with linking error
 (Core2Duo, OS X 10.5.8, MacPorts 1.9.2, gcc 4.5.2_0)

 {{{
 ld warning: in /opt/local/lib/gcc45/libstdc++.dylib, file is not of
 required architecture
 ld warning: in /opt/local/lib/gcc45/libgcc_ext.10.5.dylib, missing
 required architecture x86_64 in file
 ld warning: in /opt/local/lib/gcc45/gcc/i386-apple-darwin9/4.5.2/libgcc.a,
 file is not of required architecture
 }}}

 C++ example code for testing from
 http://en.literateprograms.org/Sieve_of_Eratosthenes_%28C_Plus_Plus%29

 '''32-bit version from above example builds well:'''
 {{{
 $ g++-mp-4.5 -O3 -o test32 test.cpp Sieve.cpp -m32
 $ ./test32 25

 Sieved over integers 1 to 25 in 0.036 ms (1440 ns per integer)

 2
 3
 5
 7
 11
 13
 17
 19
 23
 }}}

 '''64-bit build process with errors:'''
 {{{
 $ g++-mp-4.5 -O3 -o test64 test.cpp Sieve.cpp -m64

 ld warning: in /opt/local/lib/gcc45/libstdc++.dylib, file is not of
 required architecture
 ld warning: in /opt/local/lib/gcc45/libgcc_ext.10.5.dylib, missing
 required architecture x86_64 in file
 ld warning: in /opt/local/lib/gcc45/gcc/i386-apple-darwin9/4.5.2/libgcc.a,
 file is not of required architecture
 Undefined symbols:
   "operator new(unsigned long)", referenced from:
       std::vector<unsigned long, std::allocator<unsigned long>
 >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
 const&) in cc9ixqLk.o
       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
       std::vector<unsigned long, std::allocator<unsigned long>
 >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned long*,
 std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned
 long const&) in ccajKxKL.o
   "___gxx_personality_v0", referenced from:
       EH_frame1 in cc9ixqLk.o
       EH_frame1 in ccajKxKL.o
   "operator delete(void*)", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       std::vector<unsigned long, std::allocator<unsigned long>
 >::~vector() in cc9ixqLk.o
       std::vector<unsigned long, std::allocator<unsigned long>
 >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
 const&) in cc9ixqLk.o
       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
       sieve_of_eratosthenes(unsigned long) in ccajKxKL.o
       std::vector<bool, std::allocator<bool> >::~vector() in ccajKxKL.o
       std::vector<unsigned long, std::allocator<unsigned long>
 >::~vector() in ccajKxKL.o
       std::vector<unsigned long, std::allocator<unsigned long>
 >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned long*,
 std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned
 long const&) in ccajKxKL.o
   "std::basic_ostream<char, std::char_traits<char> >::put(char)",
 referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::ios_base::Init::~Init()", referenced from:
       global constructors keyed to test.cpp in cc9ixqLk.o
   "std::basic_ostream<char, std::char_traits<char> >&
 std::basic_ostream<char, std::char_traits<char>
 >::_M_insert<double>(double)", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::ctype<char>::_M_widen_init() const", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::basic_ostream<char, std::char_traits<char> >::flush()", referenced
 from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::basic_ostream<char, std::char_traits<char> >&
 std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned
 long>(unsigned long)", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::ios_base::Init::Init()", referenced from:
       global constructors keyed to test.cpp in cc9ixqLk.o
   "std::__throw_bad_cast()", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::basic_ostream<char, std::char_traits<char> >&
 std::__ostream_insert<char, std::char_traits<char>
 >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)",
 referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
   "std::__throw_bad_alloc()", referenced from:
       std::vector<unsigned long, std::allocator<unsigned long>
 >::operator=(std::vector<unsigned long, std::allocator<unsigned long> >
 const&) in cc9ixqLk.o
   "std::cout", referenced from:
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
       _main in cc9ixqLk.o
 ld: symbol(s) not found
 collect2: ld returned 1 exit status
 }}}

--

-- 
Ticket URL: <https://trac.macports.org/ticket/27925#comment:1>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list