Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Problem with FreePascal + MacOS

  1. #1

    Problem with FreePascal + MacOS

    I'm currently trying to port my engine to MacOSX (Snow Leopard).
    The problem is, while everything compiles ok, there are bugs everywhere, everything crashes even in places it shouldnt!
    Even during program startup, just calling SetLength twice on the same array (for redimensioning it) causes a crash.
    Also using {$APPTYPE GUI} does not work, my program still brings up a console when run.

    I can't post the code, because it is huge (about one hundred .pas files).
    I've ported the engine successfully in the past to nintendo DS, and Linux, with no problems of this kind.

    I'm using $mode DELPHI for everything, if this makes any difference.
    And I'm running it from the command line (I was using -XX and -O2, but now tried even without those, and it has the same problem)
    I could try Lazarus, however my program does not use a GUI (well, it usually creates a openGL window, but even now I'm just compilling the hello world, that just uses a logger class and nothing else)

    Is there something different to take care when compiling for mac?
    Or is the compiler not compatible with snow leopard?
    Or is this some know bug?

    Help

  2. #2
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Is there something different to take care when compiling for mac?
    Although I do not know all of the specifics, to that statement I would answer: more than you can possibly imagine. It is not necessarily a different way to do it the problem lies more in the fact that when something goes wrong forget your nice $message windows gives you or your segfault. Ever heard mac never crashes (although I beg to differ) it continues - good luck. I have seen so many mac issues in these forums it makes my head spin.

    If you use the fp editor I know there is a debug compile option - I would say try it because it works in my cases to make things just that much more stable. Otherwise WILLs the guy to see or anyone else with a mac. Or perhaps you would consider making the jump to linux and all its open-source goodness? Slackware, Arch and Ubuntu: its all good.

    Did you ensure the dev libraries are installed for the units you use and more importantly those .so (dyna-thingy lib on mac I think) are in place? The above happens on linux too if you dont have the libs

    Not much help I know, but I'm no mac fanboy but its a mac thread so posting is mandatory

    edit: hey, now I think of it, wasn't it you that uses Arch Andru? That part of your avatar looks familiar...

    PS: Have been looking into arch myself - what your idle ram on those machines? I must be honest though - I am looking into compiz
    Last edited by code_glitch; 02-02-2011 at 10:48 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  3. #3
    Quote Originally Posted by Relfos
    Also using {$APPTYPE GUI} does not work, my program still brings up a console when run.
    Do you know what is "Bundle" in MacOS X world?

    Quote Originally Posted by Relfos
    but even now I'm just compilling the hello world, that just uses a logger class and nothing else
    I think there is a problem with this "just hello world" and "just a logger class". Try to do something separately from your engine.

    [offtop]
    Quote Originally Posted by code_glitch
    hey, now I think of it, wasn't it you that uses Arch Andru? That part of your avatar looks familiar...
    Yes, I use ArchLinux x86_64 on my desktop and laptop.
    what your idle ram on those machines
    Desktop and laptop has 4GB, so I never checked how much free RAM I have
    [/offtop]
    Last edited by Andru; 02-02-2011 at 11:08 PM.

  4. #4
    Moving to Linux is not an option, actually this code already compiles on linux, this is a game engine that should run on all major operating systems, and only Mac is left now.
    I actually bought a Macbook just for this, it has all latest updates and such, and enough ram, and latest FPC installed.

    I don't know what a 'Bundle' is, I'll read about it, but for now just a simple console application should run.
    Tomorrow, I will try to create a application from scratch that reproduces the error, without using the engine.

  5. #5
    Quote Originally Posted by Relfos
    I don't know what a 'Bundle' is, I'll read about it, but for now just a simple console application should run.
    About "Bundle" I remembered because of your problem with "my program still brings up a console".

    Tomorrow, I will try to create a application from scratch that reproduces the error, without using the engine.
    Sometimes starting something from scratch is better then trying to modify something huge Good luck with your experiments.

  6. #6
    I'm having no luck finding what a bundle is. When I talked about that, was about the {$APPTYPE CONSOLE} and {$APPTYPE GUI}, I'm using the later, and from what I read it is supported on darwin, however, when I double click the executable, a console window opens.

    Another thing I remembered now, maybe I'm compiling for 64bits?
    All other ports I have done are 32bits, and the code itself uses lots of pointer hacks that would probably crash under 64bits.
    How to compile a 32bits application under snow leopard, is that even possible?
    Last edited by Relfos; 02-02-2011 at 11:48 PM.

  7. #7
    Passing the -Wb compiler switch will create a bundle
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    By 'Bundle' I believe that he simply means the way an "App" is packaged...

    All those neat little App-like files that you just drag and drop into your Applications folder are really just fancy folders that contain files, yet act like an executable file. If you hold down the Option button while you right click on an "App" you'll see the option "Show Package Contents" to see the contents. If you select this you can go in and modify the contents. If your case add textures, audio files, etc...
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9
    I found the problem, guys.
    The problem is the unit cmem!
    I included it because I read that when using fpc threads we should include cthreads and cmem units as the first units in the program.
    But this breaks the program everywhere, things like SetLength fail, for example.
    FPC bug, or cmem is not needed anymore, or something else?

  10. #10
    Hm, I never used cmem, and my apps worked fine on Linux and MacOS X But if you need it, maybe you forgot that cmem unit should be the first unit in the uses clause?

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •