[LLVMbugs] [Bug 21626] New: clang failed to compile Objective-C++ code with -fmodules

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 21 00:42:37 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21626

            Bug ID: 21626
           Summary: clang failed to compile Objective-C++ code with
                    -fmodules
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 191919 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang svn (clang version 3.6.0 (trunk 222512)) failed to compile the following
trivial code when compiling it as Objective-C++ code:

```
#import <Cocoa/Cocoa.h>

int main() {
}
```

The command line to compile it was:

$ /opt/bin/clang++ -fmodules -c -o m m.mm

It gave a huge bunch of error messages:

```
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreFoundation' imported from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In file included from <module-includes>:1:
In file included from /usr/include/dispatch/dispatch.h:52:
/usr/include/dispatch/queue.h:368:1: error: import of C++ module
'Darwin.sys.qos' appears within extern "C" language linkage specification
#include <sys/qos.h>
^
/usr/include/dispatch/queue.h:69:1: note: extern "C" language linkage
specification begins here
__BEGIN_DECLS
^
/usr/include/sys/cdefs.h:71:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS   extern "C" {
                        ^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreFoundation' imported from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55:
In file included from
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13:
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:10:
fatal error: could not build module 'Dispatch'
#include <dispatch/dispatch.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from <module-includes>:1:
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:10:
In file included from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h:11:
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:9:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFDictionary.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
While building module 'IOKit' imported from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:8:
In file included from <module-includes>:2:
/System/Library/Frameworks/IOKit.framework/Headers/IODataQueueClient.h:30:1:
error: import of C++ module 'Darwin.Availability' appears within extern "C"
      language linkage specification
#include <AvailabilityMacros.h>
^
/System/Library/Frameworks/IOKit.framework/Headers/IODataQueueClient.h:29:1:
note: extern "C" language linkage specification begins here
__BEGIN_DECLS
^
/usr/include/sys/cdefs.h:71:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS   extern "C" {
                        ^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
While building module 'IOKit' imported from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:8:
While building module 'libkern' imported from
/System/Library/Frameworks/IOKit.framework/Headers/IODataQueueClient.h:31:
In file included from <module-includes>:3:
/usr/include/libkern/OSReturn.h:46:1: error: import of C++ module
'Darwin.Mach.error' appears within extern "C" language linkage specification
#include <mach/error.h>
^
/usr/include/libkern/OSReturn.h:44:1: note: extern "C" language linkage
specification begins here
__BEGIN_DECLS
^
/usr/include/sys/cdefs.h:71:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS   extern "C" {
                        ^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
While building module 'IOKit' imported from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:8:
In file included from <module-includes>:2:
/System/Library/Frameworks/IOKit.framework/Headers/IODataQueueClient.h:31:10:
fatal error: could not build module 'libkern'
#include <libkern/OSTypes.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
While building module 'IOSurface' imported from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:9:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/IOSurface.framework/Headers/IOSurface.h:12:
/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:29:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreGraphics' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:12:
While building module 'IOSurface' imported from
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:9:
While building module 'XPC' imported from
/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:30:
In file included from <module-includes>:1:
/usr/include/xpc/xpc.h:7:10: fatal error: could not build module 'Dispatch'
#include <dispatch/dispatch.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'Security' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/Security.framework/Headers/Security.h:44:
In file included from
/System/Library/Frameworks/Security.framework/Headers/oidsalg.h:29:
/System/Library/Frameworks/Security.framework/Headers/SecAsn1Types.h:42:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>              /* Boolean */
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:12:
In file included from <module-includes>:1:
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:12:
While building module 'DiskArbitration' imported from
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h:56:
In file included from <module-includes>:1:
/System/Library/Frameworks/DiskArbitration.framework/Headers/DiskArbitration.h:27:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'CoreServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:12:
While building module 'CFNetwork' imported from
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:31:
In file included from <module-includes>:1:
/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: fatal
error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'ApplicationServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:7:
In file included from <module-includes>:1:
/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23:10:
fatal error: could not build module 'CoreServices'
#include <CoreServices/CoreServices.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'ApplicationServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:7:
While building module 'CoreText' imported from
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/SFNTLayoutTypes.h:16:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Headers/CoreText.h:21:
In file included from
/System/Library/Frameworks/CoreText.framework/Headers/CTFont.h:21:
In file included from
/System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h:21:
/System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h:13:10:
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFNumber.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'Foundation' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
While building module 'ApplicationServices' imported from
/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:7:
While building module 'ImageIO' imported from
/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:47:
In file included from <module-includes>:1:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Headers/ImageIO.h:11:10:
fatal error: could not build module
      'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
In file included from <module-includes>:1:
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:9: fatal error:
could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'AppKit' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from <module-includes>:1:
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10:9: fatal error:
could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'AppKit' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
While building module 'QuartzCore' imported from
/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:36:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h:6:
In file included from
/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h:6:
In file included from
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:6:
/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:16:10: fatal
error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'AppKit' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
While building module 'QuartzCore' imported from
/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:36:
While building module 'CoreVideo' imported from
/System/Library/Frameworks/QuartzCore.framework/Headers/CAOpenGLLayer.h:7:
In file included from <module-includes>:1:
In file included from
/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:20:
In file included from
/System/Library/Frameworks/CoreVideo.framework/Headers/CVReturn.h:21:
/System/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h:51:10: fatal
error: could not build module 'CoreFoundation'
#include <CoreFoundation/CFBase.h>
 ~~~~~~~~^
While building module 'Cocoa' imported from m.mm:1:
While building module 'AppKit' imported from
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
While building module 'CoreData' imported from
/System/Library/Frameworks/AppKit.framework/Headers/NSPredicateEditorRowTemplate.h:12:
In file included from <module-includes>:1:
/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h:8:9: fatal
error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
m.mm:1:9: fatal error: could not build module 'Cocoa'
#import <Cocoa/Cocoa.h>
 ~~~~~~~^
22 errors generated.
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141121/16d24359/attachment.html>


More information about the llvm-bugs mailing list