[Wiki] Building Ogre with boost 1.50 upwards and MinGW

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

[Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

When I started using Ogre with MinGW some time ago, I was really missing a bit of love for MinGW in the guides.
In the end, I managed to get everything running by browsing the already existing (and very helpful!) guides and using Google, etc.
But it really took a long time.

I figured that a guide would be in order that covers everything I had to go through to get everything working correctly.
So I wrote one! And I think that even though this is specific to MinGW it might be pretty helpful also for Linux users.

And here it is:
Click me

If you have any problems with the guide, or find any errors, this thread is the place to report :D

spacegaier was also so nice to make a new sub-section in the "Building Ogre" section for very specific guides like this one. So if you also want to write a rather specific guide on how to build Ogre, feel free ;)
My site! - Have a look :)
Also on Twitter - extra fluffy
kdulep
Gnoblar
Posts: 4
Joined: Thu Sep 13, 2012 6:29 am

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by kdulep »

have this error

Code: Select all

C:/DirectXSDK/Include/dinput.h:4287:2: warning: extra ';' [-pedantic]
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp: In constructor 'OIS::Win32JoyStick::Win32JoyStick(OIS::InputManager*, IDi
rectInput8A*, bool, DWORD, const OIS::JoyStickInfo&)':
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp:46:62: warning: declaration of 'buffered' shadows a member of 'this' [-Wsh
adow]
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp: In member function 'virtual void OIS::Win32JoyStick::setBuffered(bool)':
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp:381:46: warning: declaration of 'buffered' shadows a member of 'this' [-Ws
hadow]
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp: In member function 'virtual OIS::Interface* OIS::Win32JoyStick::queryInte
rface(OIS::Interface::IType)':
F:\PROG\ogre3d\dependencies\src\ois\src\win32\Win32JoyStick.old.cpp:387:63: warning: declaration of 'type' shadows a member of 'this' [-Wshado
w]
mingw32-make.EXE[2]: *** No rule to make target 'C:/Program', needed by 'bin/OIS.dll'.  Stop.
CMakeFiles\Makefile2:237: recipe for target 'Dependencies/src/ois/CMakeFiles/OIS.dir/all' failed
mingw32-make.EXE[1]: *** [Dependencies/src/ois/CMakeFiles/OIS.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make.EXE: *** [all] Error 2
ManicQin
Gnoblar
Posts: 9
Joined: Sun Nov 23, 2008 6:24 pm

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by ManicQin »

Hi,

I'm using Ogre3d on ubuntu,
Before upgrading to 1.8 I had: Ogre 1.7 + CEGui 0.7 + boost 48 compiled on gcc 4.6.

I'm trying to upgrade my system to Ogre 1.8 + CEGui 0.7 + boost 50 on gcc 4.7

After a while I succesusfully built all the dependencies, but now I have a crash on:

OgreGlRenderSystem.cpp function void GLRenderSystem::setScissorTest I think that mActiveRenderTarget is null.

Is there any way I can debug my pronblem? were there any changes I should have done to my code after the upgarde?

Thank you
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

kdulep wrote:have this error

Code: Select all

mingw32-make.EXE[2]: *** No rule to make target 'C:/Program', needed by 'bin/OIS.dll'.  Stop.
CMakeFiles\Makefile2:237: recipe for target 'Dependencies/src/ois/CMakeFiles/OIS.dir/all' failed
mingw32-make.EXE[1]: *** [Dependencies/src/ois/CMakeFiles/OIS.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make.EXE: *** [all] Error 2
There seems to be a problem that your path contains " " (whitespace). My guess is your files are somewhere in "C:/Program Files (x86)/...", correct?
This can screw up quite a lot programs, really, so it would be a good idea to have all your relevant libraries, sources, etc. in paths without whitespaces.
So try to install your files into something like C:/Ogre/etc... (no whitespaces! They are evil!) and try again :)

Other than that, the report you've shown does not show any errors. Only the usual too verbose gcc warnings ;)
So if the above doesn't fix it, you will have to give some more insights into your system, what you did, etc.

@ManicQin:
This thread is for the wiki article on MinGW mainly, not on gcc itself.
I don't know the answer to your question (seems like it is not neccessarily connected to gcc either) and you would most likely be better off asking the same in the Help forum itself. :)
My site! - Have a look :)
Also on Twitter - extra fluffy
theman515
Gnoblar
Posts: 1
Joined: Mon Feb 04, 2013 11:26 pm

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by theman515 »

