Issue with Static Linking of CEGUI v0.7.1 - Linux
Posted: Thu Aug 05, 2010 20:27
Hello,
I am currently integrating CEGUI v0.7.1 into my OpenGL application and I am running into some difficulties with the final linking process on my application side.
CEGUI is able to make and install with no problems in a static configuration using the following configure line:
As you can see the CEGUI_FALAGARD_RENDERER, CEGUI_WITH_XERCES, and CEGUI_CODEC_FREEIMAGE defines were added on top of the required CEGUI_STATIC define and passed into the LDFLAGS for CEGUI's configure to force the inclusion of those module's header files based on the #ifdef statements in cegui/src/CEGUISystem.cpp file (e.g. #include "XMLParserModules/XercesParser/CEGUIXercesParserModule.h)
This generates the following static libraries:
Running strings and nm on libCEGUIFalagardWRBase.a, libCEGUIFreeImageImageCodec.a, and libCEGUIXercesParser.a show that the undefined reference to XXX mentioned in the first code block exist in the static library
... a similar result exists for createParser, destoryParser, destroyImageCodec, and createImageCodec when checking them against the libararies libCEGUIFreeImageImageCodec.a and libCEGUIXercesParser.a
Here is the linking line of my application:
I show this only to indicate that the libraries and the library locations exist during the link step, which based on strings and nm make the undefined references that much more confusing.
I have also tried the same configure and build process using the latest version of CEGUI in subversion (r2577) and the same undefined references exist there too. This only seems to be an issue when trying to statically link my application with CEGUI and does not exist when CEGUI is configured to create shared objects for runtime loading.
Some other information that might be useful:
Any information or suggestions would be greatly appreciated!
I am currently integrating CEGUI v0.7.1 into my OpenGL application and I am running into some difficulties with the final linking process on my application side.
Code: Select all
/home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a(libCEGUIBase_la-CEGUIScheme.o)(.text+0x585): In function `CEGUI::Scheme::loadWindowRendererFactories()':
/usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_iterator.h:614: undefined reference to `getWindowRendererModule'
/home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a(libCEGUIBase_la-CEGUISystem.o)(.text+0x19bb): In function `CEGUI::System::setupXMLParser()':
/home/fero/code/P3/CEGUI-0.7.1/cegui/src/CEGUISystem.cpp:1521: undefined reference to `createParser'
/home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a(libCEGUIBase_la-CEGUISystem.o)(.text+0x1a73): In function `CEGUI::System::cleanupXMLParser()':
/home/fero/code/P3/CEGUI-0.7.1/cegui/src/CEGUISystem.cpp:1562: undefined reference to `destroyParser'
/home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a(libCEGUIBase_la-CEGUISystem.o)(.text+0x1f39): In function `CEGUI::System::cleanupImageCodec()':
/home/fero/code/P3/CEGUI-0.7.1/cegui/src/CEGUISystem.cpp:1733: undefined reference to `destroyImageCodec'
/home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a(libCEGUIBase_la-CEGUISystem.o)(.text+0x1f90): In function `CEGUI::System::setupImageCodec(CEGUI::String const&)':
/home/fero/code/P3/CEGUI-0.7.1/cegui/src/CEGUISystem.cpp:1700: undefined reference to `createImageCodec'
collect2: ld returned 1 exit status
CEGUI is able to make and install with no problems in a static configuration using the following configure line:
Code: Select all
sh configure --prefix="/home/fero/code/P3/CEGUI-0.7.1" --enable-debug --enable-static --disable-shared --disable-tga --disable-expat --disable-libxml --disable-tinyxml --disable-samples PKG_CONFIG_PATH="/home/fero/code/P3/pcre-8.10/lib/pkgconfig" LDFLAGS="-L/home/fero/code/P3/pcre-8.10/lib -L/home/fero/code/P3/FreeImage/lib -L/home/fero/code/P3/wxWidgets-2.8.11/lib" CPPFLAGS="-I/home/fero/code/P3/pcre-8.10/include -I/home/fero/code/P3/FreeImage/include -I/home/fero/code/P3/wxWidgets-2.8.11/include -DCEGUI_STATIC -DCEGUI_FALAGARD_RENDERER -DCEGUI_WITH_XERCES -DCEGUI_CODEC_FREEIMAGE"
As you can see the CEGUI_FALAGARD_RENDERER, CEGUI_WITH_XERCES, and CEGUI_CODEC_FREEIMAGE defines were added on top of the required CEGUI_STATIC define and passed into the LDFLAGS for CEGUI's configure to force the inclusion of those module's header files based on the #ifdef statements in cegui/src/CEGUISystem.cpp file (e.g. #include "XMLParserModules/XercesParser/CEGUIXercesParserModule.h)
This generates the following static libraries:
- libCEGUIBase.a
libCEGUIFalagardWRBase.a
libCEGUIFreeImageImageCodec.a
libCEGUIOpenGLRenderer.a
libCEGUIXercesParser.a
NOTE: The required libraries (FreeImage v3.13.1, PCRE v8.10, and wxWidgets v2.8.11) for building CEGUI in this configuration were also built statically
Running strings and nm on libCEGUIFalagardWRBase.a, libCEGUIFreeImageImageCodec.a, and libCEGUIXercesParser.a show that the undefined reference to XXX mentioned in the first code block exist in the static library
Code: Select all
strings libCEGUIFalagardWRBase.a | grep getWindowRendererModule
getWindowRendererModule
getWindowRendererModule
getWindowRendererModule
_ZGVZ23getWindowRendererModuleE3mod
_ZGVZ23getWindowRendererModuleE3mod
_ZZ23getWindowRendererModuleE3mod
getWindowRendererModule
Code: Select all
nm libCEGUIFalagardWRBase.a | grep getWindowRendererModule
000005e8 T getWindowRendererModule
00000000 b _ZGVZ23getWindowRendererModuleE3mod
00000008 b _ZZ23getWindowRendererModuleE3mod
... a similar result exists for createParser, destoryParser, destroyImageCodec, and createImageCodec when checking them against the libararies libCEGUIFreeImageImageCodec.a and libCEGUIXercesParser.a
Here is the linking line of my application:
Code: Select all
g++ -g3 -fno-inline -O0 -I/usr/include -I../../../mysql-connector/include -I../../../boost/include/boost-1_41 -I../../../protobuf/include -I../../../rapidxml -DLINUX -DDEBUG -g3 -fno-inline -O0 -I/usr/include/GL -I/home/fero/glstudio/include -I/home/fero/glstudio/plugins/include -I/usr/include/mysql -I/home/fero/glstudio/include -I/home/fero/glstudio/plugins/include -I../../../CEGUI-0.7.1/include/CEGUI -I/home/fero/code/P3/pcre-8.10/include -I/home/fero/code/P3/FreeImage/include -I/home/fero/code/P3/wxWidgets-2.8.11/include -DCEGUI_STATIC -DCEGUI_FALAGARD_RENDERER -DCEGUI_WITH_XERCES -DCEGUI_CODEC_FREEIMAGE -I../components/source/ -I../../common -I../../common/data -I../../common/components/source -I../../common/disti -I../../common/logic -I../../common/events/source -DCPPCONN_PUBLIC_FUNC= -DIOS_APPLICATION -DWITH_MILLISECONDS -o ios CEGUIManager.o IOSApplication.o IOSConsoleApp.o CEGUIPanel.o BaseApplication.o ConversionUtils.o Location.o MySQLConnection.o Orientation.o PACT3Event.o StationGLSBase.o TimerInterface.o DCIPanel.o _DCIKnobPopup.o DatabaseObject.o DCIICSData.o DCIModeData.o DCIMonData.o DCITrData.o DCIUSRData.o DigitalCrewInterfaceData.o StartupScenarioParametersData.o Highlightable.o HighlightGlsSwitch.o HighlightGlsKnob.o Testable.o event.pb.o DCIICSLogic.o DCILogic.o DCIMonLogic.o DCITrLogic.o DCIUSRLogic.o LogicBase.o SubLogicBase.o DCILogicMySQLConnection.o -L/home/fero/code/P3/mysql-connector/driver -L/home/fero/code/P3/boost/lib -L/home/fero/code/P3/protobuf/lib -L/usr/X11R6/lib -L/home/fero/glstudio/lib -L/home/fero/glstudio/plugins/lib -L/usr/lib/mysql -lmysqlcppconn-static -lboost_date_time-gcc34-mt-sd -lboost_filesystem-gcc34-mt-sd -lboost_program_options-gcc34-mt-sd -lboost_serialization-gcc34-mt-sd -lboost_system-gcc34-mt-sd -lboost_thread-gcc34-mt-sd /home/fero/code/P3/protobuf/lib/libprotobuf.a -lglsutil_Linux_gcc_342 -lgls_unlimited_Linux_gcc_342 -lglstudioLinux_gcc_342 -L/home/fero/code/P3/CEGUI-0.7.1/lib -L/home/fero/code/P3/pcre-8.10/lib -L/home/fero/code/P3/FreeImage/lib -L/home/fero/code/P3/wxWidgets-2.8.11/lib -lgls_text_grid_Linux_gcc_342 -lgls_moving_eye_Linux_gcc_342 -lgls_multi_view_Linux_gcc_342 -lgls_thumb_wheel_Linux_gcc_342 -lgls_odometer_Linux_gcc_342 /usr/lib/mysql/libmysqlclient.a -lpthread -lcrypt -lnsl -lm /home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIFreeImageImageCodec.a -lfreeimage /home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIXercesParser.a -lxerces-c /home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIFalagardWRBase.a /home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIOpenGLRenderer.a /home/fero/code/P3/CEGUI-0.7.1/lib/libCEGUIBase.a /usr/lib/libfreetype.so /usr/lib/mysql/libz.a /home/fero/code/P3/pcre-8.10/lib/libpcre.a -lglut -lGLU /usr/lib/libGL.so -lXext -lX11 -ldl -lSM -lICE
I show this only to indicate that the libraries and the library locations exist during the link step, which based on strings and nm make the undefined references that much more confusing.
I have also tried the same configure and build process using the latest version of CEGUI in subversion (r2577) and the same undefined references exist there too. This only seems to be an issue when trying to statically link my application with CEGUI and does not exist when CEGUI is configured to create shared objects for runtime loading.
Some other information that might be useful:
- RedHat Enterprise Linux 4
g++ version is 3.4.6
32-bit architecture
Any information or suggestions would be greatly appreciated!