Static libraries using modules cause warnings ("Could not resolve external type", "*.pcm: No such file or directory")
| Originator: | feedback.tagher | ||
| Number: | rdar://22978324 | Date Originated: | 05-Oct-2015 |
| Status: | Duplicate of 23893301 (Open) | Resolved: | |
| Product: | Developer Tools (Xcode) | Product Version: | 7.0.1 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Static libraries built using modules (e.g. "@import StoreKit"), even with CLANG_ENABLE_MODULE_DEBUGGING set to false, cause warnings when used on another developer's computer. This issue is described on this apple forum thread: https://forums.developer.apple.com/message/54432#65465
These are the types of warnings caused:
while processing /Users/monroe/dev/ios-example-app/libStaticLibraryTest.a(StaticLibraryTest.o):
warning: /Users/Max/Library/Developer/Xcode/DerivedData/ModuleCache/1FI596T6DYYKL/AdSupport-N94D31PLFESQ.pcm: No such file or directory
while processing /Users/monroe/dev/ios-example-app/libStaticLibraryTest.a(StaticLibraryTest.o):
warning: /Users/Max/Library/Developer/Xcode/DerivedData/ModuleCache/1FI596T6DYYKL/AdSupport-N94D31PLFESQ.pcm: No object file for requested architecture
(null): warning: Could not resolve external type c:objc(cs)NSPredicate
Steps to Reproduce:
Option a): Build a static library from the attached "StaticLibraryTest" project and skip to step 4.
Option b): Follow the steps below to reproduce from scratch:
1. Create a new Xcode project using the Cocoa Touch Static Library framework
2. Use a module in the project (I @imported StoreKit and used it in a method)
3. Set CLANG_ENABLE_MODULE_DEBUGGING to NO.
3. Follow the instructions here on creating a universal binary (one with i386 and ARM code) http://stackoverflow.com/a/3647187/1176156. This consists of:
3.1. Set "Build Active Architecture Only" to NO
3.2. Set the public headers directory to "Headers"
3.3. Add new Run Script Build Phase. Paste in this script: https://gist.github.com/MaxGabriel/95f7b03f16b2de1a11cc
4. Set current scheme to "Release" and build the project. The built library is attached as "StaticLib.zip"
5. From a different computer (I could not reproduce on my own computer), create a new project and copy the universal library and header files in from the Derived Data folder.
6. Import that library and reference it
Expected Results:
The new project builds without warnings
Actual Results:
The project has a huge number of warnings related to .pcm files, or not being able to "resolve external type"s.
Version:
Xcode 7.0.1
Notes:
Many developers are reporting this problem here: https://forums.developer.apple.com/message/54432#65465
Configuration:
Attachments:
'StaticLibraryTest.zip' and 'StaticLib.zip' were successfully uploaded.
===================================================
Followup message:
If you then disable modules, and replace any @imports with #import <framework>, then the warnings disappear. Attached is the static library built without modules.
'NoModules.zip' was successfully uploaded.
======
Attachments:
https://s3.amazonaws.com/hz-public-assets/public-assets/StaticLib.zip
https://s3.amazonaws.com/hz-public-assets/public-assets/StaticLibraryTest.zip
https://s3.amazonaws.com/hz-public-assets/public-assets/NoModules.zip
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!