Hey,

I'm using Ogre3d 1.8.1 on Windows 7 64-bit with boost 1.52 and I've gotten to the point where I build the actual sdk, cmake runs fine and it says boost is enabled and whenever I run the mingw32-make install I get these errors

I can see it's boost but all members being private? Can i fix that or do i just have to download an older boost version?

Code: Select all

In file included from C:/Users/Brandon/boost_1_52_0/boost/thread/detail/move.hpp
:20:0,
                 from C:/Users/Brandon/boost_1_52_0/boost/thread/locks.hpp:11,
                 from C:/Users/Brandon/boost_1_52_0/boost/thread/win32/recursive
_mutex.hpp:15,
                 from C:/Users/Brandon/boost_1_52_0/boost/thread/recursive_mutex
.hpp:14,
                 from C:/Users/Brandon/ogre/source/ogre/OgreMain/include/Threadi
ng/OgreThreadHeadersBoost.h:38,
                 from C:/Users/Brandon/ogre/source/ogre/OgreMain/include/Threadi
ng/OgreThreadHeaders.h:30,
                 from C:/Users/Brandon/ogre/source/ogre/OgreMain/include/OgreStd
Headers.h:122,
                 from C:/Users/Brandon/ogre/source/ogre/OgreMain/include/OgrePre
requisites.h:334,
                 from C:/Users/Brandon/ogre/source/ogre/OgreMain/include/OgreAni
mation.h:32,
                 from C:\Users\Brandon\ogre\source\ogre\OgreMain\src\OgreAnimati
on.cpp:29:
C:/Users/Brandon/boost_1_52_0/boost/move/move.hpp:123:10: warning: all member fu
nctions in class 'boost::move_detail::is_convertible<T, U>' are private [-Wctor-
dtor-privacy]
C:/Users/Brandon/boost_1_52_0/boost/move/move.hpp:248:10: warning: 'class boost:
:rv<T>' only defines a private destructor and has no friends [-Wctor-dtor-privac
y]
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Yes, those are pretty annoying warnings and I'm thinking about hiding them in the building process.
But they are warnings, not errors and should not prevent you from building the SDK.

This may also be related to this "bug" reported on the GCC bug list.
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by holocronweaver »

I followed you guide and got Ogre building on Windows using MinGW for the first time. No more VS! :D

Unfortunately, when I try to use CMake on even a simple tutorial framework, it complains that it cannot find the Boost library files:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_CHRONO_LIBRARY (ADVANCED)
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
Boost_DATE_TIME_LIBRARY (ADVANCED)
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
Boost_SYSTEM_LIBRARY (ADVANCED)
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
Boost_THREAD_LIBRARY (ADVANCED)
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
linked by target "ExampleApplication" in directory D:/winsrc/BareOgre
Looking in the advanced settings, I see that Boost_CHRONO_LIBRARY is set, but not Boost_CHRONO_LIBRARY_DEBUG or Boost_CHRONO_LIBRARY_RELEASE. Same goes for the other libraries on the list.

I have been unable to find a solution on the forums. Any help would be greatly appreciated!
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Not sure if this really belongs in this topic, the build worked correctly as you said.

And what tutorial framework CMake do you mean? I usually don't use any premade frameworks, so I have no idea about them :)
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
holocronweaver
Google Summer of Code Student
Google Summer of Code Student
Posts: 273
Joined: Mon Oct 29, 2012 8:52 pm
Location: Princeton, NJ
x 47

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by holocronweaver »

I decided to use a dynamic Ogre build because I was having trouble building the standard CMake project framework with the static Ogre build. Apparently statically linking boost to a dynamic Ogre build is problematic (though I do not understand why), so I simply set the following line in the project's CMake file from:

Code: Select all

