[SOLVED] Problems building Ogre 1.7 on MinGW

Problems building or running the engine, queries about how to use features etc.
Post Reply
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

[SOLVED] Problems building Ogre 1.7 on MinGW

Post 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.
Last edited by TdZBdaO on Wed Feb 24, 2010 12:13 am, edited 1 time in total.
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Re: Problems building Ogre 1.7 on MinGW

Post by TdZBdaO »

Mhhh.. anyone?
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: Problems building Ogre 1.7 on MinGW

Post 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.
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Re: Problems building Ogre 1.7 on MinGW

Post 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.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: Problems building Ogre 1.7 on MinGW

Post 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.
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Re: Problems building Ogre 1.7 on MinGW

Post 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 :)
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Problems building Ogre 1.7 on MinGW

Post 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..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post 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.
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post 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.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post 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.)
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post by TdZBdaO »

Woot! Really!? I always thought VC would be way faster!
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post 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.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: [SOLVED] Problems building Ogre 1.7 on MinGW

Post by jacmoe »

Interesting.
They must be cheating. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply