Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7780 Discussions

Static library in XCode with intel compiler fails to build

rsharadh
Beginner
254 Views
I have a simple xcode project that I amtrying to compile with intel compiler 11.1/084
"include/sample.h"

#include

#include

voidcrump(void);

"src/sample.cpp"

#include"sample.h"

usingnamespacestd;

voidcrump(void)

{

cout<<"in crump now"<

}

In xcode, I set the proper search paths for the header files in the "search paths" sections. I noticed that I had to set the C++ compiler in two places one in the project settings and another in the Target-Rules settings (by adding a new rule to build C++ files with Intel Compiler 11.1).
I am able to build this as a static from command line by calls to icpc and ar ...but not within xcode. Can somebody please help?
I get the following message:

Build testIPPStatic of project testIPPStatic with configuration Debug

Libtool build/Debug/libtestIPPStatic.a normal i386

cd /Users/sharadh/Documents/testIPPStatic

setenv MACOSX_DEPLOYMENT_TARGET 10.6

/Developer/usr/local/bin/icc-11.1-base/bin/intel64/icpc -arch i386 -syslibroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/sharadh/Documents/testIPPStatic/build/Debug -filelist /Users/sharadh/Documents/testIPPStatic/build/testIPPStatic.build/Debug/testIPPStatic.build/Objects-normal/i386/testIPPStatic.LinkFileList -staticlib -o /Users/sharadh/Documents/testIPPStatic/build/Debug/libtestIPPStatic.a

xilibtool: executing 'libtool'

libtool: unknown option character `n' in: -no_compact_unwind

Usage: libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]

Usage: libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load]

Command /Developer/usr/local/bin/icc-11.1-base/bin/intel64/icpc failed with exit code 1

0 Kudos
3 Replies
Quoc-An_L_Intel
Moderator
254 Views

This is a bug. The compiler added the option -Wl,-no_compact_unwind by default to resolve the problem reported here:

http://software.intel.com/en-us/forums/showthread.php?t=69895

Unfortunate, libtool does not support this option. I have reported a bug on this issue. ID DPD200151036 for your reference.

In the mean time, you mentioned that you were able build this as a static from command line by calls to icpc and ar. One work around you could try in Xcode is to add a new build phase to your target,

Select target -> Project -> New Build Phase -> New Run Script Build Phase -> enter script "ar command that you used from the command line".

rsharadh
Beginner
254 Views

Thanks a lot, esp. for the quickness of your response ... at least for this dummy program I got the static library built and linked against it .... hopefully I can do the same for the big project!

Sharadh

Quoc-An_L_Intel
Moderator
254 Views

Another workaround that might be easier is to add the complete libtool command line with out the -no_compact_unwind option to the custom build phase. You can get the complete libtool command line by addingthe option -v to the command line options inXcode.

icpc -v -staticlib test1.cpp test2.cpp will give you something like this:

....

xilibtool: executing 'libtool'

libtool \ (you need the libtool command from here).

-static \

-arch_only \

x86_64 \

-no_compact_unwind \ (Remove this when you add it to the custom build phase).

-o \

a.out \

/tmp/icpc0ZXHCP.o \

/tmp/icpciR7qMm.o \

-L/opt/intel/Compiler/11.1/084/lib \

-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64/ \

-L/usr/lib/i686-apple-darwin10/4.2.1/ \

-L/usr/lib/ \

-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 \

-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/ \

-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1/ \

-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. \

/opt/intel/Compiler/11.1/084/lib/libimf.a \

/opt/intel/Compiler/11.1/084/lib/libsvml.a \

/opt/intel/Compiler/11.1/084/lib/libipgo.a \

/opt/intel/Compiler/11.1/084/lib/libdecimal.a \

/opt/intel/Compiler/11.1/084/lib/libirc.a

Reply