Jump to content

Offset with GCC 5


Recommended Posts


I'm the new lead for Torque 2D steering committee. One of the issues for T2D on Github is that it doesn't build on a flavor of Linux call Arch Linux using GCC 5.2.0. Someone recently suggested that the problem is that GCC > 4 is not supported which is true. The problem is shared between our code bases (platform/types.h on T2D and platform/types.gcc.h on T3D). You can look at the issue here:


The change that is suggested will certainly get the code to build but I don't know if it's correct and it might lead to problems later when something is persisted. So my question is, what is the official way Torque will handle GCC 5? Which combination of Offset functions are correct? Thanks!

Link to comment
Share on other sites

Thanks for the encouragement! It's a big job so I can use all the support I can get - even emotional support! Stagnant is not really a strong enough word. At this point the engine doesn't work on the latest version of 3 of our 6 target platforms. There are issues that were found and fixed two years ago but the code never made it into the code base. But I think with a little work that we can get things humming along again. It's going to be pretty exciting once we start doing releases!

Link to comment
Share on other sites

T3D's gotten a lot of work done on it to make it use SDL2 for most of the platform stuffs. It may be worth checking that out and seeing if that'd be more prudent than trying to maintain the platform layers manually.

If all the kinks with the platformSDL stuff get worked out, then conceptually you'd only need to maintain tidbits of gluecode, rather than entire platform layers.

Link to comment
Share on other sites

There were several people talking about doing that with T2D before they all disappeared. Apparently we currently only use it for Linux support and we're using some older, pre-release version. I can't say that it's something we'll do right away, but odds are we will eventually take the plunge. I'll check back here when the time comes, incase some kind soul wants to lend a hand.

Link to comment
Share on other sites

  • 2 weeks later...

I added the following to type.h to support GCC 5. Hopefully this resolves the issues. If somebody with more knowledge on this topic wants to weigh in after the fact we can always change it again. Thanks!


#elif defined(TORQUE_COMPILER_GCC) && (__GNUC__ == 5)
#define Offset(x, cls) offsetof(cls, x)
#define OffsetNonConst(x, cls) _Offset_Normal(x, cls)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...