[MacPorts] #27925: g++ 4.5.2 64-bit linking error
#27925: g++ 4.5.2 64-bit linking error --------------------------------------------------------------------------------------+ Reporter: lowtech@… | Owner: macports-tickets@… 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 --------------------------------------------------------------------------------------+ 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
-- Ticket URL: <https://trac.macports.org/ticket/27925> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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
#27925: gcc45: 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 --------------------------------------------------------------------------------------+ -- Ticket URL: <https://trac.macports.org/ticket/27925#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27925: gcc45: 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 --------------------------------------------------------------------------------------+ Comment(by jmr@…): Did you install gcc45 with +universal? If not, you're not expected to be able to build both 32- and 64-bit. What do you have build_arch set to? If it's x86_64 and you didn't use +universal then the port has built for the wrong arch for some reason, but if it's i386 then this is not a bug. -- Ticket URL: <https://trac.macports.org/ticket/27925#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27925: gcc45: 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 --------------------------------------------------------------------------------------+ Comment(by lowtech@…): Replying to [comment:3 jmr@…]:
Did you install gcc45 with +universal? If not, you're not expected to be able to build both 32- and 64-bit. What do you have build_arch set to? If it's x86_64 and you didn't use +universal then the port has built for the wrong arch for some reason, but if it's i386 then this is not a bug.
Found no build_arch setting in my macport.conf from 2007. Seems the default is then i386 on leopard. Unfortunately didn't install gcc45 with +universal. Updated the port now with "sudo port upgrade --enforce-variants gcc45 +universal" and got this error: {{{ ---> Fetching gmp ---> Verifying checksum(s) for gmp ---> Extracting gmp ---> Applying patches to gmp ---> Configuring gmp ---> Building gmp ---> Staging gmp into destroot ---> Installing gmp @5.0.1_0+universal ---> Deactivating gmp @5.0.1_0 ---> Activating gmp @5.0.1_0+universal ---> Cleaning gmp ---> Computing dependencies for gcc45 Error: Cannot install gcc45 for the arch(s) 'i386 x86_64' because Error: its dependency gmp does not build for the required arch(s) by default Error: and the configured universal_archs 'i386 ppc' are not sufficient. Error: Unable to upgrade port: architecture mismatch To report a bug, see <http://guide.macports.org/#project.tickets> }}} '''Workaround''': Adding "universal_archs x86_64 i386" to macports.conf and a second upgrade run with "+universal" did resolve this. Linking 64-bit with gcc45 works well now! Thanks to jmr for helping, sorry for reporting this as bug. -- Ticket URL: <https://trac.macports.org/ticket/27925#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#27925: gcc45: g++ 4.5.2 64-bit linking error ------------------------------+--------------------------------------------- Reporter: lowtech@… | Owner: mww@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 1.9.2 Resolution: invalid | Keywords: gcc g++ 4.5.2 link libstdc++.dylib libgcc_ext.10.5.dylib libgcc.a 64-bit Port: gcc45 | ------------------------------+--------------------------------------------- Changes (by jmr@…): * status: new => closed * resolution: => invalid -- Ticket URL: <https://trac.macports.org/ticket/27925#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts