Author Topic: Compilation Error on OS X  (Read 5454 times)

Bruce

  • Guest
Compilation Error on OS X
« on: 22 February 2010, 05:17:30 »
in platform_util.ccp:

int isdir(const char *path)
{
   struct stat stats;

   return stat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
}

I get the following error when compiling on OS X in XCode:

Aggregate 'stat stats' has incomplete type and cannot be defined

Any ideas? If I can solve this I should have a 3.2.2 build for OS X completed within 24 hours.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Compilation Error on OS X
« Reply #1 on: 22 February 2010, 05:23:10 »
If not already make sure you have the right include file:

#include <sys/stat.h>

Otherwise maybe rename all instances of stats to statuses or something like that.

Thanks

Bruce

  • Guest
Re: Compilation Error on OS X
« Reply #2 on: 22 February 2010, 10:25:28 »
Ok - so it compiles and I THINK its 3.2.2 but I've got this issue with text strings where only the first character seems to be appearing and the character set is playing up a bit. I'm hoping someone has seen something similar to this before:

http://www.anuvc.org.au/Glest%20Bug%20-%20iPhone.m4v

If anyone has ANY ideas I'd love a shout out - I checked through the font and text rendering files but nothing looks any different from the 3.2.1 source. I'm guessing this probably has something to do with a hangover of some code for Japanese Characters that KaSek was using in the 3.2.1 port, but don't know the source code well enough to identify where to look next.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,227
    • View Profile
    • http://www.titusgames.de
Re: Compilation Error on OS X
« Reply #3 on: 22 February 2010, 13:00:09 »
I think its a font coding problem (utf8)! Maybe its a problem with the wxwidget configuration.
And yes by this it must have something to do with kaseks japanese characters which need utf8.

If you get this to work, maybe you also want to take have a look at megaglest here: https://forum.megaglest.org/index.php?topic=4930.0
The megaglest 3.2.4 version which will be released soon and will fix more errors in the multiplayer code.

« Last Edit: 22 February 2010, 13:06:33 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Bruce

  • Guest
Re: Compilation Error on OS X
« Reply #4 on: 23 February 2010, 01:36:59 »
Which source files could this be in? I've scanned the code and have no idea what the issue is. Where in the code is the main menu rendered? If I can at least identify some point where some of the text I know is being generated by the program, I should then be able to backtrace to work out what the offending function is.

I've already compiled/built an application based on MegaGlest as well, but have exactly the same issue - I really want to work out what's causing it!

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Compilation Error on OS X
« Reply #5 on: 23 February 2010, 04:29:04 »
Unfortunately I'll be away for a bit on a trip, but maybe if you could package up your Mac project one of us could try to compile your source code under linux or windows (give us the wxLibrary version etc.. that you are using). Then we could see if we can reproduce the issue and determine the fix.

I'll be taking my laptop with me so I "might" have access to the internet.

Just a thought.

P.S. Perhaps all you need to do is use a "normal" wxWidgets libray to compile the project without the Multi-byte support that seems to be messing up your text? To compile mega-glest for windows I just took the latest wxWidgets (and other libraries) from their respective sources on the net and compiled them into the projects that required them.

Thanks
« Last Edit: 23 February 2010, 04:31:22 by softcoder »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Compilation Error on OS X
« Reply #6 on: 23 February 2010, 07:16:54 »
Which source files could this be in? I've scanned the code and have no idea what the issue is. Where in the code is the main menu rendered? If I can at least identify some point where some of the text I know is being generated by the program, I should then be able to backtrace to work out what the offending function is.

Hi Bruce, I assume you have merged the 3.2.2 sources with Kasek's port? Using his XCode project files? I have no idea how XCode works, but it may be that it is set up to run with an ini file that is setting the language to Japanese... have you tried running the executable you built from an installation you know to be working correctly (ie, with a latin alphabet)?

I just had a look at kasek's source package, he left all the .svn folders there, which is actually very convenient for us (saves us the trouble of diffing it ourselves).  The changes he made to support Japanese text all appear to be in the shared library, specifically,