set(Boost_USE_STATIC_LIBS TRUE) 
to

Code: Select all

set(Boost_USE_STATIC_LIBS ${OGRE_STATIC})
so that I am dynamically linking to boost. This solved the problem. Maybe this odd static/dynamic linking incompatibility should be mentioned in the guide? Unless there is something else I am missing here...it isn't a x64 issue, is it? I can't imagine how.

Now to try a static build using MinGW once more. Wish me luck. I will need it. :lol:
kdulep
Gnoblar
Posts: 4
Joined: Thu Sep 13, 2012 6:29 am

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by kdulep »

again after succesfull building sometime before Ogre3d, starange error in trunk, seems it cannot find DirectX includes, do i need run DirectX' dx_setenv.cmd somehow?

Code: Select all

[ 99%] Building CXX object Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj
In file included from D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9RenderSystem.h:31:0,
                 from D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9Plugin.h:32,
                 from D:/PROG/ogre/Samples/Common/include/OgreStaticPluginLoader.h:52,
                 from D:/PROG/ogre/Samples/Common/include/SampleContext.h:82,
                 from D:/PROG/ogre/Samples/Browser/include/SampleBrowser.h:31,
                 from D:\PROG\ogre\Samples\Browser\src\SampleBrowser.cpp:35:
D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9Prerequisites.h:73:19: fatal error: d3dx9.h: No such file or directory
compilation terminated.
Samples\Browser\CMakeFiles\SampleBrowser.dir\build.make:57: recipe for target 'Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj' failed
mingw32-make.EXE[2]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj] Error 1
CMakeFiles\Makefile2:3787: recipe for target 'Samples/Browser/CMakeFiles/SampleBrowser.dir/all' failed
mingw32-make.EXE[1]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make.EXE: *** [all] Error 2
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Interesting. When you open Ogre sources in the CMake GUI, are the paths it finds for DirectX correct?
You can see those when switching to advanced mode.
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by Kojack »

D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9Prerequisites.h:73:19: fatal error: d3dx9.h: No such file or directory
That looks like a platform sdk issue (I thought it was fixed in ogre not too long ago).
There's two sources of directx: the directx sdk (june 2010 is the latest) or the windows platform sdk.
In the latest windows platform sdk they crippled directx, the d3dx9 stuff was removed, as well as some other bits.

If cmake finds and uses the platform sdk's version of directx rather than the full directx sdk, you'll get the error above.
kdulep
Gnoblar
Posts: 4
Joined: Thu Sep 13, 2012 6:29 am

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by kdulep »

Code: Select all

Looking for DirectX9...
Found DirectX9: C:/DirectXSDK/Lib/x86/d3d9.lib
Looking for DirectX11...
Found DirectX11: C:/DirectXSDK/Lib/x86/d3d11.lib
CMakeCache.txt

Code: Select all

//x
DirectX9_INCLUDE_DIR:PATH=C:/DirectXSDK/Include
i disabled DX11 as advised for MinGW
i use standalone DirectX SDK june 2010 not platform one
C:/DirectXSDK/Include present and contains SDK include files

i use todays repo v1-9 branch
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Do you have the platform sdk installed?
Because I simply can't reproduce that error, no matter how hard I try :|
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by Kojack »

C:/DirectXSDK/Include present and contains SDK include files
but does it contain a file called exactly d3dx9.h?
(Just making sure. Maybe the install was corrupted or something)
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by dermont »

kdulep wrote:again after succesfull building sometime before Ogre3d, starange error in trunk, seems it cannot find DirectX includes, do i need run DirectX' dx_setenv.cmd somehow?

Code: Select all

[ 99%] Building CXX object Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj
In file included from D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9RenderSystem.h:31:0,
                 from D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9Plugin.h:32,
                 from D:/PROG/ogre/Samples/Common/include/OgreStaticPluginLoader.h:52,
                 from D:/PROG/ogre/Samples/Common/include/SampleContext.h:82,
                 from D:/PROG/ogre/Samples/Browser/include/SampleBrowser.h:31,
                 from D:\PROG\ogre\Samples\Browser\src\SampleBrowser.cpp:35:
