haggai_e
haggai_e

Reputation: 4820

Problem compiling and using Qt with a non-default compiler

I'm trying to compile and use Qt. For some reason I have to use g++ version 3.4.3 for my application, and not the compiler installed on the system: g++ 4.1.2. I compiled Qt with the environment variables CXX and CC set to the old g++, but still when I link my app with the old g++ I get the following errors:

.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `typeinfo for std::exception@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_begin_catch@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator delete[](void*)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator new(unsigned int)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for std::bad_alloc@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::bad_alloc::~bad_alloc()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_pure_virtual@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `typeinfo for std::bad_alloc@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__gxx_personality_v0@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::exception::~exception()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_throw@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::uncaught_exception()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator delete(void*)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_allocate_exception@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator new[](unsigned int)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_rethrow@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::terminate()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_end_catch@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::exception::what() const@GLIBCXX_3.4'

Only using the new compiler and linker succeeds in linking the executable.

Does anyone have an idea on how to solve this?

Upvotes: 2

Views: 3001

Answers (2)

haggai_e
haggai_e

Reputation: 4820

It turns out that modifying LINK wasn't enough, but when I changed the PATH to point to the old compiler, Qt was compiled and linked solely with the old compiler, and then I was able to link it with my program. Should have thought of that ...

Upvotes: 2

ismail
ismail

Reputation: 47572

gcc 3.x and 4.x doesn't have a compatible C++ ABI, heck even some early 4.x versions are not compatible with the recent ones (read gcc 4.2+).

Upvotes: 0

Related Questions