Unable to compile the engine with GCC 4.7

Get help with installing and running the Cafu Engine here. This forum is also for general questions and discussion of all aspects regarding the Cafu Engine.
Post Reply
joe
Posts: 5
Joined: 2011-11-24, 12:48

Unable to compile the engine with GCC 4.7

Post by joe » 2012-04-11, 17:23

Hey,

I'm running Arch Linux. This is a rolling release distribution and so I'm running the latest GCC (v 4.7).

Unfortunately Cafu fails to compile now. The problem seems to be related to wxwidgets. If I replace wxwidgets with the latest version of it, it compiles, but afterwards Cafu fails again to build, because of compatibility issues.

I found this link and this seems to explain a solution to this problem: https://groups.google.com/forum/#!msg/w ... Fib2BZWP8J

If it would be awesome, if you could fix this asap.

Thanks alot,

Joe (teammember of Haimis staff ;) )

PS: We created a ticket: http://trac.cafu.de/ticket/114
User avatar
Carsten
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Unable to compile the engine with GCC 4.7

Post by Carsten » 2012-04-11, 19:59

Ah, only now I'm seeing your post, after having replied to your ticket already.
I'll look into it later today.
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Unable to compile the engine with GCC 4.7

Post by Carsten » 2012-04-11, 20:49

Ok, I just commited a fix, please see #114 for details.
:up:
Best regards,
Carsten
joe
Posts: 5
Joined: 2011-11-24, 12:48

Re: Unable to compile the engine with GCC 4.7

Post by joe » 2012-04-12, 12:41

Thanks for the quick fix! It has solved the described problem above.

Unfortunately another issue has occured in the MainCanvas.cpp now:

Code: Select all

g++ -o build/linux2/g++/x86_64/release/Common/WorldMan.o -c -O3 -funsigned-char -Wall -Werror -Wno-char-subscripts -fno-strict-aliasing -pthread -DNDEBUG -DSCONS_BUILD_DIR=build/linux2/g++/x86_64/release -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -ILibs -IExtLibs -IExtLibs/wxWidgets/build-gtk/lib/wx/include/gtk2-unicode-static-2.9 -IExtLibs/wxWidgets/include -Ibuild/linux2/g++/x86_64/release/ExtLibs/lua/src -IExtLibs/lua/src Common/WorldMan.cpp
Ca3DE/Server/Server.cpp: In destructor 'ServerT::~ServerT()':
Ca3DE/Server/Server.cpp:180:29: error: 'close' was not declared in this scope
scons: *** [build/linux2/g++/x86_64/release/Ca3DE/Server/Server.o] Error 1
Ca3DE/MainCanvas.cpp: In destructor 'virtual MainCanvasT::~MainCanvasT()':
Ca3DE/MainCanvas.cpp:149:16: error: deleting object of polymorphic class type 'SvGuiCallbT' which has non-virtual destructor might cause undefined behaviour [-Werror=delete-non-virtual-dtor]
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/g++/x86_64/release/Ca3DE/MainCanvas.o] Error 1
scons: building terminated because of errors.
To be honest: I have no glue what this is supposed to mean... Have you any ideas, what might be causing the problem and how to fix this?

Still running Arch Linux 64bit ;).

Joe
User avatar
Carsten
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Unable to compile the engine with GCC 4.7

Post by Carsten » 2012-04-12, 15:19

Does the solution proposed at http://trac.cafu.de/ticket/115 work for you?

And regarding the error about close(), can you fix this yourself?
(This isn't vanilla Cafu code, is it?)
Best regards,
Carsten
tuldok89
Posts: 4
Joined: 2012-04-13, 17:28
Location: Manila, PH

Re: Unable to compile the engine with GCC 4.7

Post by tuldok89 » 2012-04-13, 17:45

Hi there,

I've encountered the same issue as the thread starter, and we are of the same distro, compiler and architecture (Arch Linux x86_64, GCC 4.7). The solution in http://trac.cafu.de/ticket/115 works. As with the thread starter is concerned, I've also encountered those "not declared" errors. I've managed to silence the errors by including unistd.h, though I'm not sure if that's the proper fix.

The compilation went smoothly after that. Btw, I'm compiling the vanilla source.
joe
Posts: 5
Joined: 2011-11-24, 12:48

Re: Unable to compile the engine with GCC 4.7

Post by joe » 2012-04-13, 18:36

Yes, the Ticket works. Thanks for that.

You are right, the error with close() is our fault, we'll look into that. The funny thing is, that Haimi is able to compile the code without facing the above error message. But I guess this might be again related to my system (GCC v4.7)...

I have installed GCC 4.4 parallelly now and I'm going to test, whether this might help.

Thanks again for your help!
User avatar
Carsten
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Unable to compile the engine with GCC 4.7

Post by Carsten » 2012-04-13, 22:19

Thanks to you both. I've applied the patch in #115 and closed the ticket.

Regarding #115 / the dtor, with each new major release, GCC tends to provide more thorough warnings, which is usually a good thing.

Regarding close(), it may be possible that the error is a result of their cleaning up the header files as well; similar changes have happened in the past. If so, we'd need to include the proper header, but as I have no access to GCC 4.7 at this time, I really cannot tell anything specific about it.

It's perfectly possible that including unistd.h is in fact the proper solution. If so, could you please post or submit a patch?
Best regards,
Carsten
tuldok89
Posts: 4
Joined: 2012-04-13, 17:28
Location: Manila, PH

Re: Unable to compile the engine with GCC 4.7

Post by tuldok89 » 2012-04-13, 23:38

ok then. here's my patch :wink:
Attachments
patch.diff
(1.91 KiB) Downloaded 169 times
User avatar
Carsten
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Unable to compile the engine with GCC 4.7

Post by Carsten » 2012-04-14, 10:43

tuldok89 wrote:ok then. here's my patch :wink:
Thanks, but why didn't you put the changes into Network/Network.hpp?
And why include io.h under Windows?
Best regards,
Carsten
tuldok89
Posts: 4
Joined: 2012-04-13, 17:28
Location: Manila, PH

Re: Unable to compile the engine with GCC 4.7

Post by tuldok89 » 2012-04-15, 11:03

I should put it in the network.hpp then. About io.h, it's the nearest win32 equivalent of unistd.h (for the close(), unlink(), etc.). If it's uneeded for windows targets, then I should just include unistd.h for linux systems.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests