GCC* 4.9 was released on April 22, 2014. This release now supports Version 4.0 of the OpenMP* specification for the C and C++ compilers. The interface between the compilers and the GCC OpenMP runtime library (libgomp) was changed as part of this development. As a result, code compiled by GCC 4.9 using the –fopenmp compiler option cannot be successfully linked with the Intel® OpenMP runtime library (libiomp5), even if it uses no new OpenMP 4.0 features. Linking may fail with a message such as “undefined reference to `GOMP_parallel'”, or (if both libiomp5.so and libgomp.so are linked in) linking may appear to succeed, but the executable code may crash at runtime since having two different OpenMP runtimes linked into the same process is fatal.
Intel is working to restore the ability to link OpenMP code compiled by GCC 4.9 with OpenMP code compiled by the Intel compilers. In the meantime, we recommend against using GCC 4.9 –fopenmp to compile code that you plan to link with anything containing Intel-compiled OpenMP code, including the Intel® Math Kernel Library (MKL) and Intel® Integrated Performance Primitives (IPP) performance libraries.
Update September 4, 2014:
The update #4 releases of Intel® C++ Composer XE 2013 SP1 and Intel® Fortran Composer XE 2013 SP1 for Linux* OS now support linking objects compiled by the GCC* 4.9 compilers (gcc/g++/gfortran) with the Intel OpenMP runtime library (libiomp5).
The specific Intel compiler versions are icc-18.104.22.168 Build 20140805 and ifort-22.214.171.124 Build 20140805.
You can mix OpenMP* object files compiled with gcc/g++, the Intel® C++ Compiler, and the Intel® Fortran Compiler, as all of these are object-level compatible.
Object files compiled with the Intel® Fortran compiler and the gfortran compiler do not have object-level compatibility, and so cannot be mixed.
Objects compiled by gcc/g++ with the -fopenmp compiler option and linked with gcc/g++ generally require that -liomp5 -lpthread -lirc be added to the link command (here, compilation and linking are done with one command):
g++ -fopenmp foo.cpp -o foo.exe -liomp5 -lirc -lpthread
Alternatively, the icc or icpc compiler driver may to used to perform the linking:
g++ -fopenmp -c foo.cpp
icpc -openmp foo.o -o foo.exe
Objects compiled by gfortran with the -fopenmp compiler option and linked with gfortran also generally require that -liomp5 -lpthread -lirc be added to the link line; in addition, the Intel Fortran runtime (libifcoremt) is needed:
gfortran -fopenmp foo.f90 -o foo.exe -lirc -liomp5 -lpthread -lifcoremt
Alternatively, the ifort compiler driver may be used to link gfortran-compiled OpenMP object files. For this case, the gfortran runtime library needs to be added to the link, and ifort compiler option -nofor-main used to indicate that the main program was not compiled by Intel Fortran:
gfortran -fopenmp -c foo.f90
ifort -openmp -nofor-main foo.o -lgfortran -o foo.exe