• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Xcode 2.5 on Leopard: trouble with -isysroot and friends
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Xcode 2.5 on Leopard: trouble with -isysroot and friends


  • Subject: Xcode 2.5 on Leopard: trouble with -isysroot and friends
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 21 May 2008 12:20:43 -0500

Hi,

I need to use Xcode 2.5 and its build tools (gcc, etc.) on Leopard. I'm working with makefile-type building, rather than an Xcode project. I have added the directories /Xcode2.5/usr/bin and /Xcode2.5/ usr/sbin early in my PATH so they are found before /usr/bin and /usr/ sbin.

I am aware that when using Xcode 2.5 on Leopard, one must use the 10.4u SDK that is in the /Xcode2.5 directory, and I'm doing that.

During the run of the configure script, I'm getting link errors that seem like bugs. Here's an example:


-------------------------------------
$ gcc -isysroot /Xcode2.5/SDKs/MacOSX10.4u.sdk -mmacosx-version- min=10.4 -o conftest -g -O2 -I/Users/ken/work/cxmac/x11r6/image/X11/ include conftest.c -lXcursor -L/Users/ken/work/cxmac/x11r6/image/X11/ lib -lXext -lX11 -lAppleWM
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Xcode2.5/SDKs/MacOSX10.4u.sdk/Users/ken/ work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib referenced from: / Users/ken/work/cxmac/x11r6/image/X11/lib/libXcursor.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_XRenderCreateAnimCursor referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderCreateCursor referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderCreatePicture referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderFindStandardFormat referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderFreePicture referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderQueryExtension referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderQueryVersion referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
collect2: ld returned 1 exit status
-------------------------------------



As you can see, I'm specifying the SDK using -isysroot. In this case, the command is attempting to link against my own custom X11 libraries. The Xcursor library is located. It has the following dependencies:


$ otool -L /Users/ken/work/cxmac/x11r6/image/X11/lib/libXcursor.dylib
/Users/ken/work/cxmac/x11r6/image/X11/lib/libXcursor.dylib:
/Users/ken/work/cxmac/x11r6/image/X11/lib/libXcursor.1.dylib (compatibility version 1.0.2, current version 1.0.2)
/Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib (compatibility version 1.2.2, current version 1.2.2)
/Users/ken/work/cxmac/x11r6/image/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/Users/ken/work/cxmac/x11r6/image/X11/lib/libX11.6.dylib (compatibility version 9.0.0, current version 9.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9)


So, Xcursor depends on Xrender, which is in the same location. However, it seems that gcc/collect2/ld (or whatever) is inappropriately applying the SDK root to paths which are not present in the SDK. In this case, it's transforming the path "/Users/ken/work/ cxmac/x11r6/image/X11/lib/libXrender.1.dylib" into "/Xcode2.5/SDKs/ MacOSX10.4u.sdk/Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender. 1.dylib". Note that it's only applying the SDK root to the dependencies. It's having no trouble finding the Xcursor library which is explicitly passed on the command line. So, given two similarly-constructed paths, it's handling them differently.

I can reproduce essentially the same problem using Xcode 2.5 on Tiger (although in that case the SDK in based in /Developer rather than / Xcode2.5). The problem does _not_ surface when using Xcode 3.0 and - isysroot. As expected, there's no problem using any combination of Xcode version and OS when not using -isysroot.


