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

Thread: Linking Issues on MacOS X 10.6.5

  1. #1

    Exclamation Linking Issues on MacOS X 10.6.5

    To compile my game on MacOS, I use the following command:

    fpc -Mobjfpc -ve -k-framework -kSDL -k-framework -kSDL_image -k-framework -kCocoa fprl.pp

    Everything goes fine, until the linker tries to link X11 libs:

    Linking fprl
    ld: library not found for -lX11


    What do I have to do (or install, or change) in order to make this work?
    Last edited by Mario Donick; 06-01-2011 at 05:37 PM.

  2. #2
    Okay, now I'm trying

    fpc -Mobjfpc -ve -k-framework -kSDL -k-framework -kSDL_image -k-framework -kCocoa -Fl/usr/X11/lib fprl.pp

    and I get the successful

    Linking fprl
    11378 lines compiled, 1.2 sec

    However, the created binary does not work at all. While on Windows and on Linux everything goes well (my SDL window appears), on MacOS I only get a massive amount of errors, which can be traced back to the point where SDL wants to set its video mode. The call stack is:

    Code:
    0 CoreFoundation            0x994ad6ba __raiseError + 410
    1 libobjc.A.dylib           0x997fb509 objc_exception_throw + 56
    2 CoreFoundation            0x994ad3e8 +[NSException raise:format:arguments:] + 136
    3 CoreFoundation            0x994ad35a +[NSException raise:format:] + 58
    4 AppKit                    0x9524a9be _NSCreateWindowWithOpaqueShape2 + 519
    5 AppKit                    0x951cf8a6 -[NSWindow _commonAwake] + 1624
    6 AppKit                    0x951cc56e -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 1524
    7 AppKit                    0x951cb1c1 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1568
    8 AppKit                    0x951cab9b -[NSWindow initWithContentRect:styleMask:backing:defer:] + 71
    9 SDL                       0x00b2467f SDL_SoftStretch + 27215
    10 SDL                      0x00b235f8 SDL_SoftStretch + 22984
    11 SDL                      0x00b1714f SDL_SetVideoMode + 623
    Anybody seen something like this with SDL on MacOS? Both Frameworks are installed correctly in /lib/Framework .

  3. #3
    Okay, sorry for spamming, but after I deleted the sdl.pp and sdl_image.pp that have been in the source directory of my game (so that fpc used the same files as provided by fpc itself), the SDL mode of my game works. :-D You can't imagine how happy I am now. Since July 2010 I'm trying this, and finally it worked.

    But now I've got a different problem, which is concerning 1024x768 output on MacOS (800x600 window is working, but not 1024x76 -- but for this, I will open a new thread.
    Last edited by Mario Donick; 05-01-2011 at 04:37 PM.

  4. #4
    ... because I accidently removed all the contents of my /usr/local folder, I had to reinstall fpc, lazarus and SDL. Because the framework version did not work anymore when I tried to use the compiler call above (it did not find the SDL library although libSDLmain.a was again in /usr/local/lib), I removed the SDL framework and instead installed the source version of SDL. ./configure, make, make install worked without problems and now all SDL libs are in /usr/local/lib again. Only for SDL image, I still use the framework version.

    I changed the compiler call to

    fpc -Mobjfpc -ve -k-lSDL -k-lSDLmain -k-framework -kSDL_image -k-framework -kCocoa -Fl/usr/X11/lib fprl.pp


    This gives me the following output:

    Linking fprl
    ld: warning: in /usr/local/lib//libSDL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    ld: warning: in /usr/local/lib//libSDLmain.a, file was built for unsupported file format which is not the architecture being linked (i386)
    ld: warning: in /usr/local/lib//libSDL-1.2.0.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    Undefined symbols:
    "_main", referenced from:
    __start in crt1.o
    (maybe you meant: _SDL_main)
    "_SDL_SaveBMP_RW", referenced from:
    _SDL_SDL_SAVEBMP$PSDL_SURFACE$PCHAR$$LONGINT in sdl.o
    "_SDL_SetVideoMode", referenced from:
    _P$FPRL_SETOPTIONS in fprl.o

    and so on.

    Esp. the first three lines are disturbing me.

    What can I do now? I was so happy that everything worked, but obviously I did not understand how I got SDL to work on my system, so I can't explain the process to end users of the game as well.

    Please please help ... (I read all the topics related to SDL on MacOS in this forum, I also read the section on freepascal.org).


    Edit: Just in case it is a problem with PowerPC vs. i386, I tried to use the option to build a universal binary, as stated in the MacOS X readme in the SDL source folder. There it says I could call a script named fatbuild.sh. Well, I tried, but this script seems to have errors, or not to work anymore on Leopard.
    Last edited by Mario Donick; 06-01-2011 at 12:31 PM.

  5. #5

    Unhappy Reboot (of my SDL issues)

    Again -- I removed FPC, Lazarus, everything SDL related. What I then did was to set up everything, so the following conditions are given:

    1. MacOS "Snow Leopard" 10.6.5
    2. All developer Tools installed

    3. FPC 2.4.2, installed in /usr/local/*
    4. SDL.Framework 1.2.14, installed in /Library/Frameworks
    5. SDL_Image.Framework, installed in /Library/Frameworks

    6. Compiled libSDLMain.a, based on SDL devel-lite 1.2.14, installed in /usr/local/lib and in the source dir of my program

    7. Using the SDL units provided by FPC 2.4.2

    8. Compiler call: fpc -Mobjfpc -ve -k-framework -kSDL -k-framework -kSDL_image -k-framework -kCocoa -Fl/usr/X11/lib -Fl/usr/local/lib fprl.pp

    (it does, by the way, makes no difference if I explicitly refer to libSDLMain.a by adding -lSDLMain to the compiler options.)

    So, why do I still get the "library not found for -lSDL-1.2.0" message? I simply don't understand what's going wrong here ...

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Sorry that this may seem like a one-way conversation for you so far. I myself am a new Mac user and I love FPC and have been using Lazarus and SDL for my development for some time so I find this topic very interesting actually. However I unfortunately cannot offer you too many solutions as I find myself stuck with the current version of Lazarus' use of the debugger crashing on my system.

    I am however aware of the problem surrounding the current JEDI-SDL version with Lazarus on Mac OS X. Fortunately I just so happen to have direct access of the maintainer of the library and he has given me an unofficial copy of it, updated to work properly for the Mac. If you are interested, I can email you a copy of it to test out, just PM me and we'll talk.

    I'm glad that there are more people trying to develop with Object Pascal on the Mac and posting about it. I myself am finding resources on the platform a bit sparse at the moment so the more people posting about this the better. Thanks for doing your part!
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Mac os is a little like linux isnt it? Maybe my post here may be of some use to you: http://www.pascalgamedevelopment.com...ghlight=ubuntu

    i'm not sure if this helped beyond a hint, but stil...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  8. #8
    Thanks for the supporting posts. At least I know now that I'm not spamming

    Perhaps, if we figured out how to set up a working SDL + FPC environment on MacOS in a way which works on all recent Macs, we could write an article about it.

    Additionally, it may be important to summarize how to distribute a developed game to the end users -- because I fear that simply installing SDL Frameworks on the end user machine may not be enough (here I would need information, too, but later, when I again successfully linked my game...)

    @code_glitch: Well, I wish it was as easy as with Linux. On Mac, first of all you have to decide if you want to use the standard Unix/Linux way of having the SDL libraries in a standard directory like /usr/local/lib, OR if you want to have the Mac way of having the SDL libraries as a Framework in /Library/Frameworks . Getting everything to work on Linux was very easy, I simply installed SDL, SDL_image and the related development packages, and simply could call fpc fprl.pp, without any special parameters. On Mac OS, as shown in the previous posts, its all a mess, and nothing works currently, regardless if I use the Unix/Linux way or the Mac way.

    @WILL: PM.

  9. #9
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  10. #10
    Thanks, JSoftware, but I know this page. The setup described above was done after reading that page ...

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
  •