Xcode, Snow Leopard 64-bit, gcc-4.2, and linking errors (Oh my!)

10 views
Skip to first unread message

basicth...@gmail.com

unread,
Sep 15, 2009, 4:39:48 PM9/15/09
to Minnesota CocoaHeads
I'm attempting to compile LDAPManager on 10.6/64-bit. Code is in cvs
on sourceforge:

$ cvs -z3 -d:pserver:anon...@ldapmanager.cvs.sourceforge.net:/
cvsroot/ldapmanager co -P modulename

I'm getting an "Undefined symbols" linker issue. I come from a linux/
command line background and all the techniques I'd use there seem too
work under Xcode, but I still cannot resolve the linker problems.
Applying my linux knowledge to Xcode, I got the following:

Details regarding the command line:

Ld build/Development/LDAPManager.app/Contents/MacOS/LDAPManager normal
x86_64
cd /Users/tanner/projects/xcode/ldapmanager
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/
MacOSX10.6.sdk -L/Users/tanner/projects/xcode/ldapmanager/build/
Development -L/Users/tanner/projects/xcode/ldapmanager/build/
Development -F/Users/tanner/projects/xcode/ldapmanager/build/
Development -F/Developer/SDKs/MacOSX10.6.sdk/System/Library/
PrivateFrameworks -filelist /Users/tanner/projects/xcode/ldapmanager/
build/LDAPManager.build/Development/LDAPManager.build/Objects-normal/
x86_64/LDAPManager.LinkFileList -mmacosx-version-min=10.6 -framework
LDAP -framework Security -framework Cocoa -framework Foundation -
framework AppKit -framework ExceptionHandling -framework Kerberos -
framework DirectoryService -framework System -framework OpenDirectory -
lcrypto -lssl -lsasl2 -llutil -lldap -llber -prebind -o /Users/tanner/
projects/xcode/ldapmanager/build/Development/LDAPManager.app/Contents/
MacOS/LDAPManager

Undefined symbols:
"_ldap_charray_add", referenced from:
_interaction in liblutil.a(sasl.o)
"_ldap_charray_free", referenced from:
_lutil_sasl_freedefs in liblutil.a(sasl.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

ldap_charray_add() and ldap_charray_free() are both defined in libldap/
charray.c

Looking in build/Development, I see libldap.a, checking if charray.o
is in libldap.a?

$ ar -t libldap.a | grep charray
charray.o

Is there a way to do something similar inside of Xcode?

Ok, charray.o is in libldap.a are the symbols ldap_charray_add and
ldap_charray_free in the charray.o?

Extract charray.o from libldap.a:

$ ar -x libldap.a charray.o

Look for my symbols?

$ nm charray.o | grep ldap_charray_add
0000000000000000 T _ldap_charray_add
0000000000001588 S _ldap_charray_add.eh

$ nm charray.o | grep ldap_charray_free
00000000000002f3 T _ldap_charray_free
00000000000015e8 S _ldap_charray_free.eh

Make sure charray.o is 64-bit?

$ file charray.o
charray.o: Mach-O 64-bit object x86_64

So I'm stuck. Any advise on how to further troubleshoot this issue?

Thanks.
Reply all
Reply to author
Forward
0 new messages