Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 559472

Summary: dev-games/ogre-1.9.0 does not build with gcc-5.2.0
Product: Gentoo Linux Reporter: Sven Eden <sven.eden>
Component: [OLD] GCC PortingAssignee: Gentoo Games <games>
Status: RESOLVED FIXED    
Severity: normal CC: sven.eden
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://ogre3d.atlassian.net/browse/OGRE-501
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 536984    
Attachments: Move the definition of the offending template to the header.

Description Sven Eden 2015-09-03 05:15:09 UTC
Created attachment 410902 [details, diff]
Move the definition of the offending template to the header.

The build fails with:

----
cd /home/portage/dev-games/ogre-1.9.0-r1/work/ogre-1.9.0_build/Tools/MeshUpgrader && /usr/bin/cmake -E cmake_link_script CMakeFiles/OgreMeshUpgrader.dir/link.txt -
-verbose=1
/usr/bin/x86_64-pc-linux-gnu-g++   -march=native -pipe -ggdb -O2 -ftree-vectorize  -msse -Wall -Winit-self -Wno-overloaded-virtual -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wshadow -Wno-missing-field-initializers -Wno-long-long -Wno-unused-but-set-parameter   -Wl,-O1 -Wl,--as-needed CMakeFiles/OgreMeshUpgrader.dir/src/main.cpp.o  -o ../../bin/OgreMeshUpgrader  -L/usr/lib64/x86_64-linux-gnu -rdynamic ../../lib/libOgreMain.so.1.9.0 /usr/lib64/x86_64-linux-gnu/libSM.so /usr/lib64/x86_64-linux-gnu/libICE.so /usr/lib64/x86_64-linux-gnu/libX11.so /usr/lib64/x86_64-linux-gnu/libXext.so /usr/lib64/x86_64-linux-gnu/libXt.so /usr/lib64/x86_64-linux-gnu/libXaw.so -lpthread -ldl /usr/lib64/x86_64-linux-gnu/libtbb.so /usr/lib64/x86_64-linux-gnu/libfreeimage.so /usr/lib64/x86_64-linux-gnu/libzzip.so -lz -latomic -Wl,-rpath,/home/portage/dev-games/ogre-1.9.0-r1/work/ogre-1.9.0_build/lib:/usr/lib64/x86_64-linux-gnu: 
../../lib/libOgreMain.so.1.9.0: undefined reference to `void Ogre::ProgressiveMeshGenerator::addIndexDataImpl<unsigned short>(unsigned short*, unsigned short const*, std::vector<Ogre::ProgressiveMeshGenerator::PMVertex*, Ogre::STLAllocator<Ogre::ProgressiveMeshGenerator::PMVertex*, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > >&, unsigned short)'
collect2: error: ld returned 1 exit status
Tools/MeshUpgrader/CMakeFiles/OgreMeshUpgrader.dir/build.make:96: recipe for target 'bin/OgreMeshUpgrader' failed
make[2]: *** [bin/OgreMeshUpgrader] Error 1
----

The reason is, that the ProgressiveMeshGenerator::addIndexDataImpl() template is only declared in the header, but defined in the compilation unit.

Normally this would be fine, but the instantiations (one for short int, one for int) are used in the compilation unit for the QueuedProgressiveMeshGenerator, which is no longer legal.

Each instantiation must be done in place, so the definition must be moved to the header.

I have created a patch to build ogre-1.9.0 successfully on gentoo. It simply covers the definition in OgreMain/src/OgreProgressiveMeshGenerator.cpp with #if 0/#endif and adds the definition to OgreMain/include/OgreProgressiveMeshGenerator.h so it becomes visible to OgreMain/src/OgreQueuedProgressiveMeshGenerator.cpp.

The attached patch fixes this.

I have applied the patch to my ebuild dev-games/ogre-1.9.0-r3 - available from my overlay 'seden' via layman.
Comment 1 Sven Eden 2015-09-03 05:29:26 UTC
I have reported this upstream:

https://ogre3d.atlassian.net/browse/OGRE-501
Comment 2 Mr. Bones. (RETIRED) gentoo-dev 2015-09-03 18:33:35 UTC
in portage.  thanks for the bug report and patch.