Monday, March 1, 2010

Compile Boost and VXL with Intel Linux C++ compiler 11.0

Recently I started to evaluate the performance of a few compilers. Among them, Intel C++ compiler is certainly one of interests as it was often reported to result in 2x or greater performance gain.

After installation of the evaluation copy, first thing was to compile VXL, which was reasonable experience but not completely smooth. I found out that in addition to providing the C and C++ compiler commands, I also need to specify the Intel version of ar command before cmake is run for the first time. I tried to make this modification by editing CMakeCache.txt, but the Make files seem to be stuck with the original ar command. Here is a simple cache file I supply:

//Path to a program.
CMAKE_AR:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/xiar

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/icpc

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=-xhost -ipo

//C compiler.
CMAKE_C_COMPILER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/icc

//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING=-xhost -ipo

//Path to a program.
CMAKE_LINKER:FILEPATH=/software/intel/Compiler/11.1/069/bin/intel64/xild

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=-ipo
Boost is the second software to compile. I did a bit research online about how to tell bjam to find the necessary tools. These are the information I found:
This is the content of tools/build/v2/user-config.jam:
using intel-linux : 11.1 : /software/intel/Compiler/11.1/069/bin/intel64/icpc : -xhost
With this bjam command line:
bjam --build-dir=/tmp/build-boost-64 variant=release threading=multi link=static cxxflags="-xhost -fPIC" cflags="-xhost -fPIC" --prefix=/software/boost-1_42_0-intel --libdir=/software/boost-1_42_0-intel/lib64 install

Wednesday, February 24, 2010

VeriSign Code Signing for Windows executables

It is quite chaotic to sign software with VeriSign's "myprivatekey.pvk" and "mycredentials.spc".   First, I was trying to follow the Code Signing Support document by VeriSign.  But it is very much out of date!

After looking at "Code Signing with CodeSign" and this forum post of "How to sign EXE using signtool with Verisign SPC and PVK on the command line",  I found a solution:

1. Create  a sigle .pfx certificate that contains both private and public keys:
pvk2pfx  -pvk myprivatekey.pvk -spc mycredentials.spc -pfx  mypair.pfx

2. Sign the executable with the command (I am using BASH shell in Cygwin):
signtool.exe sign \
  /f mypair.pfx /v  \
  /sha1 F.....178   \
  /du http://www.i2align.com /t http://timestamp.verisign.com/scripts/timstamp.dll  $@

This solution works with Windows SDK 6.1, 7.0a, and 7.0.