danny
danny

Reputation: 65

Trying to build application in redhat machine and getting undefined reference error from linker

I am new in this sphere and need help of experienced people.

I am trying to build the product on redhat machine with gcc-4.7.2. I am linking lstdc++ statically. As a result I am getting undefined reference issue.

To be more specific, let me show some details.

  1. Building with -Wl,--verbose option shows : RHEL5.5/gcc-4.7.2/lib/libstdc++.a succeeded
  2. nm --demangle RHEL5.5/gcc-4.7.2/lib/libstdc++.a | grep "_M_hook" shows: 00000000 T std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)
  3. But as a result getting: sym_sdfio_ioinfo.cpp:(.text+0x598e): undefined reference to std::_List_node_base::_M_hook(std::_List_node_base*)' ../../lib/debugger/ye_datagen/tmax/lib/libsym_kernel-O.a(sym_sdfio_ioinfo_rw.o): In functionCIOInfo::LoadSegment(long long, SYM_SDF::CSDFFilter const*, SYM_SDF::CSDFSegment*)': sym_sdfio_ioinfo_rw.cpp:(.text+0xf3d): undefined reference to std::_List_node_base::_M_hook(std::_List_node_base*)' ../../lib/debugger/ye_datagen/tmax/lib/libsym_kernel-O.a(sym_sdfio_rw_text.o):sym_sdfio_rw_text.cpp:(.text+0x1592): more undefined references tostd::_List_node_base::_M_hook(std::_List_node_base*)' follow collect2: error: ld returned 1 exit status

The only strange thing I see is "00000000" in 00000000 T std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)

Please, help me to figure out what I am missing here.

Upvotes: 0

Views: 714

Answers (1)

Ethan Brown
Ethan Brown

Reputation: 703

Here we are, a year later, so this probably won't do you any good, but I ran in to this today. I was building on a RedHat 6 box, and had copied the application's source tree from my Ubuntu machine.

I encountered this error when building, but found that I had neglected to run a "make clean" on the source tree, and so was linking with objects built on Ubuntu. Make sure to clear out your build environment so that old libraries and objects aren't around polluting your pristine RedHat 6 build.

Upvotes: 1

Related Questions