OGRECave / ogre-procedural

procedural geometry for Ogre3D
https://ogrecave.github.io/ogre-procedural/
MIT License
40 stars 15 forks source link

Targets don't link because Boost isn't linked. #143

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to build any target

What is the expected output? What do you see instead?
Expected - executables/libs should be build
What I see - Linker errors such as:
:-1: error: 
CMakeFiles/Sample_Extrusion.dir/__/common/src/BaseApplication.cpp.o: undefined 
reference to symbol '_ZN5boost6system15system_categoryEv'

What version of the product are you using? On what operating system?
Mercurial, Linux

Please provide any additional information below.
CMake files don't specify Boost libs to be linked with the targets. The patch 
I'm attaching fixes this.

Original issue reported on code.google.com by kam1k...@gmail.com on 11 Jul 2013 at 9:19

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

It shouldn't be necessary, as you can see in FindOgre.cmake :
 set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})

Then, for every OgreProcedural sample :
target_link_libraries(Sample_Primitives ${OgreProcedural_LIBRARIES} 
${OGRE_LIBRARIES} ${OIS_LIBRARIES})

Now, the question is : why FindOgre.cmake doesn't detect Boost in your case?

I'll setup a linux VM and try to reproduce...

Original comment by michael.broutin@gmail.com on 15 Jul 2013 at 9:31

GoogleCodeExporter commented 8 years ago
That line, is only linking to boost threads. The error line I get is because it 
can't link to boost system. A couple of lines before that we can see:
"find_package(Boost COMPONENTS thread QUIET)", and that's all inside conditions 
about threads.

Either Ogre only needs boost threads or it also needs boost system and it's not 
being linked to. Or maybe it's not ogre who needs boosst system but something 
else. I'm not sure.

Original comment by kam1k...@gmail.com on 15 Jul 2013 at 2:06

GoogleCodeExporter commented 8 years ago
I found out another way of making it work. See attached file.

Basically I took the "if (OGRE_CONFIG_THREADS)" out of the "if (OGRE_STATIC)" 
and added Boost version checks to link to additional libs Boost needs. This 
reflects what's dony by "CMake/Dependencies.cmake" on Ogre's tree.

So it's probably FindOgre.cmake that's outdated for linux or recent versions of 
boost.

Original comment by kam1k...@gmail.com on 15 Jul 2013 at 2:51

Attachments:

GoogleCodeExporter commented 8 years ago
Ok, I updated FindOGRE.cmake with the latest version from Ogre's source.
Please tell me if the fix is not working.

Original comment by michael.broutin@gmail.com on 23 Jul 2013 at 8:29

GoogleCodeExporter commented 8 years ago
Sorry, it still fails to build the samples without applying the patch.

Full error:
/usr/bin/ld: 
CMakeFiles/Sample_Extrusion.dir/__/common/src/BaseApplication.cpp.o: undefined 
reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/bin/ld: note: '_ZN5boost6system15system_categoryEv' is defined in DSO 
/usr/lib/libboost_system.so.1.54.0 so try adding it to the linker command line
/usr/lib/libboost_system.so.1.54.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

Original comment by kam1k...@gmail.com on 23 Jul 2013 at 11:54

GoogleCodeExporter commented 8 years ago
My bad, I just thought you were posting a more recent version of 
FindOGRE.cmake... I'll use yours, then.

If the bug is inside FindOGRE.cmake, could you post your patch in Ogre's 
bugtracker?
It's always better when the upstream version is correct.

Original comment by michael.broutin@gmail.com on 24 Jul 2013 at 6:23

GoogleCodeExporter commented 8 years ago
I applied your patch, and modified it to merge with latest Ogre's version.

Original comment by michael.broutin@gmail.com on 24 Jul 2013 at 9:29

GoogleCodeExporter commented 8 years ago
I already issued a pull request to Ogre...

Original comment by michael.broutin@gmail.com on 24 Jul 2013 at 9:47