D:/PROG/ogre/RenderSystems/Direct3D9/include/OgreD3D9Prerequisites.h:73:19: fatal error: d3dx9.h: No such file or directory
compilation terminated.
Samples\Browser\CMakeFiles\SampleBrowser.dir\build.make:57: recipe for target 'Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj' failed
mingw32-make.EXE[2]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/src/SampleBrowser.cpp.obj] Error 1
CMakeFiles\Makefile2:3787: recipe for target 'Samples/Browser/CMakeFiles/SampleBrowser.dir/all' failed
mingw32-make.EXE[1]: *** [Samples/Browser/CMakeFiles/SampleBrowser.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make.EXE: *** [all] Error 2
Yeah this is a known issue with the MinGW build. From the build output you uploaded your obviously doing a static build.

You can fudge it by updating the SampleBrowser CMakeLists.txt with the (MINGW AND OGRE_STATIC) settings or something similar ( sorry don't know how to create a patch with tortoise-hg):

Code: Select all

if (OGRE_STATIC)
..
    if (MINGW AND OGRE_STATIC)
    include_directories(
        ${DirectX9_INCLUDE_DIR}
    )
    endif()    
    
else()
...

if (MINGW AND OGRE_STATIC)
    link_directories(${DirectX9_LIBRARY_DIR})
endif()    


ogre_add_executable(SampleBrowser WIN32 ${HEADER_FILES} ${SOURCE_FILES} ${RESOURCE_FILES})


if (MINGW AND OGRE_STATIC)
	target_link_libraries(SampleBrowser ${DirectX9_LIBRARIES})
endif() 

...   
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

So the problem is with static builds?
That would have been a nice information, that is something I test only very rarely (as I see no benefit in static linking of Ogre libraries).
In any case, it would be great if you could add an issue for that on our JIRA board (with the hint of it being a static build problem, probably).
My site! - Have a look :)
Also on Twitter - extra fluffy
User avatar
edoardo
Kobold
Posts: 36
Joined: Thu Apr 28, 2011 8:44 am
Location: Torino, Italy

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by edoardo »

Hi guys,

I managed to build boost and the ogre dependencies with MinGW (following your very appreciated guide), but i fails to build Ogre (not static, I do a dynamic build because I have configured CMake in that way and I want it that way).

- boost: OK

Code: Select all

...failed updating 24 targets...
...skipped 40 targets...
...updated 4600 targets...
- ogre dependencies: OK

- ogre SDK: FAIL

Code: Select all

mingw32-make[2]: *** No rule to make target `x86)/NVIDIA Corporation/Cg/bin/cg.dll)', needed by `bin/Plugin_CgProgramManager.dll'.  Stop.
mingw32-make[1]: *** [PlugIns/CgProgramManager/CMakeFiles/Plugin_CgProgramManager.dir/all] Error 2
mingw32-make: *** [all] Error 2
I have fixed this one by putting double quotes around Cg path (I installed it in the default path that has "Program files" and "NVIDIA Corporation" chunks with spaces) in the CMake config files, but suddenly I have now another problem:

Code: Select all

Linking CXX shared library ..\..\bin\RenderSystem_Direct3D11.dll
Creating library file: ..\..\lib\libRenderSystem_Direct3D11.dll.a
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized
D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86\DxErr.lib(e:/temp/193462/obj.x86fre/misc/dxerr/objfre/i386/dxerra.obj):(.text[_DXTraceA@20]+0xb
): undefined reference to `_chkstk'
D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86\DxErr.lib(e:/temp/193462/obj.x86fre/misc/dxerr/objfre/i386/dxerra.obj):(.text[_DXTraceA@20]+0x1
0): undefined reference to `__security_cookie'
D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86\DxErr.lib(e:/temp/193462/obj.x86fre/misc/dxerr/objfre/i386/dxerra.obj):(.text[_DXTraceA@20]+0x1
e6): undefined reference to `@__security_check_cookie@4'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/RenderSystem_Direct3D11.dll] Error 1
mingw32-make[1]: *** [RenderSystems/Direct3D11/CMakeFiles/RenderSystem_Direct3D11.dir/all] Error 2
mingw32-make: *** [all] Error 2
Is that because DirectX SDK is compiled with VisualStudio? In that case how could I avoid the problem (without disabling DirectX 11 support in Ogre SDK 1.8.2)?

I thought that because I see some name mangling in the binary references, but it may be caused by another problem, I don't have much clues...

Did you manage to compile Ogre 1.8.2 with DirectX 11 support? Should I disable it to avoid the problem (Direct3D 9 was compiled and linked fine though)?
Maybe a static build will avoid the problem? In that case, why? And always in that case, how can I use a statically compiled Ogre SDK? Will be everything in a single DLL or I have to compile my final project with particular configurations to "embed" Ogre static libs inside the final executable?

Thank you in advance for any advice you'll give!

Cheers
--
"Fatti non foste a viver come bruti, | ma per seguir virtute e canoscenza."
"You were not made to live your lives as brutes, | but to be followers of virtue and knowledge."
(Divina Commedia, Inferno, Canto XXVI, 119 – 120)
User avatar
edoardo
Kobold
Posts: 36
Joined: Thu Apr 28, 2011 8:44 am
Location: Torino, Italy

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by edoardo »

I disabled Direct3D11 module, but I'm still not able to build Ogre:

Code: Select all

[ 42%] Built target OgreMain
[ 48%] Built target RenderSystem_Direct3D9
[ 61%] Built target RenderSystem_GL
[ 63%] Built target Plugin_OctreeSceneManager
[ 65%] Built target Plugin_BSPSceneManager
Linking CXX shared library ..\..\bin\Plugin_CgProgramManager.dll
d:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lD:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cg.dll
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/Plugin_CgProgramManager.dll] Error 1
mingw32-make[1]: *** [PlugIns/CgProgramManager/CMakeFiles/Plugin_CgProgramManager.dir/all] Error 2
mingw32-make: *** [all] Error 2
Although I know it is very likely a path related problem, I already double checked CMake files and all other files and I can't find where this link instruction come from.

Can anyone please tell me where to change the command (i.e. to put double quotes around it)?
Do you think it is maybe related to another problem?

Thanks again in advance
--
"Fatti non foste a viver come bruti, | ma per seguir virtute e canoscenza."
"You were not made to live your lives as brutes, | but to be followers of virtue and knowledge."
(Divina Commedia, Inferno, Canto XXVI, 119 – 120)
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by dermont »

edoardo wrote:I disabled Direct3D11 module, but I'm still not able to build Ogre:

Code: Select all

[ 42%] Built target OgreMain
[ 48%] Built target RenderSystem_Direct3D9
[ 61%] Built target RenderSystem_GL
[ 63%] Built target Plugin_OctreeSceneManager
[ 65%] Built target Plugin_BSPSceneManager
Linking CXX shared library ..\..\bin\Plugin_CgProgramManager.dll
d:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lD:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cg.dll
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/Plugin_CgProgramManager.dll] Error 1
mingw32-make[1]: *** [PlugIns/CgProgramManager/CMakeFiles/Plugin_CgProgramManager.dir/all] Error 2
mingw32-make: *** [all] Error 2
Although I know it is very likely a path related problem, I already double checked CMake files and all other files and I can't find where this link instruction come from.

Can anyone please tell me where to change the command (i.e. to put double quotes around it)?
Do you think it is maybe related to another problem?

Thanks again in advance
This is weird, the paths and libs for Cg should be picked up from the ogre dependencies i.e. the OGRE_DEPENDENCIES_DIR you set (when configuring the ogre build) via the cmake-gui to point to your ogre dependencies install dir.

To check if your path is quoted you can look in <your_build_dir>\PlugIns\CgProgramManager\CMakeFiles\Plugin_CgProgramManager.dir\link.txt. Don't go changing things there this isn't the answer.

Not sure if it's the fact your linking against a dll is causing your link problems, maybe you could try linking against lib\ cg.lib instead of bin\cg.dll. It would be better just to use the ogre dependencies.
martin_g
Gnoblar
Posts: 4
Joined: Sun Dec 22, 2013 6:15 pm

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by martin_g »

Hello,

I have built the Ogre SDK using your article - twice. It seems that the compilation was successfull, but it didn't produce any DLL files. What I ended up with are the following .a files. Also note, that the release version actually compiled into two different directories - RelWithDebInfo and Release as opposed to the debug version which is completely contained in one directory.

When I try to use this build, I get the problems described in another post - viewtopic.php?f=2&t=79801

What did I do wrong? I'm on Windows 7 64-bit. I compiled boost 1.55, Ogre 1.8.1 and its dependencies from the Cabalistic site as linked to in your article.
If I can provide any more information, please let me know.
In the meantime, I'm using the pre-built SDK and it's working, but I really would like to compile the SDK myself.

Here is the directory listing (only the compiled binaries are listed, I ommitted the headers and resources):

Code: Select all

d:\Programs\ogre3d\build131229\ogre-sdk-full\lib\RelWithDebInfo
libOgreMainStatic.a
libOgrePagingStatic.a
libOgrePropertyStatic.a
libOgreRTShaderSystemStatic.a
libOgreTerrainStatic.a

d:\Programs\ogre3d\build131229\ogre-sdk-full\lib\RelWithDebInfo\opt
libPlugin_BSPSceneManagerStatic.a
libPlugin_CgProgramManagerStatic.a
libPlugin_OctreeSceneManagerStatic.a
libPlugin_OctreeZoneStatic.a
libPlugin_ParticleFXStatic.a
libPlugin_PCZSceneManagerStatic.a
libRenderSystem_Direct3D9Static.a
libRenderSystem_GLStatic.a

d:\Programs\ogre3d\build131229\ogre-sdk-full\lib\RelWithDebInfo\opt\samples
libSample_BezierPatch.a
libSample_BSP.a
libSample_CameraTrack.a
libSample_CelShading.a
libSample_Character.a
libSample_Compositor.a
libSample_CubeMapping.a
libSample_DeferredShading.a
libSample_Dot3Bump.a
libSample_DualQuaternion.a
libSample_DynTex.a
libSample_FacialAnimation.a
libSample_Fresnel.a
libSample_Grass.a
libSample_Instancing.a
libSample_Isosurf.a
libSample_Lighting.a
libSample_NewInstancing.a
libSample_Ocean.a
libSample_ParticleFX.a
libSample_ParticleGS.a
libSample_ShaderSystem.a
libSample_Shadows.a
libSample_SkeletalAnimation.a
libSample_SkyBox.a
libSample_SkyDome.a
libSample_SkyPlane.a
libSample_Smoke.a
libSample_SphereMapping.a
libSample_SSAO.a
libSample_Terrain.a
libSample_TextureArray.a
libSample_TextureFX.a
libSample_Transparency.a
libSample_VolumeTex.a
libSample_Water.a

d:\Programs\ogre3d\build131229\ogre-sdk-full\lib\Release
cg.lib
libFreeImage.a
libfreetype.a
libOIS.dll.a
libzlib.a
libzziplib.a

d:\Programs\ogre3d\build131229\ogre-sdk-full\lib\Debug (holds also opt and samples)
cg.lib
libFreeImage_d.a
libfreetype_d.a
libOgreMainStatic_d.a
libOgrePagingStatic_d.a
libOgrePropertyStatic_d.a
libOgreRTShaderSystemStatic_d.a
libOgreTerrainStatic_d.a
libOIS_d.dll.a
libzlib_d.a
libzziplib_d.a
Thanks a lot,
Martin
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Well, if building Ogre as a dynamic library with MinGW, .a files are import libraries that you need to link against so that your program will automatically load the corresponding .dll when starting (or rather look for it, as it will fail if it can't find the dll).

The .dll files, however, do not reside inside the lib folder, but in the bin folder. Do you have no bin folder where you built your SDK?

But in any case, I really don't know where the compile errors could come from when linking against the import libraries. :(
My site! - Have a look :)
Also on Twitter - extra fluffy
martin_g
Gnoblar
Posts: 4
Joined: Sun Dec 22, 2013 6:15 pm

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by martin_g »

The .dll files are indeed not present - except for OIS.dll and cg.dll - see the attached listing full_list.txt. What should I be looking after or where should I look to identify the problem?

I know that there was no error in the Cmake GUI when I prepared the scripts - except for the following warning:

Code: Select all

CMake Warning (dev) in src/CMakeLists.txt:
  Syntax Warning in cmake code at

    D:/Programs/ogre3d/source/Dependencies/src/CMakeLists.txt:86:18

  A future version of CMake may treat unquoted argument:

    [[

  as an opening long bracket.  Double-quote the argument.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in src/CMakeLists.txt:
  Syntax Warning in cmake code at

    D:/Programs/ogre3d/source/Dependencies/src/CMakeLists.txt:87:99

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.
I consider this negligible. Am I wrong?

I just started compiling again beginning with the dependencies. Althoug they compile and install without any error, they also do not produce any DLLs. See the attached listing deps_build.txt where you can see only .a and dll.a. files, but no .lib or .dll files (except cg and OIS).

Thanks a lot for your time.
You do not have the required permissions to view the files attached to this post.
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by TheSHEEEP »

Well, your last listings show that you did an Ogre static build (hence all library names end with a "static"). That does not produce dynamic libraries, of course, which is the whole point of it.
The dependencies only have cg and OIS as .dll files, all the other libs (zlib, freetype, etc.) are static.

So, basically, everything looks good.
If you want your Ogre libraries to be dynamic, you need to do a dynamic build instead of a static one ;)
My site! - Have a look :)
Also on Twitter - extra fluffy
martin_g
Gnoblar
Posts: 4
Joined: Sun Dec 22, 2013 6:15 pm

Re: [Wiki] Building Ogre with boost 1.50 upwards and MinGW

Post by martin_g »

Thanks a lot for confirming that my latest build is all right.

Now, when I try to build the TutorialApplication against this latest build, I get the following linker errors:

Code: Select all

g++ "-Ld:\\Programs\\boost\\boost_1_55_0\\lib" "-Ld:\\Programs\\ogre3d\\build140107\\ogre-sdk\\lib\\Release" -o ogre_oc_tutorial.exe TutorialApplication.o BaseApplication.o -lboost_system-mgw48-mt-1_55 -lboost_thread-mgw48-mt-1_55 -lOIS -lOgreMainStatic 
d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreRoot.cpp.obj):OgreRoot.cpp:(.text+0x5531): undefined reference to `boost::thread::hardware_concurrency()'
d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreMaterialManager.cpp.obj):OgreMaterialManager.cpp:(.text+0x8ec): undefined reference to `boost::detail::get_tss_data(void const*)'
d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreMaterialManager.cpp.obj):OgreMaterialManager.cpp:(.text+0x929): undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreMaterialManager.cpp.obj):OgreMaterialManager.cpp:(.text+0xd60): undefined reference to `boost::detail::get_tss_data(void const*)'
d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreMaterialManager.cpp.obj):OgreMaterialManager.cpp:(.text+0xd9c): undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
d:/programs/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: d:\Programs\ogre3d\build140107\ogre-sdk\lib\Release/libOgreMainStatic.a(OgreMaterialManager.cpp.obj): bad reloc address 0x2 in section `.text$_ZN5boost6detail15sp_counted_baseD1Ev[__ZN5boost6detail15sp_counted_baseD1Ev]'
As you can see, my boost libraries reside in d:\Programs\boost\boost_1_55_0\lib and I attach a complete listing of the lib directory. The libraries which I try to link are boost_system-mgw48-mt-1_55 and boost_thread-mgw48-mt-1_55. Please note that when I got undefined reference errors to boost::system and I added the library boost_system-mgw48-mt-1_55 to the linker settings, the boost::system reference problem was resolved. Why does it not work when I reference the boost_thread library? Is there possibly a problem that I am using statically built Ogre and dynamic libraries of boost? Or am I possibly using an incompatible boost version (1.55) and will have to downgrade boost?

If I can provide any more information, please let me know.

Again, thank you for your input in advance.
You do not have the required permissions to view the files attached to this post.