Monika
Monika

Reputation: 31

Missing Library link error when doing Product > Build For Archiving in Xcode 4

I have an iPhone app that relies on two static libraries

When doing Project > Build For Running and then Project > Run there are no errors and the app runs as expected on my iPhone.

When doing Project > Build For Archiving I get a link error for one of the libraries but not for the other ld: library not found for -lConcordeLib

When I look on the file system at the created *.a files I see:

Release-iphoneos/ConcordeLib.build/Objects-normal/armv6/libConcordeLib.a
Release-iphoneos/ConcordeLib.build/Objects-normal/armv7/libConcordeLib.a
Release-iphoneos/QSoptLib.build/Objects-normal/armv6/libQSoptLib.a
Release-iphoneos/QSoptLib.build/Objects-normal/armv7/libQSoptLib.a
Release-iphoneos/libConcordeLib.a
Release-iphoneos/libQSoptLib.a

in the DerivedData directory for the compile. This looks exactly like the files generated when doing the successful Project > Build For Running, which generates the same files under Debug-iphoneos.

I cleaned the Derived Data out, stopped and restarted XCode and still get the same error.

Upvotes: 1

Views: 1918

Answers (1)

Monika
Monika

Reputation: 31

I carefully looked at the ld command and saw that it generated files under .../Build/Intermediates/NavConcorde.build/AdHoc-iphoneos/. The AdHoc profile did in fact not exist anymore, so it is not surprising that there was an error. I have not clue why this manifested itself as a link error though. The libraries under Debug and Release must have hung around from another compile.

Going to Product > Edit Scheme and setting the profile to use the existing Distribution Profile solved the link error.

Upvotes: 2

Related Questions