Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Compilation failed when using Xcode

$
0
0

I tried to compile my existing project with Intel C++ compiler 15 under Xcode 5.1. I installed the Xcode plugin and rebuilt my project, but I got the following error message and the compilation was failed.

In file included from <built-in>:181:<command line>:1:10: fatal error: '-c' file not found
#include "-c"
         ^
1 error generated.
problem occurred when compiling '/Users/xxx/NSColor+RBLCGColorAdditions.m' with the clang compiler (code 1)

I checked the compilation command line:

CompileICL Build/Intermediates/xxx.build/Release/xxx.build/Objects-normal/x86_64/NSColor+RBLCGColorAdditions.o xxx/NSColor+RBLCGColorAdditions.m
    cd "/Users/xxx"
    /usr/bin/icc-15.0 -x objective-c -arch x86_64 -dev-usr-root=/Applications/Xcode.app/Contents/Developer/usr -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7 -w1 -fpascal-strings -iquote /Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/xxx-generated-files.hmap -I/Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/xxx-own-target-headers.hmap -I/Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/xxx-all-target-headers.hmap -iquote /Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/xxx-project-headers.hmap -F/Users/xxx/Build/Products/Release -I/Users/xxx/Build/Products/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/xx/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/opt/tbb/include -I/Users/jh/box/folly -I/usr/local/include -include "" -c /Users/xxx/xxx/NSColor+RBLCGColorAdditions.m -o /Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/Objects-normal/x86_64/NSColor+RBLCGColorAdditions.o -MMD -MT dependencies -MF /Users/xxx/Build/Intermediates/xxx.build/Release/xxx.build/Objects-normal/x86_64/NSColor+RBLCGColorAdditions.d

As you could see, the switch `-include ""` was interpreted as `-include` and the next switch `-c` was interpreted as its argument.

I modified the xcspec file inside the plugin, commented out the following scripts:

1055             // Precompiled Headers
1056             //
1057             //  -- location sensitive (argument hashing) --
1058             //
1059             //{   Name = ICL_PREFIX_HEADER;
1060             //    Category = PrecompiledHeaders;
1061             //    Type = path;
1062             //    DefaultValue = "$(GCC_PREFIX_HEADER)";
1063             //    CommandLineArgs = { "" = ();  "<<otherwise>>" = (-include, "$(_icl_prefix_header_$(ICL_PRECOMPILE_PREFIX_HEADER))"); };
1064             //    AdditionalBuildSettings = {
1065             //        _icl_prefix_header_YES = "$(PrecompFilesDir)/$(ICL_PREFIX_HEADER:base)$(ICL_PREFIX_HEADER:suffix)";
1066             //        _icl_prefix_header_NO  = "$(ICL_PREFIX_HEADER)";
1067             //        };
1068             //    },  

Then clang accepted the command line, but the compilation failed again when compiling a .mm file:

clang: warning: argument unused during compilation: '-MMD'
In file included from /Users/xxx/XXDocument.mm:1:
In file included from /Users/xxx/XXDocument.h:2:
/Users/xxx/config.h:33:10: fatal error: 'array' file not found
#include <array>
         ^
1 error generated.
problem occurred when compiling '/Users/xxx/XXDocument.mm' with the clang compiler (code 1)
Command /usr/bin/icc-15.0 failed with exit code 1

I added "-std=gnu++11" in "Intel C++ Compiler 15.0 Command Line" -> "Additional C++ options", but it was not included in the actual command line. I have to replace it with <tr1/array>, but for other .cpp file which required to be C++11 code, this was invalid.

I also encountered thousands of codes complaining ARC:

/Users/xxx/XXDocument.h:50:42: note: property declared here
@property (weak) IBOutlet NSOutlineView *myOutlineView;
                                         ^
/Users/xxx/XXDocument.mm:67:1: error: @synthesize of 'weak' property is only allowed in ARC or GC mode
@implementation XXDocument
^
/Users/xxx/XXDocument.h:51:42: note: property declared here
@property (weak) IBOutlet NSPopUpButton *arcPopUpButton;
                                         ^
/Users/xxx/XXDocument.mm:67:1: error: @synthesize of 'weak' property is only allowed in ARC or GC mode
@implementation XXDocument
^
/Users/xxx/XXDocument.h:53:42: note: property declared here
@property (weak) IBOutlet NSSearchField *findSearchField;

Anyway, this was an unpleasant attempt of Xcode + Intel compiler. Please let me know how to compile a serious project, not a "Hello, world!" one in the labs.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>