Professional Web Applications Themes

How to add framework to a target in Xcode? - Mac Programming

I have been experimenting with converting Project Builder targets to Xcode, and have been having problems building targets that use my own frameworks. In the Project Builder version of this project, I was able to drag my framework into the "Frameworks and Libraries" Field under Build Phases for that target. After converting the target to Xcode native, the AppKit and Cocoa frameworks appear in the corresponding F & L field, but my own framework does not and builds fail with an "Undefined symbols" message relating to symbols in the missing framework. It does not appear to be possible to drag ...

  1. #1

    Default How to add framework to a target in Xcode?


    I have been experimenting with converting Project Builder targets to
    Xcode, and have been having problems building targets that use my own
    frameworks.

    In the Project Builder version of this project, I was able to drag my
    framework into the "Frameworks and Libraries" Field under Build Phases
    for that target.

    After converting the target to Xcode native, the AppKit and Cocoa
    frameworks appear in the corresponding F & L field, but my own framework
    does not and builds fail with an "Undefined symbols" message relating to
    symbols in the missing framework.

    It does not appear to be possible to drag the symbol for my framework (
    which does build) into the "Frameworks and Libraries" list. I don't
    know if this indicates a problem with my framework, or if there is some
    non-obvious means of telling the linker (or loader, or whatever gets
    used) about a framework...

    The "Frameworks and Libraries" list under PB was as follows:

    AppKit.framework
    Cocoa.framework
    $(BUILT_PRODUCTS_DIR)/IAFilter.framework

    Under Xcode only the first two entries remain.

    The build error is

    ld: Undefined symbols: .objc_class_name_IAFilter
    Eric Guest

  2. #2

    Default Re: How to add framework to a target in Xcode?

    ... 
    ... 
    Ok - if I manually add "-framework IAFilter" in the "Other linker flags"
    the code will build ok. Under project builder I don't see any explicit
    inclusion of the -framework flag... in retrospect I guess this is
    pretty obvious.

    I am still getting some errors regarding prebinding:

    ld: warning prebinding disabled because (__PAGEZERO segment (address =
    0x0 size = 0x1000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with __TEXT segment (address = 0x0 size = 0x2000) of /Library/
    Frameworks/IAFilter.framework/Versions/A/IAFilter
    ld: warning prebinding disabled because (__TEXT segment (address =
    0x1000 size = 0x77000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with __TEXT segment (address = 0x0 size = 0x2000) of /Library/
    Frameworks/IAFilter.framework/Versions/A/IAFilter
    ld: warning prebinding disabled because (__TEXT segment (address =
    0x1000 size = 0x77000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with __DATA segment (address = 0x2000 size = 0x1000) of /
    Library/Frameworks/IAFilter.framework/Versions/A/IAFilter
    ld: warning prebinding disabled because (__TEXT segment (address =
    0x1000 size = 0x77000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with __OBJC segment (address = 0x3000 size = 0x1000) of /
    Library/Frameworks/IAFilter.framework/Versions/A/IAFilter
    ld: warning prebinding disabled because (__TEXT segment (address =
    0x1000 size = 0x77000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with __LINKEDIT segment (address = 0x4000 size = 0x9000) of /
    Library/Frameworks/IAFilter.framework/Versions/A/IAFilter

    And the "Copy Files" build phase of my main application target was not
    retained in the "Upgrade to Native".

    Eric Guest

  3. #3

    Default Re: How to add framework to a target in Xcode?


    ... 
    >[/ref]
    ...

    Argh!! For some reason, after building with the manually added -
    framework flags for the linker, it became possible to drag icons (e.g.
    for frameworks) from the "Products" group into the "Frameworks &
    Libraries" group of my targets. So disregard the above statement. Not
    sure if this is some odd behaviour in Xcode or if I was just hopelessly
    mixed up. With the frameworks and plugins dragged to the F&L group of
    targets the -framework is no longer needed.

    Still have to figure out the prebinding problems...

    ld: warning prebinding disabled because (__PAGEZERO segment (address =
    0x0 size = 0x1000) of build/NeuroLens.app/Contents/MacOS/NeuroLens
    overlaps with TEXT segment (address = 0x0 size = 0x2000) of /Library/
    Frameworks/IAFilter.framework/Versions/A/IAFilter

    Obviously it's not happy about the prebinding address - but I never had
    to specify this under Project Builder!! The app runs anyway - the libs
    are small enough that prebinding may not make much difference...

    Eric Guest

  4. #4

    Default Re: How to add framework to a target in Xcode?

    On 2003-10-27 18:32:38 -0800, (null) said:
     

    Have you rebuilt your frameworks? The last time I got messages like that one (using some of the Omni frameworks), they were eliminated after cleaning and rebuilding.



    Larry Guest

  5. #5

    Default Re: How to add framework to a target in Xcode?


    >
    > Have you rebuilt your frameworks? The last time I got messages like that one (using some of the Omni frameworks), they were eliminated after cleaning and rebuilding.[/ref]

    Yes - the frameworks are part of my project and were cleaned and
    rebuilt repeatedly while I tried to figure this out.

    In the end I got rid of the error by adding the linker flag '-seg1addr
    0x10000000' to my framework target (this is doented many places but
    I never had to do it in Jaguar/PB).

    I also encountered another weird problem that I think is associated
    with the upgrade from Project Builder to Xcode - when I built a
    deployment target and ran it outside of Xcode the frameworks were
    never found because the application looked in /Library/Frameworks (my
    frameworks are embedded in the Application bundle). There is a lot of
    doentation out there on how to avoid this under PB, by entering

    executable_path/../Frameworks

    under the 'Install Location' field in the Target settings. Of course
    there is no corresponding GUI field in Xcode so it took some digging
    before I figured out to add the following setting under the Build tab
    of the target settings for my framework in Xcode:

    INSTALL_PATH = "executable_path/../Frameworks"

    Might have figured this out sooner but the INSTALL_PATH setting was
    not originally present in the Xcode inspector - I had to add it by
    clicking the '+' button at the bottom of the inspector panel. After
    adding this the frameworks were found when the deployment target was
    installed in an arbitrary location.

    I'm happy that all works now but am kind of surprised how much work
    had to be done manually to get my project to work. Of course some of
    this may have been due to improper or incomplete configuration of the
    original project...

    Hope this is useful to someone!
    Eric Guest

Similar Threads

  1. TARGET PLEASE
    By nivla17 in forum Coldfusion Flash Integration
    Replies: 6
    Last Post: August 11th, 09:05 PM
  2. Target a different .NET Framework version
    By Mircea Pleteriu in forum ASP.NET Building Controls
    Replies: 3
    Last Post: May 4th, 06:42 AM
  3. Importing Code Warrior project on XCode....
    By Kundan Nehete in forum Mac Programming
    Replies: 2
    Last Post: August 8th, 02:36 AM
  4. Xcode can't find a header
    By James W. Walker in forum Mac Programming
    Replies: 0
    Last Post: July 20th, 07:35 PM
  5. How do you build a project to target Framework 1.0 in VS 2003?
    By David Flynn in forum ASP.NET General
    Replies: 3
    Last Post: July 3rd, 01:17 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139