gcc 4.6.x and gcc 4.7.x

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

gcc 4.6.x and gcc 4.7.x

Post by AReichl »

I was deeply disturbed by the break in compatibility from gcc 4.6.x to 4.7.0. Since then i was searching for a solution, but i only found "bits and pieces" flying around here and there.

Finally i got the "Tech Demo" that comes with Irrlicht running with Irrklang.
I used gcc 4.7.2 (i cannot speak for 4.7.0 or 4.7.1 - avoid them if you can).

I added the compile options

-mabi=sysv
-mno-ms-bitfields

to Irrlicht itself (!) and to the Tech Demo and it worked.
Of course you can use a precompiled Irrlicht that was created with an older gcc and only apply the options to your project.

I don't say it's the solution for everything. If you use C++11 it may be more complicated again. Maybe you need more compile or linker options.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: gcc 4.6.x and gcc 4.7.x

Post by CuteAlien »

Which Irrlicht version? We changed some stuff in Irrlicht 1.8 to get it working with gcc 4.7 on MinGW, so at least there -mno-ms-bitfields should no longer be needed. Don't know about irrKlang.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: gcc 4.6.x and gcc 4.7.x

Post by AReichl »

NEWEST version of course!

You probably mean the changes in "irrpack.h".
Right.
I am not sure but maybe these changes

#if (__GNUC__ >= 4 ) && (__GNUC_MINOR__ >= 7)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#else
# define PACK_STRUCT __attribute__((packed))
#endif

are not the same as compiling with '-mno-ms-bitfields'.

Anyway: when i leave away either '-mabi=sysv' or '-mno-ms-bitfields' the application either crashes immediately or after i pressed "Start Demo".

!!! Maybe there is a misunderstanding here: !!!
--------------------------------------------------------
The problem has NOTHING to do with Irrlicht but with Irrklang (or any other library created with a gcc-version prior to 4.7.0)!

WITHOUT Irrklang there are no problems; WITH Irrklang there are crashes (the program will link, but not run).

Niko was asked to also compile a version for gcc 4.7.x, but where does this end?
Specially because 4.7.0 and 4.7.1 behave differently than 4.7.2; 4.7.1 and 4.7.2 do not even work WITH the above parameters.
In theory 4.7.2 should be compatible with 4.6.x again (i mean old library linking), but in practice you still have to apply these parameters ( or more ) because they changed the DEFAULT behaviour ( e.g. the ms-bitfields and something with the calling convention ).
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: gcc 4.6.x and gcc 4.7.x

Post by CuteAlien »

Ok, I don't know anything about irrKlang. And yeah - that was a very unfortunate change in gcc. I guess it changed more than they had expected. I did not know they have already changed again stuff in later versions - still have to check those out.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: gcc 4.6.x and gcc 4.7.x

Post by AReichl »

So far so good, but now i have a problem with linking other libraries ( e.g. SPARK or some Physics wrapper(s) ).

The best solution i found so far is to compile every library with gcc 4.6.x ( i use 4.6.3 from 'Equation Solution' ),
then switch to a newer one ( i use 4.7.2 from 'Equation Solution' ), write your Program and compile/link with the
above parameters. Up to now it also works with C++11 ( that's the reason why i want to work with the latest
gcc compiler ).

I am sorry if i bored you with this nasty details, but i have everything set up for gcc/mingw and i did't want to
"recreate" everything with Visual Studio.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: gcc 4.6.x and gcc 4.7.x

Post by CuteAlien »

Not boring at all getting more info about this. You might have seen the thread were we had to fight with this as well: http://irrlicht.sourceforge.net/forum/v ... 1&p=269398
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: gcc 4.6.x and gcc 4.7.x

Post by Cube_ »

Wait irrlicht is incompatible with gcc 4.7.x? (But it worked for me, 0 errors 2 warnings (linux - accurate math - shared object) *confused*)
"this is not the bottleneck you are looking for"
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: gcc 4.6.x and gcc 4.7.x

Post by AReichl »

Yes - i have followed that.

But the problem there was, that Irrlicht ITSELF would not run with gcc 4.7.x.
That is fixed.

THIS problem is about linking old(er) libraries compiled with gcc < 4.7.x.
It's related but not the same.

I still don't understand why they changed such fundamental things. They say
it's because getting closer to Microsoft, but still you cannot link a gcc-lib
to a MS-program or even debug it - so what's the deal?
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: gcc 4.6.x and gcc 4.7.x

Post by AReichl »

Nooooo - it's NOT incompatible! It works PERFECTLY.
The problem(s) come, when you link an older library, for example Irrklang.
Irrklang is created with a gcc compiler BEFORE gcc 4.7.x. You can link it,
but it will not run (crash). Try it with the Demo coming with Irrlicht.

AND please consider, that it's probably only a Windows problem - i don't
know if it also occurs on Linux.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: gcc 4.6.x and gcc 4.7.x

Post by Cube_ »

Hurr... that could be it (Though I also noticed that I have gcc 4.4 and every version after up to 4.7.2) I never used IrrKlang. (I use SFML for sound and networking and GTK+/Irrlicht for GUI)
"this is not the bottleneck you are looking for"
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Re: gcc 4.6.x and gcc 4.7.x

Post by Dareltibus »

aaammmsterdddam wrote:Wait irrlicht is incompatible with gcc 4.7.x? (But it worked for me, 0 errors 2 warnings (linux - accurate math - shared object) *confused*)

enable

Code: Select all

 
-std=c++11
 
compiler flag
Post Reply