shared_lib/include/graphics/font.h
shared_lib/include/graphics/font_manager.h
shared_lib/sources/graphics/font.cpp
shared_lib/sources/graphics/font_manager.cpp
shared_lib/sources/gl/text_renderer.cpp

If it doesn't appear to be a problem with the way XCode is set up, I'd recommend going through those files and stripping out all the stuff related to rendering Japanese characters.

Good luck :)

Cheers.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Bruce

  • Guest
Re: Compilation Error on OS X
« Reply #7 on: 23 February 2010, 08:05:50 »
Right... some progress made...

So there's nothing strange about the way XCode was set up - turns out it definitely had something to do with the shared library.

The way I approached this initially was to merge the 3.2.2 sources with the XCode project - but I was merging both the glest_game and the shared_lib components of the source and this is what seemed to be causing the problem. Once silnarm pointed out which files had been edited, I actually did the reverse - rather than replacing the shared libraries in the 3.2.1 project, I left the 3.2.1 shared libraries behind and ONLY replaced the glest_game source codes with the 3.2.2 source. I then went through and stripped Japanese references from the shared lib (which I had been doing anyway - that didn't seem to create the problem as such) and it works. Now all of the text is appearing in English and is perfectly legible, and it has compiled using the 3.2.2 source in the glest_game folder.

Now, I'm not that familiar with the ins and outs of the glest code so I'm not sure if doing what I've done has actually created a pseudo 3.2.2 version of glest rather than a true 3.2.2 version, but at the very least it has incorporated all of the 3.2.2 source from glest_game folder in the linux source. The game displays version 3.2.2 everywhere and this is a good thing.

The only problem left now is that the text doesn't display perfectly in the menus (in game is fine). The text on the menus appears to be slightly big and doesn't "centre" on the buttons - it sits a little to the right (like the centre is offset a bit) and because the font size is slightly larger it doesn't always fit in the button/space reserved for it. I can live with this minor annoyance, though, if it means that the fixes in 3.2.2 (particularly related to network play) have been incorporated.

The biggest difficulty I'm having is that, like you guys, I'm not a native OS X developer - all of my development has been on *nix systems so I'm learning XCode as I go. It actually seems to be pretty straight forward itself, but it's the little things like this (combined with my unfamiliarity of the glest source) that trip me up. If only it was possible to meet up with a group of devs with an OS X background and get a crash course in the source - I'm happy to develop Mac Application Bundles whenever they're required, they just won't be as clean as they need to be without solving these problems.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,227
    • View Profile
    • http://www.titusgames.de
Re: Compilation Error on OS X
« Reply #8 on: 23 February 2010, 11:05:08 »
for the big fonts:
in glest.ini you can set the used font. Maybe your current choice ( or the system default ) is not so good.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Bruce

  • Guest
Re: Compilation Error on OS X
« Reply #9 on: 23 February 2010, 11:13:15 »
Using the same font I was using on Glest 3.2.1, so don't see what could have changed. In fact, I've got all 3 compiled versions (3.2.1, 3.2.2 and Megaglest 3.2.3) all using the same data library, and although the font looks fine on 3.2.1 its wrong on the others. They've also all been compiled using the same shared_lib, so there's obviously been a change made to the code that makes it render slightly differently and its that causing the issue.

I'll look into it down the track - once I get my head around the code in greater detail I'll be another OS X coder available to the community that can assist with porting to OS X as new releases are developed.

In the meantime, let me know if you want me to provide updated OS X ports - I'll do some testing with the kids at school and see what stability is like before I release anything.

mini_me

  • Guest
Re: Compilation Error on OS X
« Reply #10 on: 28 June 2010, 23:30:24 »
in platform_util.ccp:

int isdir(const char *path)
{
   struct stat stats;

   return stat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
}

I get the following error when compiling on OS X in XCode:

Aggregate 'stat stats' has incomplete type and cannot be defined

Any ideas? If I can solve this I should have a 3.2.2 build for OS X completed within 24 hours.

 

this should work and include these headers

       #include <sys/types.h>
       #include <sys/stat.h>
       #include <unistd.h>

int isdir(const char *path)
{
   struct stat stats;
        if(stat(path,&stats) == 0 && S_ISDIR(stats.st_mode) == 0)                             
           return 0;
       else
          return -1;

}