Build Universal 32/64 bit with XCode 3.2.6->no 64 bit

  • When I upgraded from Xcode 3.2.3 to 3.2.6, Xcode "erased" my universal
    build settings, as many of you probably know or experienced.

    I've tried to restore them with some info found on the web, but what I've
    wound up with is builds that are universal, but do not actually run in 64
    bit mode.

    Can someone please tell me precisely what the correct build settings
    should be?

    This is what I have:

    Architectures: i386 ppc
    Base SDK: Current Mac OS  (** now on SL)
    Valid Architectures: x86_64 i386 ppc ppc7400 ppc970
    Mac OS X 10.5:  x86_64 i386 ppc64

    Compiler Version: GCC 4.2
    Mac OS X Deployment Target: Mac OS X 10.4

    Note that I created an additional "valid architecture" at one point,
    because I need to weak link some frameworks for 10.5+

    It must run on OS X 10.4

    In addition, I wonder if/how I can change this setting:

    Instruction Scheduling: PowerPC G5 [-mtune G5]

    That was introduced when I first created the app; no longer relevant,
    running MacPro Intel.

    Thanks.
  • On Sep 21, 2011, at 08:46:35, Loren Ryter wrote:

    > Can someone please tell me precisely what the correct build settings
    > should be?
    >
    > This is what I have:
    >
    > Architectures: i386 ppc
    > Base SDK: Current Mac OS  (** now on SL)
    > Valid Architectures: x86_64 i386 ppc ppc7400 ppc970
    > Mac OS X 10.5:  x86_64 i386 ppc64

    Looks to me like you need to simply add x86_64 to the Architectures setting if you want to also build 64-bit Intel.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • That's what I thought, too. Originally when I did this I got a number of
    build errors related to needing 10.5 to run certain libraries.

    So I modified the settings as follows:

    Architectures: x86_64 i386 ppc
    Valid Architectures:  i386 ppc ppc7400 ppc970
    Mac OS X 10.5:  X86_64 i386 ppc64

    Note that I removed x86_64 from the first part of "Valid Architectures"
    while adding it to "Architectures".

    Now it builds without error.  It runs on all necessary platforms from
    PPC/Tiger thru Intel/Lion.

    HOWEVER, it still doesn't run in 64 bit mode on Lion.

    Since the deployment target is 10.4, I assumed that the first line of
    "Valid Architectures" applies to 10.4, while the second line, that says
    10.5, would apply to 10.5 and up.  Is this correct?

    What am I still doing wrong here?

    Thanks.

    -----Original Message-----
    From: "Mills, Steve" <smills...>
    Date: Wed, 21 Sep 2011 08:54:16 -0500
    To: Xcode <xcode-users...>
    Subject: Re: Build Universal 32/64 bit with XCode 3.2.6->no 64 bit

    > On Sep 21, 2011, at 08:46:35, Loren Ryter wrote:
    >
    >> Can someone please tell me precisely what the correct build settings
    >> should be?
    >>
    >> This is what I have:
    >>
    >> Architectures: i386 ppc
    >> Base SDK: Current Mac OS  (** now on SL)
    >> Valid Architectures: x86_64 i386 ppc ppc7400 ppc970
    >> Mac OS X 10.5:  x86_64 i386 ppc64
    >
    >
    > Looks to me like you need to simply add x86_64 to the Architectures
    > setting if you want to also build 64-bit Intel.
    >
    > --
    > Steve Mills
    > office: 952-818-3871
    > home: 952-401-6255
    > cell: 612-803-6157
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Xcode-users mailing list      (<Xcode-users...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/xcode-users/<loren_ryter...>
    >
    > This email sent to <loren_ryter...>
  • On Sep 22, 2011, at 14:01:05, Loren Ryter wrote:

    > Architectures: x86_64 i386 ppc
    > Valid Architectures:  i386 ppc ppc7400 ppc970
    > Mac OS X 10.5:  X86_64 i386 ppc64
    >
    > Note that I removed x86_64 from the first part of "Valid Architectures"
    > while adding it to "Architectures".
    >
    > Now it builds without error.  It runs on all necessary platforms from
    > PPC/Tiger thru Intel/Lion.
    >
    > HOWEVER, it still doesn't run in 64 bit mode on Lion.
    >
    > Since the deployment target is 10.4, I assumed that the first line of
    > "Valid Architectures" applies to 10.4, while the second line, that says
    > 10.5, would apply to 10.5 and up.  Is this correct?

    No, valid architectures means "which ones would it ever be correct to build". Architectures just means "build these for this project/target". Architectures should be <= valid architectures. If an arch isn't in valid, then adding it to architectures won't make it build. Add x68_64 to both.

    --
    Steve Mills
    office: 952-818-3871
    home: 952-401-6255
    cell: 612-803-6157
  • On Sep 22, 2011, at 21:24, Mills, Steve wrote:

    > On Sep 22, 2011, at 14:01:05, Loren Ryter wrote:
    >
    >> Architectures: x86_64 i386 ppc
    >> Valid Architectures:  i386 ppc ppc7400 ppc970
    >> Mac OS X 10.5:  X86_64 i386 ppc64
    >>
    >> Note that I removed x86_64 from the first part of "Valid Architectures"
    >> while adding it to "Architectures".
    >>
    >> Now it builds without error.  It runs on all necessary platforms from
    >> PPC/Tiger thru Intel/Lion.
    >>
    >> HOWEVER, it still doesn't run in 64 bit mode on Lion.
    >>
    >> Since the deployment target is 10.4, I assumed that the first line of
    >> "Valid Architectures" applies to 10.4, while the second line, that says
    >> 10.5, would apply to 10.5 and up.  Is this correct?
    >
    > No, valid architectures means "which ones would it ever be correct to build". Architectures just means "build these for this project/target". Architectures should be <= valid architectures. If an arch isn't in valid, then adding it to architectures won't make it build. Add x68_64 to both.
    >
    > --
    > Steve Mills
    > office: 952-818-3871
    > home: 952-401-6255
    > cell: 612-803-6157

    So to summarize, what is build is the intersection of archs and valid archs (unless you've checked the only active arch setting).

    And as for your second part, this does not make sense, not in practice and even not logically. Conditional build settings (conditional on OS) depend on the *SDK* that you're using. *Not* on the OS version on which it will run, that's impossible, as that is fundamentally unknowable at compile time (the OS version on which it runs is a run-time condition, that's a tautology).

    If you want to prevent the 64-bit arch binary from being used on 10.4 (but still want to have it for later OS versions), you have to tell the *runtime* not to use it, not the compiler. You do that in Info.plist using the LSMinimumSystemVersionByArchitecture key.

    Christiaan
  • I'm sorry to be sooo dense, but I still don't understand what's going on.
    If someone could look at what I'm describing (and picturing) here and walk
    me through the solution, I would sure appreciate it.  This used to be
    simple -- build as 32/64 bit universal binary.

    I introduced the conditional build settings for the purpose of including
    10.5+ libraries.  There are checks in the code so those libraries are not
    used with 10.4 at runtime.  The deployment target is 10.4.

    So I _thought_ there were TWO sets of "valid architectures".  One says
    just "Valid Architectures".  Then directly below it, indented, says
    specifically "Mac OS X 10.5".  So what is the distinction between THOSE
    two entries (as opposed to that between 'architectures' and 'valid
    architectures'), if not that the latter applies to 10.5+ and the former
    applies to 10.4?

    (To be clear, here's a screen shot of what I have that builds without
    error but does not produce a 64 bit binary):

    http://img841.imageshack.us/img841/3776/buildsettings2.jpg

    At any rate, what I get if I add "X86_64" to the first entry, ie, "Valid
    Architectures" are build errors (and a failure):

    warning: Mac OS X version 10.5 or later is needed for use of the new objc
    abi
    error: Mac OS X version 10.5 or later is needed for zerocost-exceptions

    But I know that; the purpose of those conditional build settings were such
    that the code in question would require 10.5 (and be checked at runtime).

    So again, if I remove "X86_64" from the first entry ("Valid
    Architectures"), it builds fine -- and runs on PPC and intel on 10.4 and
    higher.  BUT the result is that it does NOT run in 64 bit mode on
    Lion/Intel.

    What I want to do is correct that latter problem.  I'm not concerned with
    limiting the 64 bit binary from being used at runtime on 10.4 (at this
    point, but may have to be later, I see).  I'm concerned about a 64 bit
    binary actually being produced for 10.5+.

    Thanks again for your patience.

    -----Original Message-----
    From: Christiaan Hofman <cmhofman...>
    Date: Thu, 22 Sep 2011 22:39:43 +0200
    To: "Mills, Steve" <smills...>
    Cc: Xcode <xcode-users...>
    Subject: Re: Build Universal 32/64 bit with XCode 3.2.6->no 64 bit

    >
    > On Sep 22, 2011, at 21:24, Mills, Steve wrote:
    >
    >> On Sep 22, 2011, at 14:01:05, Loren Ryter wrote:
    >>
    >>> Architectures: x86_64 i386 ppc
    >>> Valid Architectures:  i386 ppc ppc7400 ppc970
    >>> Mac OS X 10.5:  X86_64 i386 ppc64
    >>>
    >>> Note that I removed x86_64 from the first part of "Valid Architectures"
    >>> while adding it to "Architectures".
    >>>
    >>> Now it builds without error.  It runs on all necessary platforms from
    >>> PPC/Tiger thru Intel/Lion.
    >>>
    >>> HOWEVER, it still doesn't run in 64 bit mode on Lion.
    >>>
    >>> Since the deployment target is 10.4, I assumed that the first line of
    >>> "Valid Architectures" applies to 10.4, while the second line, that says
    >>> 10.5, would apply to 10.5 and up.  Is this correct?
    >>
    >> No, valid architectures means "which ones would it ever be correct to
    >> build". Architectures just means "build these for this project/target".
    >> Architectures should be <= valid architectures. If an arch isn't in
    >> valid, then adding it to architectures won't make it build. Add x68_64
    >> to both.
    >>
    >> --
    >> Steve Mills
    >> office: 952-818-3871
    >> home: 952-401-6255
    >> cell: 612-803-6157
    >
    >
    > So to summarize, what is build is the intersection of archs and valid
    > archs (unless you've checked the only active arch setting).
    >
    > And as for your second part, this does not make sense, not in practice
    > and even not logically. Conditional build settings (conditional on OS)
    > depend on the *SDK* that you're using. *Not* on the OS version on which
    > it will run, that's impossible, as that is fundamentally unknowable at
    > compile time (the OS version on which it runs is a run-time condition,
    > that's a tautology).
    >
    > If you want to prevent the 64-bit arch binary from being used on 10.4
    > (but still want to have it for later OS versions), you have to tell the
    > *runtime* not to use it, not the compiler. You do that in Info.plist
    > using the LSMinimumSystemVersionByArchitecture key.
    >
    > Christiaan
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Xcode-users mailing list      (<Xcode-users...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/xcode-users/<loren_ryter...>
    >
    > This email sent to <loren_ryter...>
  • On Sep 23, 2011, at 14:54, Loren Ryter wrote:

    > I'm sorry to be sooo dense, but I still don't understand what's going on.
    > If someone could look at what I'm describing (and picturing) here and walk
    > me through the solution, I would sure appreciate it.  This used to be
    > simple -- build as 32/64 bit universal binary.
    >
    > I introduced the conditional build settings for the purpose of including
    > 10.5+ libraries.  There are checks in the code so those libraries are not
    > used with 10.4 at runtime.  The deployment target is 10.4.
    >
    > So I _thought_ there were TWO sets of "valid architectures".  One says
    > just "Valid Architectures".  Then directly below it, indented, says
    > specifically "Mac OS X 10.5".  So what is the distinction between THOSE
    > two entries (as opposed to that between 'architectures' and 'valid
    > architectures'), if not that the latter applies to 10.5+ and the former
    > applies to 10.4?
    >
    > (To be clear, here's a screen shot of what I have that builds without
    > error but does not produce a 64 bit binary):
    >
    > http://img841.imageshack.us/img841/3776/buildsettings2.jpg
    >

    The Mac OS X 10.5 setting is used when you use the 10.5 *SDK* (Base SDK), it's NOT, and I repeat again NOT about the runtime OS. As you've set the SDK to current, this means 10.6 in your case, and therefore it will *not* use the 10.5 specific setting for valid archs but the generic one (without x86_64).

    As I said, this is all explained in the docs about xcode, before coming to this list you should have read this.I advice you to do this now.

    > At any rate, what I get if I add "X86_64" to the first entry, ie, "Valid
    > Architectures" are build errors (and a failure):
    >
    > warning: Mac OS X version 10.5 or later is needed for use of the new objc
    > abi
    > error: Mac OS X version 10.5 or later is needed for zerocost-exceptions
    >
    > But I know that; the purpose of those conditional build settings were such
    > that the code in question would require 10.5 (and be checked at runtime).
    >

    But this is a *compile time* problem, not a *runtime* problem. Checking at runtime therefore is not relevant.

    > So again, if I remove "X86_64" from the first entry ("Valid
    > Architectures"), it builds fine -- and runs on PPC and intel on 10.4 and
    > higher.  BUT the result is that it does NOT run in 64 bit mode on
    > Lion/Intel.
    >
    >
    >
    > What I want to do is correct that latter problem.  I'm not concerned with
    > limiting the 64 bit binary from being used at runtime on 10.4 (at this
    > point, but may have to be later, I see).  I'm concerned about a 64 bit
    > binary actually being produced for 10.5+.
    >
    > Thanks again for your patience.
    >

    What you want is to have i386 and ppc for 10.4 and later, and x86_64 for 10.5 and later. This means that the archs you build should be related to the *minimum* OS version (deployment target), not the *maximum* (base SDK). The way to do this is to make the *deployment target* conditional on the arch, *not* the (valid) archs conditional on the SDK. So add a build setting conditional to the deployment target setting for "Intel 64-bit", and set it to 10.5.

    Christiaan

    >>
    >> On Sep 22, 2011, at 21:24, Mills, Steve wrote:
    >>
    >>> On Sep 22, 2011, at 14:01:05, Loren Ryter wrote:
    >>>
    >>>> Architectures: x86_64 i386 ppc
    >>>> Valid Architectures:  i386 ppc ppc7400 ppc970
    >>>> Mac OS X 10.5:  X86_64 i386 ppc64
    >>>>
    >>>> Note that I removed x86_64 from the first part of "Valid Architectures"
    >>>> while adding it to "Architectures".
    >>>>
    >>>> Now it builds without error.  It runs on all necessary platforms from
    >>>> PPC/Tiger thru Intel/Lion.
    >>>>
    >>>> HOWEVER, it still doesn't run in 64 bit mode on Lion.
    >>>>
    >>>> Since the deployment target is 10.4, I assumed that the first line of
    >>>> "Valid Architectures" applies to 10.4, while the second line, that says
    >>>> 10.5, would apply to 10.5 and up.  Is this correct?
    >>>
    >>> No, valid architectures means "which ones would it ever be correct to
    >>> build". Architectures just means "build these for this project/target".
    >>> Architectures should be <= valid architectures. If an arch isn't in
    >>> valid, then adding it to architectures won't make it build. Add x68_64
    >>> to both.
    >>>
    >>> --
    >>> Steve Mills
    >>> office: 952-818-3871
    >>> home: 952-401-6255
    >>> cell: 612-803-6157
    >>
    >>
    >> So to summarize, what is build is the intersection of archs and valid
    >> archs (unless you've checked the only active arch setting).
    >>
    >> And as for your second part, this does not make sense, not in practice
    >> and even not logically. Conditional build settings (conditional on OS)
    >> depend on the *SDK* that you're using. *Not* on the OS version on which
    >> it will run, that's impossible, as that is fundamentally unknowable at
    >> compile time (the OS version on which it runs is a run-time condition,
    >> that's a tautology).
    >>
    >> If you want to prevent the 64-bit arch binary from being used on 10.4
    >> (but still want to have it for later OS versions), you have to tell the
    >> *runtime* not to use it, not the compiler. You do that in Info.plist
    >> using the LSMinimumSystemVersionByArchitecture key.
    >>
    >> Christiaan
previous month september 2011 next month
MTWTFSS
      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    
Go to today