#1373 Cmake: Do not link boost statically for MingW users.

Byatis
open
nobody
5
2012-12-05
2012-02-28
Nick Anderson
No

Those compiling 1.8 against the MingW versions of Boost libraries will find that the compilation fails due to the fact that OgreMain.dll and OgreTerrain.dll are linking against the dynamic versions of Boost (e.g., libboost_date_time-mgw46-1_48.dll etc.), not the static ones.

Added small check for (MINGW) to Dependencies.cmake to facilitate this. 1.8 compiling correctly on MingW here now.

Discussion

  • Nick Anderson
    Nick Anderson
    2012-02-28

    Changes to Dependencies.cmake

     
    Attachments
  • Nick Anderson
    Nick Anderson
    2012-03-03

    Just to confirm, it is *possible* to build BOOST from source on MingW using the "link=static" argument for bjam, but there is a longstanding problem with this and the sort of errors you get are as follows:

    Linking CXX shared library ..\bin\OgreMain.dll
    Creating library file: ..\lib\libOgreMain.dll.a
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text+0xf56): undefined reference to `_imp___ZN5boost6detail12get_tss_da
    taEPKv'
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text+0xf94): undefined reference to `_imp___ZN5boost6detail12set_tss_da
    taEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text+0x1089): undefined reference to `_imp___ZN5boost6detail12set_tss_d
    ataEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text+0x1ad5): undefined reference to `_imp___ZN5boost6detail12get_tss_d
    ataEPKv'
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text+0x1b15): undefined reference to `_imp___ZN5boost6detail12set_tss_d
    ataEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreMaterialManager.cpp.obj):OgreMaterialManag
    er.cpp:(.text$_ZN5boost19thread_specific_ptrIN4Ogre18MaterialSerializerEED1Ev[bo
    ost::thread_specific_ptr<Ogre::MaterialSerializer>::~thread_specific_ptr()]+0x35
    ): undefined reference to `_imp___ZN5boost6detail12set_tss_dataEPKvNS_10shared_p
    trINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreRoot.cpp.obj):OgreRoot.cpp:(.text+0x74a6):
    undefined reference to `_imp___ZN5boost6thread20hardware_concurrencyEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0x245a): undefined reference to `_imp___ZN5boost6detail12get_tss_dat
    aEPKv'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0x2492): undefined reference to `_imp___ZN5boost6detail12set_tss_dat
    aEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0x24e9): undefined reference to `_imp___ZN5boost6detail12set_tss_dat
    aEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0xeb6e): undefined reference to `_imp___ZN5boost6detail12get_tss_dat
    aEPKv'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0xec64): undefined reference to `_imp___ZN5boost6detail12set_tss_dat
    aEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0xefc7): undefined reference to `_imp___ZN5boost6detail12get_tss_dat
    aEPKv'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text+0xefff): undefined reference to `_imp___ZN5boost6detail12set_tss_dat
    aEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreScriptCompiler.cpp.obj):OgreScriptCompiler
    .cpp:(.text$_ZN5boost19thread_specific_ptrIN4Ogre14ScriptCompilerEED1Ev[boost::t
    hread_specific_ptr<Ogre::ScriptCompiler>::~thread_specific_ptr()]+0x35): undefin
    ed reference to `_imp___ZN5boost6detail12set_tss_dataEPKvNS_10shared_ptrINS0_20t
    ss_cleanup_functionEEEPvb'
    CMakeFiles\OgreMain.dir/objects.a(OgreWorkQueue.cpp.obj):OgreWorkQueue.cpp:(.tex
    t+0x9b2): undefined reference to `_imp___ZN5boost11this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreWorkQueue.cpp.obj):OgreWorkQueue.cpp:(.tex
    t+0x2a44): undefined reference to `_imp___ZN5boost11this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreWorkQueue.cpp.obj):OgreWorkQueue.cpp:(.tex
    t+0x38a4): undefined reference to `_imp___ZN5boost11this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreWorkQueue.cpp.obj):OgreWorkQueue.cpp:(.tex
    t+0x446b): undefined reference to `_imp___ZN5boost11this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0x3ee): undefined reference to `_imp___ZN5boost1
    1this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0xb68): more undefined references to `_imp___ZN5
    boost11this_thread6get_idEv' follow
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0xd74): undefined reference to `_imp___ZN5boost6
    thread4joinEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0xd8a): undefined reference to `_imp___ZN5boost6
    threadD1Ev'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0x1802): undefined reference to `_imp___ZN5boost
    11this_thread6get_idEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text+0x1ab5): undefined reference to `_imp___ZN5boost
    6thread12start_threadEv'
    CMakeFiles\OgreMain.dir/objects.a(OgreDefaultWorkQueueStandard.cpp.obj):OgreDefa
    ultWorkQueueStandard.cpp:(.text$_ZN5boost6detail24basic_condition_variable7do_wa
    itINS_11unique_lockINS_15recursive_mutexEEEEEbRT_NS0_7timeoutE[bool boost::detai
    l::basic_condition_variable::do_wait<boost::unique_lock<boost::recursive_mutex>
    >(boost::unique_lock<boost::recursive_mutex>&, boost::detail::timeout)]+0x13d):
    undefined reference to `_imp___ZN5boost11this_thread18interruptible_waitEPvNS_6d
    etail7timeoutE'
    collect2: ld returned 1 exit status
    mingw32-make[2]: *** [bin/OgreMain.dll] Error 1
    mingw32-make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
    mingw32-make: *** [all] Error 2

    As you can see, it's far easier for MingW users to build the standard dynamic BOOST and then just copy the .dlls to their OGRE bin directory.

     
  • I am successfully compiling Ogre 1.8 against Boost 1.49, and there are no errors or hickups whatsoever. A standard Boost compile yielded static and dynamic versions, Ogre links against the static versions, compilation works fine and SampleBrowser is working. All of this with the current MinGW release.
    So unless I'm missing something, I think this problem is no longer valid (perhaps fixed with Boost 1.49?).