• 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
Re: xcode-users digest, Vol 1 #70 - 15 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xcode-users digest, Vol 1 #70 - 15 msgs


  • Subject: Re: xcode-users digest, Vol 1 #70 - 15 msgs
  • From: Eric Albert <email@hidden>
  • Date: Thu, 13 Nov 2003 22:46:13 -0800

At 9:57 AM -0500 11/12/03, Mike Pinkerton wrote:
email@hidden wrote on 11/11/03, 10:47 PM:

 > > I've set the CFLAGS and LDFLAGS environments like this:
 > > setenv CFLAGS "-I/Developer/SDKs/MacOSX10.2.7.sdk/usr/include -O2
 > > -mdynamic-no-pic -nostdinc"
 > > setenv LDFLAGS "-L/Developer/SDKs/MacOSX10.2.7.sdk/usr/lib"
 >
 > Some more information I forgot to include...
 >
 > First, I forgot I also set these variables before building:
 > setenv MACOSX_DEPLOYMENT_TARGET "10.2"
 > setenv NEXT_ROOT "/Developer/SDKs/MacOSX10.2.7.sdk"
 >
 > Also, the linker error I'm specifically getting is...
 >
 > ld: Undefined symbols:
 > _poll
 > _stpcpy

We have a similar problem building mozilla (and doing the
above-mentioned steps), but at final link we get

mach_host_self()
host_info(unsigned, int, int*, unsigned*)

as undefined link errors. Anyone have any ideas?

Cool bug! This appears to be running afoul of the compiler's implicit wrapping of all /usr/include headers with 'extern "C"'. Prior to Panther, system headers didn't always do a great job of exporting their APIs as C. GCC implicitly exports anything in /usr/include as a C API, but CodeWarrior doesn't. If you look through various list and newsgroup archives, you'll see a lot of messages from CodeWarrior users who had trouble with the Mach headers from C++ code on Jaguar. It seems that GCC isn't recognizing the SDK headers as system headers, so you're running into the same problem there. The compiler thinks the functions are C++ APIs, so it links against the C++-name-mangled versions, but those don't exist at link time.


Until this is fixed, the workaround is to wrap all includes of Mach headers like this:
#ifdef __cplusplus
extern "C" {
#endif
#include <mach/mach.h>
#ifdef __cpluplus
}
#endif


This works for me with a test program in Xcode that calls mach_host_self() and uses the 10.2.7 SDK.

Hope this helps,
Eric
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: xcode-users digest, Vol 1 #70 - 15 msgs (From: "Mike Pinkerton" <email@hidden>)

  • Prev by Date: Re: Linking w/SDKs from the command line
  • Next by Date: Re: porting code from project builder to xcode
  • Previous by thread: Re: xcode-users digest, Vol 1 #70 - 15 msgs
  • Next by thread: Templates and static variables and optimization
  • Index(es):
    • Date
    • Thread