apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Brashears <aar...@lindenlab.com>
Subject Re: Unresolved symbol for fprintf
Date Sat, 06 Jan 2007 00:46:52 GMT

On 2007 Jan 5, at 14:06, Paul Querna wrote:
> Aaron Brashears wrote:
>> I am having a problem using apr with gcc 4.0.1 on mac osx. When I
>> compile apr-1.2.8, getopt.o contains this reference in the symbol  
>> table:
>>
>>          U _fprintf$LDBLStub
>>
>>
>> When linking my application, xcode reports that it cannot find that
>> symbol and the link fails. So, I switched gcc to 3.3 and rebuilt apr.
>> Looking at the symbols in getopt.o, it exports:
>>
>>          U _fprintf
>>
>> It seems unusual that gcc 4.0 would generate a symbol which it cannot
>> link to later. The application I am building is using xcode, gcc 4.0,
>> and linking to the standard c libraries shipped with it including the
>> 10.3.9 compatibility libraries.
>>
>> I would like to build apr with gcc 4.0. Does anyone know how to
>> accomplish this?
>>
>
> It works great for me on 10.4... And I don't remember ever seeing that
> problem on 10.3.
>
> Is this with the latest xcode 2.4.1?
>
> On my 10.4.8, the dylib shows fprintf like it should:
>          U _fprintf
>
> -Paul

The configure we use is:

./configure --disable-shared --disable-lfs

so we are only looking at the static apr lib. This is on 10.4.8 with  
xcode 2.4.1 with gcc 4.0.1 build 5367. We are not using xcoode to  
build apr, since the configure/make path is simple enough.


I dug through the system header files and found this in /usr/include/ 
stdio.h:

int	 fprintf(FILE * __restrict, const char * __restrict, ...)  
__DARWIN_LDBL_COMPAT(fprintf);


Digging deeper, this is defined in /usr/include/sys/cdefs.h as:

#if defined(__ppc__)
#  if defined(__LDBL_MANT_DIG__) && defined(__DBL_MANT_DIG__) && \
	__LDBL_MANT_DIG__ > __DBL_MANT_DIG__
#    if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1040
#      define	__DARWIN_LDBL_COMPAT(x)	__asm("_" __STRING(x) "$LDBLStub")
...


Further investigation turned up this technical note from Apple:

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

So, when building on ppc osx, I tried using the command:

CFLAGS="-isysroot /Developer/SDKs/MacOSX10.3.9.sdk" ./configure -- 
disable-shared --disable-lfs --prefix=/tmp/apr


Sadly, this causes configure to fail:

checking uuid/uuid.h usability... no
checking uuid/uuid.h presence... yes
configure: WARNING: uuid/uuid.h: present but cannot be compiled
configure: WARNING: uuid/uuid.h:     check for missing prerequisite  
headers?
configure: WARNING: uuid/uuid.h: see the Autoconf documentation
configure: WARNING: uuid/uuid.h:     section "Present But Cannot Be  
Compiled"
configure: WARNING: uuid/uuid.h: proceeding with the preprocessor's  
result
configure: WARNING: uuid/uuid.h: in the future, the compiler will  
take precedence
configure: WARNING:     ## ------------------------------------------ ##
configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
configure: WARNING:     ## ------------------------------------------ ##

and then misc/rand.c fails to compile on an attempt to include uuid.h.

/bin/sh /Users/aaronb/tmp/apr-1.2.8/libtool --silent --mode=compile  
gcc   -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -DHAVE_CONFIG_H - 
DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp   -I./include - 
I/Users/aaronb/tmp/apr-1.2.8/include/arch/unix -I./include/arch/unix - 
I/Users/aaronb/tmp/apr-1.2.8/include  -o misc/unix/rand.lo -c misc/ 
unix/rand.c && touch misc/unix/rand.lo
misc/unix/rand.c:41:23: error: uuid/uuid.h: No such file or directory
make[1]: *** [misc/unix/rand.lo] Error 1
make: *** [all-recursive] Error 1

I am at a bit of a loss for how to get this to work. Any further  
suggestions?







Mime
View raw message