Why is this happening and is there a workaround? Xcode 2.5 on Leopard seems severely crippled by this limitation (since it can't be used without -isysroot). Any help would be much appreciated.


Thanks,
Ken


P.S. The conftest.c file is dead simple. (Note, it's machine- generated and it's not supposed to be a working program. It's just for testing if the library can be linked and will satisfy the undefined symbol.) Here it is:


-------------------------------------
char XcursorImageLoadCursor ();
int
main ()
{
return XcursorImageLoadCursor ();
  ;
  return 0;
}
-------------------------------------

Adding -v to the gcc command gives the following verbose output, although it isn't enlightening about why the SDK root is being (mis)used for the library dependency:

-------------------------------------
$ gcc -v -isysroot /Xcode2.5/SDKs/MacOSX10.4u.sdk -mmacosx-version- min=10.4 -o conftest -g -O2 -I/Users/ken/work/cxmac/x11r6/image/X11/ include conftest.c -lXcursor -L/Users/ken/work/cxmac/x11r6/image/X11/ lib -lXext -lX11 -lAppleWM
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable- checking -enable-werror --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/ $/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/ lib --build=powerpc-apple-darwin8 --with-arch=nocona --with- tune=generic --program-prefix= --host=i686-apple-darwin8 --target=i686- apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/cc1 -quiet -v -I/Users/ken/work/cxmac/x11r6/image/X11/include -iprefix /Xcode2.5/ usr/bin/../lib/gcc/i686-apple-darwin8/4.0.1/ -D__DYNAMIC__ -isysroot / Xcode2.5/SDKs/MacOSX10.4u.sdk conftest.c -feliminate-unused-debug- symbols -fPIC -quiet -dumpbase conftest.c -mmacosx-version-min=10.4 - march=nocona -auxbase conftest -g -O2 -version -o /var/folders/bK/ bKpWvwx7F3iYS+6cPg+gCE+++TM/-Tmp-//ccVmb6Jq.s
ignoring nonexistent directory "/Xcode2.5/SDKs/MacOSX10.4u.sdk/usr/ local/include"
ignoring nonexistent directory "/Xcode2.5/SDKs/MacOSX10.4u.sdk/usr/lib/ gcc/i686-apple-darwin8/4.0.1/../../../../i686-apple-darwin8/include"
#include "..." search starts here:
#include <...> search starts here:
/Users/ken/work/cxmac/x11r6/image/X11/include
/Xcode2.5/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/ include
/Xcode2.5/SDKs/MacOSX10.4u.sdk/usr/include
/Xcode2.5/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks
/Xcode2.5/SDKs/MacOSX10.4u.sdk/Library/Frameworks
End of search list.
GNU C version 4.0.1 (Apple Computer, Inc. build 5370) (i686-apple- darwin8)
compiled by GNU C version 4.0.1 (Apple Computer, Inc. build 5370).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min- heapsize=131072
Compiler executable checksum: 76e7f97f644e9f04d0c1846d01d29b15
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/as -arch i386 -force_cpusubtype_ALL -o /var/folders/bK/bKpWvwx7F3iYS+6cPg+gCE++ +TM/-Tmp-//ccgzrbI2.o /var/folders/bK/bKpWvwx7F3iYS+6cPg+gCE+++TM/- Tmp-//ccVmb6Jq.s
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/collect2 - dynamic -arch i386 -macosx_version_min 10.4 -syslibroot /Xcode2.5/SDKs/ MacOSX10.4u.sdk -weak_reference_mismatches non-weak -o conftest - lcrt1.o -L/Users/ken/work/cxmac/x11r6/image/X11/lib -L/Xcode2.5/usr/ bin/../lib/gcc/i686-apple-darwin8/4.0.1 -L/Xcode2.5/usr/bin/../lib/gcc -L/Xcode2.5/usr/bin/../lib/gcc/i686-apple-darwin8/4.0.1/../../.. -L/ usr/lib/gcc/.. /var/folders/bK/bKpWvwx7F3iYS+6cPg+gCE+++TM/-Tmp-// ccgzrbI2.o -lXcursor -lXext -lX11 -lAppleWM -lgcc_s.10.4 -lgcc -lSystem
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Xcode2.5/SDKs/MacOSX10.4u.sdk/Users/ken/ work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib referenced from: / Users/ken/work/cxmac/x11r6/image/X11/lib/libXcursor.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/Xcode2.5/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_XRenderCreateAnimCursor referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderCreateCursor referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderCreatePicture referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderFindStandardFormat referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderFreePicture referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderQueryExtension referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
_XRenderQueryVersion referenced from libXcursor expected to be defined in /Users/ken/work/cxmac/x11r6/image/X11/lib/libXrender.1.dylib
collect2: ld returned 1 exit status
-------------------------------------


_______________________________________________
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


  • Follow-Ups:
    • Re: Xcode 2.5 on Leopard: trouble with -isysroot and friends
      • From: Chris Espinosa <email@hidden>
  • Prev by Date: Re: The Xcode 'Preprocess' option - what is it actually doing?
  • Next by Date: Re: Xcode Projects use each other's Breakpoints
  • Previous by thread: Re: Xcode Projects use each other's Breakpoints
  • Next by thread: Re: Xcode 2.5 on Leopard: trouble with -isysroot and friends
  • Index(es):
    • Date
    • Thread