Re: Undefined symbols: "_fputs$UNIX2003
Re: Undefined symbols: "_fputs$UNIX2003
- Subject: Re: Undefined symbols: "_fputs$UNIX2003
- From: Rick Altherr <email@hidden>
- Date: Wed, 5 Nov 2008 11:22:19 -0800
Setting -mmacosx-version-min=10.4 automatically sets
MACOSX_DEPLOYMENT_TARGET to 10.4, so that is redundant. That doesn't
set the SDK version, however.
There are 2 controls related to the OS versions you can run the
resulting binary on. -mmacosx-version-min sets the minimum OS X
version that the binary can be executed on. By setting it to 10.4,
you cannot expect the binary to work on 10.3 for example.
An SDK limits the APIs that you can use. If you use the 10.4 SDK, you
can only use APIs that were available in 10.4 and earlier.
Using a combination of these allows you to let your binary run on
older versions of OS X but use newer APIs if they are available. For
example, using the 10.5 SDK but setting -mmacosx-version-min=10.4
means your executable will run on 10.4 and APIs introduced in 10.5
will be weak-linked. Thus, your application can check if the
functions introduced in 10.5 are NULL which indicates they are not
available (i.e., the binary is executing on 104.).
Without an actual compiler invocation, it is difficult to say what is
happening, but if you are seeing $UNIX2003 functions, then it is
almost certainly that the -mmacosx-version-min=10.4 flag is being
dropped before the compiler is invoked.
Rick
On Nov 5, 2008, at 10:41 AM, Rich Collyer wrote:
I get that I need to build openssl against the 10.4 SDK, since that
is the SDK I am building the application against. However, I have
yet to find a compiler or lib flag that the build actually pays
attention to. For example, I have tried adding to the command lines
./Configure 386 darwin-i386-cc
make build_libs "CC=cc -arch i386 -DCK_GENERIC -I../crypto -I../"
-DMACOSX_DEPLOYMENT_TARGET=10.4
-mmacosx-version-min=10.4
-D_NONSTD_SOURCE
-U_POSIX_C_SOURCE
-U_XOPENSOURCE
-U_DARWIN_C_SOURCE
and various other flags, but the error continues (in XCode 3.1 only).
My solution for now is to not use XCode 3.1, but I am concerned that
either XCode 3.0 is in error by not reporting a serious problem, or
XCode 3.1 is in error. It would be great to know which is true.
+++++++++++++++++++++++
Rich Collyer
Senior Software Engineer
IronKey, Inc.
email@hidden
+++++++++++++++++++++++
On Nov 4, 2008, at 9:35 AM, Rich Collyer wrote:
What I have learned is that when I build openssl with XCode 3.0, it
contains a reference to _fputs$UNIX2003, but does not complain about
it when I statically link the libcrypto.a file with my application.
When I build openssl with XCode 3.1, it also contains a reference to
_fputs$UNIX2003, but does complain about it when I statically link
the libcrypto.a file with my application.
You need to build it for the same system SDK that your application
will be compiled against.
I read the Apple document "Symbol Variants: Why Those Dollar
Signs?", which was helpful in understanding what is happening, but
really difficult to understand how to fix the problem. I tried to
add a number of -U and -D flags to the build, but that seemed to
make matters worse.
Unless I misunderstand what you're saying, you're adding -D and -U to
the CPPFLAGS (or Xcode equivalent) which controls preprocessor defines
and undefines. I'm not sure what you're defining or undefining here,
but selecting the appropriate SDK will Do The Right Thing (tm) without
needing to set that.
What has changed that makes XCode 3.1 make this an error, when XCode
3.0 considers this OK. Is one of them just wrong? Is there an
update to the recommended scripts listed in the Apple Document
"Building an Open Source Universal Binary" that would ensure that
the library is built to work with 10.4 and beyond?
Without looking at this particular doc, I'd suggest that if you find
the documentation lacking, you should file a bug report on the
particular doc.
--
Steve Checkoway
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
This email sent to email@hidden
--
Rick Altherr
Architecture and Performance Group
email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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