Page 1 of 1

[SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Tue Feb 23, 2010 12:15 pm
by TdZBdaO
Hi there,

while trying to compile Ogre 1.7 with the latest MinGW Dependencies-Package (2010-02-16) i'm encountering the following error while linking the dynamic library:

Code: Select all

Linking CXX shared library ..\bin\libOgreMain.dll
Creating library file: ..\lib\libOgreMain.dll.a
h:/devel/cpp/bin/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: <unknown-file>:0: syntax error
Warning: .drectve `-export:T.1536 ' unrecognized
h:/devel/cpp/bin/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: <unknown-file>:0: syntax error
Warning: .drectve `-export:T.1541 ' unrecognized
..\..\Dependencies\lib\release\libFreeImage.a(libraw_cxx.o):libraw_cxx.cpp:(.text+0x27c7): undefined reference to `htons@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x346): undefined reference to `ntohs@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x440): undefined reference to `ntohs@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0xd81a): undefined reference to `htonl@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0xdbb1): undefined reference to `ntohs@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0xdc7b): undefined reference to `ntohs@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x26090): undefined reference to `htonl@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x2731b): undefined reference to `htonl@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x275e0): undefined reference to `ntohl@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x27f70): undefined reference to `htons@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x28234): undefined reference to `ntohl@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_common.o):dcraw_common.cpp:(.text+0x28594): undefined reference to `htons@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_fileio.o):dcraw_fileio.cpp:(.text+0x818): undefined reference to `ntohs@4'
..\..\Dependencies\lib\release\libFreeImage.a(dcraw_fileio.o):dcraw_fileio.cpp:(.text+0x8bc): undefined reference to `ntohs@4'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/libOgreMain.dll] Error 1
mingw32-make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
mingw32-make: *** [all] Error 2
I believe that the reason for the undefined references in libFreeImage might be solved by linking to WinSock (wsock32 i guess?!). What really
puzzles me is the "<unknown-file>:0: syntax error" right at the beginning of the error messages.

Anyone got more information about that? I'm racking my brains but I'm really not making any progress here...

EDIT: I forgot to state some related specs: I'm running GCC 4.4.1 (TDM-2) on Windows 7.

Re: Problems building Ogre 1.7 on MinGW

Posted: Tue Feb 23, 2010 2:24 pm
by TdZBdaO
Mhhh.. anyone?

Re: Problems building Ogre 1.7 on MinGW

Posted: Tue Feb 23, 2010 3:10 pm
by CABAListic
Please don't bump a thread after merely 2 hours. We are not around 24/7, you know ;)

The <unknown file> error can be safely ignored, I get that, too. I believe this is an error in CMake, but it does no harm. As for the other errors: Yes, OgreMain must link to the winsock libraries, however CMake should already do this, so the error is odd. Are you using the 1.7RC1 source release from the downloads, or are you using the svn repository? The former is not compatible with MinGW, we have had a series of MinGW-related changes after its release, so you really have to get Ogre from svn.

Re: Problems building Ogre 1.7 on MinGW

Posted: Tue Feb 23, 2010 4:42 pm
by TdZBdaO
Oh yeah, I'm sorry about that, I guess i just forgot my manners :-)

About your suggestion: Yes, I was indeed using RC1 - I didn't see any information about MinGW changes anywhere... I think it'll be a good think to put things like that into a sticky post. But however, I'm currently updating my subversion copy; hopefully it'll compile fine then.

Re: Problems building Ogre 1.7 on MinGW

Posted: Tue Feb 23, 2010 5:13 pm
by CABAListic
Just keep in mind that the Ogre project hasn't had a MinGW maintainer for some while. I have picked up the role for now, but I'm not doing any regular MinGW builds currently. Long story short, using MinGW you will probably encounter more problems than using Visual Studio, so be prepared ;)
If you do face problems though, report them and I'll try to fix them. For the moment, do not attempt a static Ogre build, because that only works halfway with MinGW right now.

Re: Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 12:12 am
by TdZBdaO
I personally don't see any reason to complain, I'm using Ogre on GCC (both Linux and Windows) since 1.2 and things such as CMake made the compiling much less work-intensive. Actually I was not blaming the work on MinGW maintenance in general, I was just suggesting that important information like the incompatibility between RC1 and the current Dependency package (which is marked to be used with 1.7 in general, not only svn) should be pointed out more clearly somewhere in the forums or wiki pages. Also this could help reducing the amount of duplicate "Help me with build error xyz"-Threads (such as mine, I realize :D ) If my memory serves me right there's been a faq section with most common build problems on the main page quite a while ago... Maybe it'd be a good thing to put that back again.

But to get back to topic... I solved the problems by using the SVN version, just as you suggested... Thanks very much, CABAListic :)

Re: Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 12:34 am
by jacmoe
TdZBdaO wrote:I personally don't see any reason to complain, I'm using Ogre on GCC (both Linux and Windows) since 1.2 and things such as CMake made the compiling much less work-intensive.
What I don't understand is this:
Why? :)
Why not take advantage of GCC on *nix and VC on Windows?
If you're against VC for political reasons, then you shouldn't be using Windows at all.
CMake makes it so easy to use the best development tools on whatever platform you're on.
MinGW is just a hack to make GCC think it's on Linux when it isn't..

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 12:36 am
by CABAListic
No, that's cygwin I think :)

Anyway, the MinGW dependency package is perfectly fine for use with 1.7RC1 in theory, it's just that 1.7RC1 is broken on MinGW. Nothing to do with the dependencies.

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 10:54 am
by TdZBdaO
There's not always a political reason behind a preference. I personally like MinGW over VC for quite some reasons. I also like *nix and use whenever I can, but for what I'm doing most of the time, Windows is intended for being the better choice for me. You see, less political, more personal :)

Oh, and yeah, I think you're talking about cygwin, too.

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 11:15 am
by CABAListic
Actually, there is one good reason for MinGW over Visual Studio: It compiles Ogre in about half the time :)
On my quadcore, MinGW 'make -j5' takes about 3min 50s, Visual Studio with the flag /MP requires over 7min. (GCC on Linux takes even less time, but it has one rendersystem less to compile.)

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 11:17 am
by TdZBdaO
Woot! Really!? I always thought VC would be way faster!

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 11:21 am
by CABAListic
Nope, at least not for debug builds, I didn't time a release build.
Actually, there are even more reasons:
- MinGW applications are waaay easier to redistribute. At the maximum you needed to ship mingwm10.dll with your app, I'm not even sure if that is still required.
- You can cross-compile with MinGW from a Unix OS.

On the downside, you'll have trouble with the DirectX SDK. Some hacks are required to get recent versions working with MinGW; they are included in Ogre now, so all three DirectX rendersystems compile, but only the DX9 one seems to work correctly.

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Posted: Wed Feb 24, 2010 2:51 pm
by jacmoe
Interesting.
They must be cheating. :)