GameMonkey Script

GameMonkey Script Forums
It is currently Mon Nov 20, 2017 3:23 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Mon Dec 19, 2011 4:02 am 
Offline

Joined: Mon Dec 19, 2011 3:55 am
Posts: 3
I created a xcode project to build the gamemonkey project, but many errors generated, Im try to edit code, but cannot makes it all ok.
So, I give up. Who had build successfully on the XCode?


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 27, 2011 9:07 am 
Offline

Joined: Mon Dec 19, 2011 3:55 am
Posts: 3
Does any body bhild gamemonkey on the xcode successfully?


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 02, 2012 2:32 pm 
Offline

Joined: Tue Jan 31, 2012 7:53 am
Posts: 12
I did. But I think I did a couple of things in order to compile and run gm successfully on Xcode.. I'll try to remember what the steps are and post them here later..

However, I only managed to build for 32-bit architecture, the program crashes on 64-bit. Will try again on 64-bit when I have time.


Last edited by wihu on Mon Feb 06, 2012 12:22 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 06, 2012 12:19 pm 
Offline

Joined: Tue Jan 31, 2012 7:53 am
Posts: 12
Ok, here you go, as some are written in the GameMonkey FAQ:
1) Add all the src\gm *.cpp and *.h files to your project except gmDebugger.
2) Add or create a platform config file such as src\platform\osx\gmConfig_p.h. --> I found this in gmScriptEx source.
3) Add some ready made bindings and helpers from src\binds as you desire.
4) Compile these files with your project, or build and link them as a separate lib.

After this point,
You'll get an error saying that there is no 'gmint',
5) Add to gmConfig_p.h
typedef gmint32 gmint;

6) Add to your header search paths in Build Settings (Assuming you are using Mac OSX 10.6 SDK):
${SDKROOT}/usr/include/c++/4.2.1 ${SDKROOT}/usr/include/c++/4.2.1/i686-apple-darwin10

it will complain about some namespace doesnt exist,
7) Go to Build Settings and search 'compile source as', set to 'C++'.

8) Lastly, you'll need to download flex parser source and compile it for osx platform.
Then add the compiled static library to your project.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 08, 2014 8:44 am 
Offline

Joined: Fri Jun 19, 2009 12:39 pm
Posts: 31
Thread, arise!

I'm currently trying to build under XCode for 64-bit, and I get quite a few errors regarding conversion of types that loose information.

In particular, the parser is a bit problematic as yyvsp is defined type gmCodeTree*, which sometimes casts to an int for the sub-type type. I'm guessing that the parser assumes the same size for pointer types and integers and embeds some enums in the array pointed to by yysvp, which is a pointer to an array of pointers of gmCodeTree instances.

Is this assumption correct? I'm pretty sure that it is, but some verification would be nice (if possible).

My fix is to change the code so that it casts to a 64-bit integer (gmint) in the following way. The old code in one of the problematic lines was;

Code:
yyval = gmCodeTreeNode::Create(CTNT_DECLARATION, CTNDT_VARIABLE, gmlineno, (int) yyvsp[-2]);


Th new version is:

Code:
yyval = gmCodeTreeNode::Create(CTNT_DECLARATION, CTNDT_VARIABLE, gmlineno, (gmint) yyvsp[-2]);


Any comments on this? I'm currently doing this in the generated source file, but I'll move these changes to the .y file once I've tested them. Once I have a working 32- and 64-bit mac build, I'll zip it up and pass it on to you guys if you want to have it integrated into the main branch.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 09, 2014 11:24 pm 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 698
That change looks safe to me BinaryDad. I guess that compiler doesn't like to auto cast from enum to int.
I build 64bit on Intel and I see my gmInt is 32bit. If your gmInt is 64bit, you may just want to cast to 'int' instead of 'gmInt' if it compiles for you.


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 03, 2015 2:46 pm 
Offline

Joined: Fri Jun 19, 2009 12:39 pm
Posts: 31
Oops! Has it really been that long since I looked into this?

I tried getting GM to run on Mac OSX 64-bit again and it looks as if I've been successful. I need to run a few tests, but at least now I can get script compiling now, where as it used to just die. I'm going to run some basic script code tests when I have the time this evening, and make sure that the 64-bit changes haven't screwed up the code gen.

Changes that I've made :-

  • Added a Mac OSX gmConfig_p.h so that gmptr and gmuptr were defined properly along with some other things
  • Changed a load of LLVM compile errors when casting from a pointer to an unsigned int in gmParser.y
  • Swapped out _gmAlignMem macro for an inline function in gmMem.h - this seems to be the cause of crashes that others have experienced during parsing - for some reason CLANG/LLVM hates it and just generates a garbage address outside of the memory chunk that's being used. I'll re-do this a little to switch between the two on a define in gmConfig_p.h
  • Fixed a load of CLANG/LLVM c++11 stuff - all to do with the concatenating literal strings with GM_NL (c++11 spec requires a space).
  • There's a compile error in gmScanner.cpp with yy_flex_realloc not returning anything. Now, you CAN turn this error off but I'd rather have meaningful errors like that turned on. I tried changing gmScanner.l by modifying flex.skl but flex throws a panic about there being a bad-line in there. Maybe the flex bundled with OS X is out of date.

I think that covers it. I need to detect 32- and 64-bit builds so that gmuptr and gmptr are defined accordingly, but that's the bulk of the changes. Only took a couple of hours and most of that was spent wrangling xcconfig files.

P.s. I did a bit of an experiment a while ago with having "direct call" native functions/methods. That meant that arguments from script code were pushed onto the CPU stack by the gmThread and the function/method called directly so there was no having to query the thread stack to see what vars are were there, and what type they happened to have. It has an inherent stability issue though - there was no way to check what had been pushed, matched the function signature - but I had an idea to fix that.

At some point, I'd like to see the direct call stuff as part of GM, but it requires work and testing across a variety of ABI's before it's useable. Maybe we can use the FastDelegate stuff for this to make it platform agnostic. I dunno. Need discussion.


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 04, 2015 3:35 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 698
Welcome back BinaryDad. Glad to hear you're having some success.
Thanks for describing your changes to get Mac OSX working. Try to share some of your code changes when you can.


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 04, 2015 10:09 am 
Offline

Joined: Fri Jun 19, 2009 12:39 pm
Posts: 31
I'll share my changes ASAP. The only question I have is, what is the preferred method? Shall I send you a zip with the changes, or do you want me to branch the github repo and submit changes there?


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 06, 2015 8:28 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 698
I'm a GitHub noob. I'm not sure what the best or easiest thing is to do.
I'm guessing that your code has diverged a lot from mine, so branching from my repo may take more effort.
Perhaps start by attaching a .zip to the forum. If I have time, I will add configs and integrate changes that are compatible with my build. No promises though. At least your code will be here help anyone else.
Do what ever is easiest for you.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 06, 2015 1:24 pm 
Offline

Joined: Fri Jun 19, 2009 12:39 pm
Posts: 31
The version of GM was from a virgin 2.29.4 installation, so the code isn't SO different. Once I'm happy that I haven't broken anything, I'll zip it up and attach it.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group