Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Question about building Universal Binaries in Leopard with transient <Xcode directory>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about building Universal Binaries in Leopard with transient <Xcode directory>



Yeah I didn't read the release notes carefully enough. 

Shame on me. ;)

I'll try to make up for it by posting an example of how I've integrated building for Universal Binaries into my configure.ac script:

We create the "--enable-universal-binary" option with:

AC_ARG_ENABLE(universal-binary,
  AS_HELP_STRING([--enable-universal-binary],
    [build as Universal Binary (Mac OS X Only)]),
  [],
  [enabled_universal_binary="no"])

----------------------------------------------------------------

Then, in the darwin-specific section:

----------------------------------------------------------------

   *darwin*)
      framer="darwin"
      platform="darwin"
      AC_DEFINE(DARWIN)
      DARWINLIBS=" -framework CoreFoundation -lresolv"

      AS_IF([test "$enable_universal_binary" = "yes"],[
         # Check to see if the system has xcode-select (Mac OS X 10.5 "Leopard" or later).                                                                                                                                                
         # This is necessary if the user has installed their development SDKs somewhere                                                                                                                                                   
         # other than the default location (/Developer)                                                                                                                                                                                   
         # if xcode-select doesn't exist, assume the tools are in /Developer                                                                                                                                                              
         AC_CHECK_FILE([/usr/bin/xcode-select],[
            sysroot=`/usr/bin/xcode-select -print-path`
         ],[
            sysroot="/Developer"
         ])

         AC_MSG_CHECKING([For Mac OS X SDK Path])
         AC_MSG_RESULT([$sysroot])

         CFLAGS="$CFLAGS -isysroot $sysroot/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
         LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
      ], [])
   ;;

And of course, following technote 2137's advice about disabling dependency tracking:

./configure --enable-universal-binary --disable-dependency-tracking

The output looks something like this on Leopard:

checking for /usr/bin/xcode-select... yes
checking For Mac OS X SDK Path... /Developer

Hope it helps someone. :)

- Terry

On Oct 31, 2007, at 12:39 AM, Chris Hanson wrote:

On Oct 30, 2007, at 11:20 PM, Terry Simons wrote:

I saw in the "About Xcode Tools" documentation for Leopard that the XCode 3.0 tools can be installed in a location other than "/Developer".

I'm assuming this means that the SDKs directory goes with it?

Yes.

If so, how does one go about detecting the location where XCode is installed from an auto-tools based program?

My specific concern is that the following technote says to pass -isysroot /Developer/SDKs/MacOSX10.4u.sdk to build Universal binaries:

http://developer.apple.com/technotes/tn2005/tn2137.html

You can use the xcode-select tool to get the location of the Xcode tools that are currently selected for command-line development.  In the Xcode 3.0 Release Notes <http://developer.apple.com/releasenotes/DeveloperTools/RN-Xcode/>:

The Xcode Developer Tools installer also installs the standard system development tools and interfaces into /usr, so conventional makefile- and config-based builds will operate correctly. There is no way to switch among versions of most these tools; the last installed version replaces all other versions. A few of these tools, including /usr/bin/xcodebuild, can switch among versions; see the xcode-select manpage for more information. Installation of these tools can be disabled by turning off the UNIX Development Support choice in the installer.

If the UNIX Development Support is not installed, all projects must build against an SDK, and conventional makefile-based builds should execute the standard development tools from the developer directory’s usr/bin directory instead of the root system’s /usr/bin. This can be done by adding the full path to that directory to the PATH environment variable and making sure that your build scripts and makefiles do not have absolute references to tools such as /usr/bin/gcc, instead always using the shell’s path mechanism to launch the tools. Alternatively, tools can be invoked using a path returned by xcode-select -print-path; see the xcode-selectmanpage for more information.

Just do a "man xcode-select" from Terminal for more information.  Hope this helps!

  -- Chris



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Question about building Universal Binaries in Leopard with transient <Xcode directory> (From: Terry Simons <email@hidden>)
 >Re: Question about building Universal Binaries in Leopard with transient <Xcode directory> (From: Chris Hanson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.