Le 20 avr. 08 à 15:19, Jerry Krinock a écrit : On 2008 Apr, 20, at 2:55, Jean-Daniel Dupas wrote:
The -U has not the same meaning when passed to gcc than when passed to ld. It should probably be -Wl,-U instead
I understand that the -Wl, prefix is used when passing arguments to gcc that you want forwarded to ld. Since I am entering these options into the "Other Linker Flags" setting directly, I thought that Xcode would pass them directly to ld and therefore the -Wl, would not be needed. Indeed, if you look at my build transcript below, you see that it is the call to Ld which is getting the -U option. So, it is being passed to ld and not gcc.
Read again the transcript:
The first line is just an human readable representation of what Xcode is going to do. The second line is a call to cd to change the current directory. The third line is the real tool invocation.
/Developer/usr/bin/gcc-4.0 -o …
Xcode call gcc-4.0, it does not call ld directly.
I tried adding the -Wl, prefix to each -U anyhow, then got errors such as: ".objc_class_name_Store: No such file or directory". It thinks that my symbol name is supposed to be a path. So, -Wl, does not seem to be the answer.
I'm not a -Wl expert, but I think it can pass only one argument at a time. Try this as other linker flags:
-Wl,-U -Wl,.objc_class_name_NonhierarchicalStore -Wl,-U -Wl,.objc_class_name_Store -Wl,-U -Wl,.objc_class_name_Browfile
If someone knows a better way to pass arguments to the linker, I will be happy to know it.
But you may also use "-undefined dynamic_lookup" that should be accepted by gcc directly.
I tried that but had other issues, which I'd rather not pollute this thread with. I prefer -U to "-undefined dynamic_lookup" because the latter would turn off symbol checking for all symbols instead of just the three that I know are OK. I would like ld to check as much as possible.
Thank you, Jean-Daniel, but I am still confused.
Jerry
Le 20 avr. 08 à 03:47, Jerry Krinock a écrit :
I'm building a Bundle project with Xcode 3.0. If you look near the end of the arguments to Ld in the Build Transcript below, you'll see that I've used the -U option to name three symbols that are undefined at this time and should be linked dynamically at runtime. (They exist in the main executable, which does not yet exist after a Clean, since this dependent Bundle is built first.) But Ld ignores my intentions and declares errors on these three undefined symbols anyhow. What's wrong?
Ld /private/tmp/BmTiger.build/Release/BmTiger.build/Objects-normal/ppc/BmTiger normal ppc
cd /Users/jk/Documents/Programming/Projects/Bookdog/BmTiger
/Developer/usr/bin/gcc-4.0 -o /private/tmp/BmTiger.build/Release/BmTiger.build/Objects-normal/ppc/BmTiger -L/Users/jk/Documents/Programming/Builds/Release -F/Users/jk/Documents/Programming/Builds/Release -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Release -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Debug -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Debug -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Release -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Debug -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Release -F/Users/jk/Documents/Programming/Projects/Bookdog/BmTiger/../../../Builds/Release -filelist /private/tmp/BmTiger.build/Release/BmTiger.build/Objects-normal/ppc/BmTiger.LinkFileList -framework Cocoa -framework SSAlert -framework SSApp -framework SSSQLiter -framework BmStuff -arch ppc -bundle -mmacosx-version-min=10.4 -Wl,-dead_strip -U .objc_class_name_NonhierarchicalStore -U .objc_class_name_Store -U .objc_class_name_Browfile -isysroot /Developer/SDKs/MacOSX10.4u.sdk
Undefined symbols:
".objc_class_name_NonhierarchicalStore", referenced from:
.objc_class_name_DeliciousStore in DeliciousStore.o
".objc_class_name_Store", referenced from:
.objc_class_name_ShiiraStore in ShiiraStore.o
.objc_class_name_Firefox3Store in Firefox3Store.o
".objc_class_name_Browfile", referenced from:
literal-pointer@__OBJC@__cls_refs@Browfile in DeliciousTalker.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
|