jorgeas80
Junior Member
Posts: 21
Threads: 7
Joined: Jan 2014
Reputation:
0
|
Error caused by a version of a function that shouldn't be compiled
Hello,
I'm trying to compile Penumbra: Overture in my Mac running Mountain Lion. As I've had some problems with the xcode project in the repo, I'm trying to compile using make. I've successfully compiled OALWrapper, but still getting an error compiling H1Engine. This error (when executing 'make', after a successful 'cmake .'):
angelscript.h:784:10: error: no viable conversion from 'int' to 'asUPtr'
return 0;
^
The relevant portion of angelscript.h containing that line is:
#ifndef AS_NO_CLASS_METHODS
// Method pointers
// Declare a dummy class so that we can determine the size of a simple method pointer
class asCSimpleDummy {};
typedef void (asCSimpleDummy::*asSIMPLEMETHOD_t)();
const int SINGLE_PTR_SIZE = sizeof(asSIMPLEMETHOD_t);
// Define template
template <int N>
struct asSMethodPtr
{
template<class M>
static asUPtr Convert(M Mthd)
{
// This version of the function should never be executed, nor compiled,
// as it would mean that the size of the method pointer cannot be determined.
// int ERROR_UnsupportedMethodPtr[-1];
return 0; ---> THIS IS THE LINE CAUSING THE ERROR
}
};
// ... more code here
So, looks like that code shouldn't be compiled, but is because AS_NO_CLASS_METHODS is not defined. I understand the error, but not the cause.
Any clues?
Many thanks in advance
|
|
01-13-2014, 12:56 PM |
|
Urkle
FG - Associate
Posts: 1,172
Threads: 31
Joined: Jul 2006
Reputation:
21
|
RE: Error caused by a version of a function that shouldn't be compiled
Try switching to GCC to compile instead of clang, also make sure you are compiling 32bit and not 64bit.. The older version of angelscript didn't support 64bit at that time (nor did newton), and most likely doesn't support clang.. Clang has a bad habbit of compiling ALL template code even if it isn't reference / used.
another alternative would be to simply cast the 0.. asUPtr(0) that may allow it to work.
Developing away on one of
Multiple Macs running 10.6, 10.7, 10.8, and 10.9.
Linux, 8-core AMD, 8GB RAM, Fedora 18, nVidia 450 1GB
|
|
01-13-2014, 03:06 PM |
|
jorgeas80
Junior Member
Posts: 21
Threads: 7
Joined: Jan 2014
Reputation:
0
|
RE: Error caused by a version of a function that shouldn't be compiled
Thanks for the response, Urkle.
I actually compiled everything in Ubuntu 12.04. I used gcc 4.5 instead of gcc 4.6 (default in Ubuntu, lots of errors) and cmake 2.8.12 instead of cmake 2.8.7 (default in Ubuntu 12.04, didn't recognize a directive used in CMakeList.txt). I'd need to compile it under Mac and Windows too, but I'll left the Windows part for the end. I'm a Mac and Linux developer.
The problem in Mac, I think, is with the gcc provided by Apple. Which compiler do you use in Mac? Is there any chance to use the official gcc instead of the wrapped by Apple? (I guess that MacPorts, Fink, Homebrew or even manual compiling the sources would work)
Many thanks
|
|
01-14-2014, 01:23 PM |
|
Urkle
FG - Associate
Posts: 1,172
Threads: 31
Joined: Jul 2006
Reputation:
21
|
RE: Error caused by a version of a function that shouldn't be compiled
So, later Xcode releases from apple no longer include GCC as a compilation option.. Thus you need to fix the function as clang has "issues" and compiles template variations that are never used. the fix is to do something like this in angelscript.h
asUPtr dummy;
return dummy;
instead of the return 0;
now you'll find other *fun* after you fix that one Recall this game was originally compiled on VC++2003, GCC 4.0 (mac) and GCC 4.2(linux)
The *next* bit I ran into (Clang 5.0, SDK 10.9) was a "cannot take address of temporary). the fix I employed was to add this to the iLowLevelGraphics interface.. (LowLevelGraphics.h)
void AddVertexToBatch(const cVertex& apVtx) { AddVertexToBatch(&apVtx); }
and change the code in cRender2D from
mpLowLevelGraphics->AddVertexToBatch(&cVertex(vPointPos[0],ShadowColor));
mpLowLevelGraphics->AddVertexToBatch(&cVertex(vPointPos[1],ShadowColor));
to
mpLowLevelGraphics->AddVertexToBatch(cVertex(vPointPos[0],ShadowColor));
mpLowLevelGraphics->AddVertexToBatch(cVertex(vPointPos[1],ShadowColor));
100% compile now.
Developing away on one of
Multiple Macs running 10.6, 10.7, 10.8, and 10.9.
Linux, 8-core AMD, 8GB RAM, Fedora 18, nVidia 450 1GB
(This post was last modified: 01-27-2014, 04:18 PM by Urkle.)
|
|
01-27-2014, 04:13 PM |
|
jorgeas80
Junior Member
Posts: 21
Threads: 7
Joined: Jan 2014
Reputation:
0
|
RE: Error caused by a version of a function that shouldn't be compiled
Thanks for your response Urkle. Updated status:
As HPL1Engine and Penumbra's last commits are from 2010, I've downloaded the last OALWrapper version from 2010. By doing that, I can now compile, run and debug Penumbra in Windows 7 with Visual Studio 2010 (also thanks to JKO for his/her great guide).
I also can compile it in Linux, with Ubuntu 12.04 and GCC 4.5.0 + cmake 2.8.12. Be careful, because Ubuntu 12.04 comes along with GCC 4.6.0 and cmake 2.8.7. It won't compile with those versions. You need to get the right ones. GCC 4.5 can be installed with apt-get, and default version changed from 4.6.0 to 4.5.0 via update-alternatives. About cmake 2.8.12, I had to compile it manually. Not a big deal. I had some other minor problems with dependencies too. Check this issue in my fork from HPL1Engine
Regarding Mac, I installed XCode 3.6.2, and it caused a kernel (and personal) panic. It's a known problem with Lion and Mountain Lion (my version), and it can be solved, but I don't recommend to install XCode 3.x. I will try with XCode 5, taking into account the changes suggested by Urkle, and using the "frozen" 2010 version of OALWrapper.
|
|
01-29-2014, 11:02 AM |
|
Urkle
FG - Associate
Posts: 1,172
Threads: 31
Joined: Jul 2006
Reputation:
21
|
RE: Error caused by a version of a function that shouldn't be compiled
I'll be pushing changes to the engine here later (and switching mac to full CMake most likely) over the weekend as I an working on the Penumbra series for other work and need to have it cleanly compiling and running out of a newer Xcode.
Developing away on one of
Multiple Macs running 10.6, 10.7, 10.8, and 10.9.
Linux, 8-core AMD, 8GB RAM, Fedora 18, nVidia 450 1GB
|
|
01-29-2014, 02:57 PM |
|
|