From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 Description of problem: I'm porting some software to limbo in the hopes that this will make my life easier when I have to port it to RedHat8.0 if it ever happens to exist. When I try to build a particular C++ program, the compile goes OK, but it fails on linking, giving a lot of "undefined reference" errors, like: undefined reference to `__gxx_personality_v0' undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' undefined reference to `__cxa_pure_virtual' ...and a slew of others. I'm not much of a c++ or g++ expert, so I looked around on the libstdc++ mailing list and found several references to people having similar problems, relating to libsupc++. I found that manually linking /usr/lib/gcc-lib/i386-redhat-linux/3.2/libsupc++.a to my program resolves all the references, so I'd guess that libsupc++ isn't being linked into libstdc++, or something at least tangentially related to libsupc++. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: Attempt to link C++ program. I'm not sure what in the program causes these problems. Actual Results: Fails to link with many "undefined reference" errors. Expected Results: Should have linked correctly. Additional info: Compiler info: gcc-3.2-0.1.1 libgcc-3.2-0.1.1 gcc-c++-3.2-0.1.1 libstdc++-3.2-0.1.1 libstdc++-devel-3.2-0.1.1 Error output: gcc -o DRACSnmp MegaRacAgent.o agent.o dllist.o snmpapi.o MegaRacMib.o avltree.o mib.o -L../API -lDRAC MegaRacAgent.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' agent.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' MegaRacMib.o(.gnu.linkonce.d._ZTVN3MIB6ObjectE+0x10): undefined reference to `__cxa_pure_virtual' MegaRacMib.o(.gnu.linkonce.d._ZTVN3MIB6ObjectE+0x14): undefined reference to `__cxa_pure_virtual' MegaRacMib.o(.gnu.linkonce.d._ZTVN3MIB6ObjectE+0x18): undefined reference to `__cxa_pure_virtual' MegaRacMib.o(.gnu.linkonce.d._ZTVN3MIB11TrapMonitorE+0x8): undefined reference to `__cxa_pure_virtual' MegaRacMib.o: In function `MegaRacMib::MonitorGroup::Entry::PagerIdOctetString::~PagerIdOctetString [in-charge deleting]()': MegaRacMib.o(.gnu.linkonce.t._ZN10MegaRacMib12MonitorGroup5Entry18PagerIdOctetStringD0Ev+0xf): undefined reference to `operator delete(void*)' MegaRacMib.o: In function `MIB::Object::~Object [in-charge deleting]()': MegaRacMib.o(.gnu.linkonce.t._ZN3MIB6ObjectD0Ev+0xf): undefined reference to `operator delete(void*)' MegaRacMib.o: In function `MIB::Table::Row::~Row [in-charge deleting]()': MegaRacMib.o(.gnu.linkonce.t._ZN3MIB5Table3RowD0Ev+0xf): undefined reference to `operator delete(void*)' MegaRacMib.o: In function `MegaRacMib::Group::Entry::MRInteger::~MRInteger [in-charge deleting]()': MegaRacMib.o(.gnu.linkonce.t._ZN10MegaRacMib5Group5Entry9MRIntegerD0Ev+0xf): undefined reference to `operator delete(void*)' MegaRacMib.o: In function `MegaRacMib::Group::Entry::MROctetString::~MROctetString [in-charge deleting]()': MegaRacMib.o(.gnu.linkonce.t._ZN10MegaRacMib5Group5Entry13MROctetStringD0Ev+0xf): undefined reference to `operator delete(void*)' MegaRacMib.o(.gnu.linkonce.t._ZN10MegaRacMib5Group5Entry15LockOctetStringD0Ev+0xf): more undefined references to `operator delete(void*)' follow MegaRacMib.o(.gnu.linkonce.d._ZTIN3MIB11TrapMonitorE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN3MIB6ObjectE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN3MIB5Table3RowE+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib5Group5Entry9MRIntegerE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib5Group5Entry13MROctetStringE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib5Group5Entry15LockOctetStringE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib5Group5EntryE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib5GroupE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib12VoltageGroup5EntryE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib12VoltageGroupE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib16TemperatureGroup5EntryE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib16TemperatureGroupE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib12BatteryGroup5EntryE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib12BatteryGroupE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib17GlobalStatusGroup5EntryE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN10MegaRacMib17GlobalStatusGroupE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTI10MegaRacMib+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN3MIB4NodeE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTI6DLList+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' MegaRacMib.o(.gnu.linkonce.d._ZTIN7AVLTree4NodeE+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' MegaRacMib.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' avltree.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' mib.o(.gnu.linkonce.d._ZTVN3MIB9PrimitiveE+0x10): undefined reference to `__cxa_pure_virtual' mib.o(.gnu.linkonce.d._ZTVN3MIB9PrimitiveE+0x14): undefined reference to `__cxa_pure_virtual' mib.o: In function `MIB::NVInteger::~NVInteger [in-charge deleting]()': mib.o(.gnu.linkonce.t._ZN3MIB9NVIntegerD0Ev+0xf): undefined reference to `operator delete(void*)' mib.o: In function `MIB::NVOctetString::~NVOctetString [in-charge deleting]()':mib.o(.gnu.linkonce.t._ZN3MIB13NVOctetStringD0Ev+0xf): undefined reference to `operator delete(void*)' mib.o: In function `MIB::NVObjectIdentifier::~NVObjectIdentifier [in-charge deleting]()': mib.o(.gnu.linkonce.t._ZN3MIB18NVObjectIdentifierD0Ev+0xf): undefined reference to `operator delete(void*)' mib.o: In function `MIB::Table::~Table [in-charge deleting]()': mib.o(.gnu.linkonce.t._ZN3MIB5TableD0Ev+0x1d): undefined reference to `operator delete(void*)' mib.o: In function `MIB::Primitive::~Primitive [in-charge deleting]()': mib.o(.gnu.linkonce.t._ZN3MIB9PrimitiveD0Ev+0xf): undefined reference to `operator delete(void*)' mib.o(.gnu.linkonce.t._ZN3MIB7SubtreeD0Ev+0x16): more undefined references to `operator delete(void*)' follow mib.o(.gnu.linkonce.d._ZTIN3MIB9PrimitiveE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB7SubtreeE+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB7IntegerE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB9NVIntegerE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB11OctetStringE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB13NVOctetStringE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB16ObjectIdentifierE+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' mib.o(.gnu.linkonce.d._ZTIN3MIB18NVObjectIdentifierE+0x0): more undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow mib.o(.gnu.linkonce.d._ZTI7AVLTree+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' mib.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status make: *** [MegaRacSnmp] Error 1
The bug is you're using gcc driver to link C++ application. g++ -o DRACSnmp MegaRacAgent.o agent.o dllist.o snmpapi.o MegaRacMib.o avltree.o mib.o -L../API -lDRAC should work just fine. Or, if your program doesn't use STL at all, you can of course gcc -o .... -lsupc++. Only g++ driver adds -lstdc++ to the link.