Bug 11048 - ccache fails when using "-fmodules" flag and armv7
Summary: ccache fails when using "-fmodules" flag and armv7
Status: CLOSED FIXED
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.2.1
Hardware: All Mac OS X
: P5 normal
Target Milestone: 3.2.2
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-12 21:59 UTC by Tom Hughes
Modified: 2016-08-27 20:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hughes 2015-01-12 21:59:02 UTC
Given the following objective-c file (call it example.m):

#import <Foundation/Foundation.h>

int main( int argc, const char *argv[] ) {
    NSLog (@"Hello world!");
    return 0;
}

Compiling with clang works fine:
clang -arch armv7 -fmodules -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk  example.m -c -o example.o

Adding ccache fails:
ccache clang -arch armv7 -fmodules -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk  example.m -c -o example.o

While building module 'Foundation' imported from example.m:1:
While building module 'CoreFoundation' imported from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Darwin' imported from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:
In file included from <module-includes>:1:
/usr/include/sys/cdefs.h:680:2: error: Unsupported architecture
#error Unsupported architecture
 ^
While building module 'Foundation' imported from example.m:1:
While building module 'CoreFoundation' imported from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Darwin' imported from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:
In file included from <module-includes>:3:
In file included from /usr/include/ctype.h:70:
In file included from /usr/include/runetype.h:42:
In file included from /usr/include/_types.h:27:
In file included from /usr/include/sys/_types.h:33:
/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
 ^

Removing the "-fmodules" flag and compiling with ccache works:
ccache clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk  example.m -c -o example.o
Comment 1 Joel Rosdahl 2015-03-08 16:09:25 UTC
Fixed in 8955f497f3e91a935a100dc62a8eb92914546035 (by disabling ccache if -fmodules is used).
Comment 2 Joel Rosdahl 2015-05-10 12:32:38 UTC
Included in v3.2.2.
Comment 3 Piotr Wach 2016-08-27 20:49:36 UTC
I have managed to fix support for modules in this PR if you are still interested: https://github.com/ccache/ccache/pull/126