Results 1 to 10 of 15

Thread: Linking issues with XCode + FPC for iPhone

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [FIXED] Linking issues with XCode + FPC for iPhone

    Hi!
    I'm trying to port my game engine to run on iPhone, so I used the FPC OpenGL template as startup point.
    Now in PascalLibrary.pas it says 'Add all your Pascal units to 'uses' clause..."
    My game engine contains about 70 different units, do I need to add them all there?

    I can compile with no problem the empty template (with the spinning fpc logo)
    Is it necessary to have -mmacpas mode defined?
    I removed this in the settings and it still compiles and runs ok. I ask this because my engine was originally written in Delphi/Windows, and later ported to FPC and uses mode Delphi switches everywhere.

    Now the other problem, just adding for example my unit TERRA_Utils to PascalLibrary causes lots of linking errors

    _FINALIZES_TERRA_GL, referenced from.
    INITFINAL in PascalLibrary.o
    _FINALIZES_TERRA_OS, referenced from
    INITFINAL in PascalLibrary.o
    _FINALIZES_TERRA_LOG, referenced from
    INITFINAL in PascalLibrary.o
    _THREADVARLIST_TERRA_APPLICATION, referenced from
    FPC_THREADVARTALES in PascalLibrary.o

    and lots of similar errors.
    I already have the -Wl, -no_order_inits in the project settings, what could be the problem?
    (I'm using FPC 2.5.1)
    Last edited by Relfos; 03-03-2011 at 04:59 PM.

  2. #2
    Have you tried rebuilding everything?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3
    I was almost sure that I already did try that, but I just did a clean + build and the errors did change, this time errors in the actual units (functions that need to be ported) and not linking errors.
    Well, time to work, I will ask again here in case I have more problems

  4. #4
    I'm back, after fixing all compilation errors in the units, now I've done a clean, and the linking problem is there again, saying that cannot find the initialization and finalizations of the included units in the generated pascallibrary.o
    What could be the problem?

  5. #5
    A broken linker? Try to inspect the object files manually and use -Sh to view the linker script
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  6. #6
    I've disable dead code stripping and still the same result.
    I've added -Sh to the "other linker flags" but I don't much difference.
    However I tried to look at hedgewars xcode project settings, copied some stuff and now reduce from 24 linking errors to 10.
    How to inspect the object files manually?

  7. #7
    I'm trying to figure this linking process.
    Well, we have the pascallibrary.pas that is the main file and has all the other units in the uses clauses (TERRA_Utils, TERRA_Application, etc)

    Now, it I understood correctly, the objective is to build a library called libfpc.a, that will contain all the stuff.
    The linker is trying to look at pascallibrary.o for those missing symbols (_FINALIZES_TERRA_UTILS, etc)
    But I suppose those are actually in their respective .o files, like TERRA_Utils.o?
    If is that, then I need to add them to the step where the library is assembled from the various .o files I guess, I'm kind of a noob at this kind of things

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
  •