Problem: Loader complains about an architecture mismatch between the project and a dynamic library:

/usr/bin/ld: warning
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libsndfile.1.0.17.dylib
cputype (18, architecture ppc) does not match cputype (7)
for specified -arch flag: i386 (file not loaded)

This error does not appear with the Debug build; only with the Release build. And I swear I never did an i386 build (why would I want to??).

Fix: Clean the project (both the Debug and Release). In the Project Settings, choose the Architectures setting and set it to “ppc i386″. Rebuild. Clean again. Now change the setting back to “ppc”. Rebuild. Success! — just don’t ask me why.

Follow-up [071110]: Mike V sent in the following info:

I had the same problem when linking “-arch i386″ while trying to link with ppc only dynamic library; I tried your sulution but still was getting i386 as a separate build.

I tried changing Project Settings -> Cross-Develop Using Target: from 10.4 (Universal) to Current Mac,it still gave me a list of undefined symbols i was able to pass a number of files that has been compiled.

What fixed the problem when i did

grep -R ‘i386′ my_pro..xcodeproj

and found the line with ARCH, which is also mentioned in here.

here is the line(s):


/* Release */ = {
isa = XCBuildConfiguration;
buildSettings = { ARCHS = (
ppc,
i386,
);

Removing/uncommenting i386 solves the problem!!! also if i comment it out xcode will remove the line afterwards by itself.

Apparently when i first open build options you have

Architectures set to “$(NATIVE_ARCH)”

Maybe what you can emphasize in your notes is that you need to double click these values NOT to enter them manually. e.g “ppc i386″ instead of “$(NATIVE_ARCH) i386″ which i have done, because it still displayed “ppc i386″ after i clicked to end editing the Architectures field.

I would highly recommend updatin this information for your tutorial (not that i’ve discovered it, just that i was quite frustraded and dont want this for other people) 8D

Thanks, Mike!