Error running configure on Eihort under Ubuntu Edgy

Problems building or running the engine, queries about how to use features etc.
libolt
Greenskin
Posts: 126
Joined: Wed Jan 19, 2005 4:48 am
x 9

Error running configure on Eihort under Ubuntu Edgy

Post by libolt »

I have noticed an issue recently building Eihort on my Ubuntu Edgy system. I was getting an error about FreeImage not being installed even though I knew I had built and installed it previously. Prior to my recent update of CVS everything was working fine. So I checked the config.log and found this:

Code: Select all

configure:22506: gcc -o conftest -g -O2   conftest.c -lfreeimage  -lpthread -lz -lm -ldl  >&5
/usr/local/lib/libfreeimage.a(Plugin.o): In function `PluginList::FindNodeFromMime(char const*)':
Plugin.cpp:(.text+0xa46): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `PluginList::FindNodeFromFormat(char const*)':
Plugin.cpp:(.text+0xb16): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `PluginList::~PluginList()':
Plugin.cpp:(.text+0xbbd): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text+0xbc6): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text+0xbce): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `PluginList::~PluginList()':
Plugin.cpp:(.text+0xc6d): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text+0xc76): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text+0xc7e): undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
Plugin.cpp:(.text+0xcb7): undefined reference to `operator delete(void*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `PluginList::AddNode(void (*)(Plugin*, int), void*, char const*, char const*, char const*, char const*)':
Plugin.cpp:(.text+0xd37): undefined reference to `operator new(unsigned long)'
Plugin.cpp:(.text+0xd44): undefined reference to `operator new(unsigned long)'
Plugin.cpp:(.text+0xd7d): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text+0xd85): undefined reference to `operator delete(void*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `FreeImage_Initialise':
Plugin.cpp:(.text+0xec6): undefined reference to `operator new(unsigned long)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `FreeImage_DeInitialise':
Plugin.cpp:(.text+0xc3d): undefined reference to `operator delete(void*)'
/usr/local/lib/libfreeimage.a(Plugin.o): In function `std::_Rb_tree<int, std::pair<int const, PluginNode*>, std::_Select1st<std::pair<int const, PluginNode*> >, std::less<int>, std::allocator<std::pair<int const, PluginNode*> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, PluginNode*> >*)':
Plugin.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiP10PluginNodeESt10_Select1stIS4_ESt4lessIiESaIS4_EE8_M_eraseEPSt13_Rb_tree_nodeIS4_E[std::_Rb_tree<int, std::pair<int const, PluginNode*>, std::_Select1st<std::pair<int const, PluginNode*> >, std::less<int>, std::allocator<std::pair<int const, PluginNode*> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, PluginNode*> >*)]+0xcc): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiP10PluginNodeESt10_Select1stIS4_ESt4lessIiESaIS4_EE8_M_eraseEPSt13_Rb_tree_nodeIS4_E[std::_Rb_tree<int, std::pair<int const, PluginNode*>, std::_Select1st<std::pair<int const, PluginNode*> >, std::less<int>, std::allocator<std::pair<int const, PluginNode*> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, PluginNode*> >*)]+0xde): undefined reference to `operator delete(void*)'
Plugin.cpp:(.text._ZNSt8_Rb_treeIiSt4pairIKiP10PluginNodeESt10_Select1stIS4_ESt4lessIiESaIS4_EE8_M_eraseEPSt13_Rb_tree_nodeIS4_E[std::_Rb_tree<int, std::pair<int const, PluginNode*>, std::_Select1st<std::pair<int const, PluginNode*> >, std::less<int>, std::allocator<std::pair<int const, PluginNode*> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, PluginNode*> >*)]+0xf4): undefined reference to `operator delete(void*)'

Note: I didn't paste the entire error because of the length.

This error seems to be due to the configure check using gcc instead of g++ and therefore not linking against libstdc++ which FreeImage depends on.

I was able to work around it by adding -lstdc++ to this line:

LIBS="-lfreeimage $LIBS"

I am afraid my knowledge of autotools doesn't currently allow me to switch the check from using gcc to g++ to make it work.

I hope this helps.

Mike
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2

Post by pjcast »

configure works fine here. Not sure what is casuing your issue, and iirc, gcc just delegates to g++ when dealing with C++ files.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

That looks like a failure to link the STL - is there another -l that's needed in that test somehow? Perhaps some people don't see it because the STL is on a global link input list or something?
M
Gremlin
Posts: 198
Joined: Mon May 23, 2005 4:40 pm
Location: Spain

Post by M »

freeimage has a C API but uses C++ internally, right? It seems libolt only installed freeimage static lib, configure test fails because is trying to link a C program against libfreeimage.a using the C linker, thus libstdc++ symbols are unresolved. The test passes when linking to libfreeimage.so (since it is explicitly linked to libstdc++) or using the C++ linker (since it implicitly includes it for linking).

Solutions/workarounds:
- CC=g++ ./configure
- Use libfreeimage.so instead of .a
- Include libstdc++ in acinclude.m4 test: AC_CHECK_LIB(freeimage, FreeImage_Load,,,-lstdc++)
- Use C++ compiler for freeimage test: AC_LANG_PUSH([C++]), AC_CHECK_LIB(freeimage, FreeImage_Load), AC_LANG_POP
- Use C++ compiler for all configure tests: AC_LANG([C++])
libolt
Greenskin
Posts: 126
Joined: Wed Jan 19, 2005 4:48 am
x 9

Post by libolt »

Okay I figured out what it was. The copy of freeimage I had built and installed didn't come with a makefile that creates a symbolic link from libfreeimage-3.9.1.so to libfreeimage.so when running make install. So I created that by hand and now Ogre is happy.

Mike