Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

Compiling with iFort and -openmp flag makes my compilation fail

intel1
Beginner
788 Views
I'm just starting to see if I can use OpenMP to speed up some code I've been working on. Simply adding the -openmp flag results in an error though (I haven't put any openmp directives into the code yet).

I'm using iFort 10.1 and Mac OS X 10.5.3.

The error I'm getting is as follows:

Undefined symbols:
"___kmpc_begin", referenced from:
_MAIN__ in create_test.o
"___kmpc_global_thread_num", referenced from:
_MAIN__ in create_test.o
"___kmpc_end", referenced from:
_MAIN__ in create_test.o
ld: symbol(s) not found

Can anyone give me any suggestions on what's going wrong?
0 Kudos
2 Replies
intel1
Beginner
788 Views
Looking again, it looks like the problem's arising when the make command tries to create a library file. It does the following: ifort -openmp -c test3.f90 -o test3.o; ifort -openmp -c test2.f90 -o test2.o; ifort -openmp -c test1.f90 -o test1.o; ifort -o test1 test1.o test2.o test3.o libfile.a; I've tried to simplify what it does here obviously, these aren't the real filenames but the structure is the same. Its after the last line that the error lines appear. The previous ifort commands do have the following warnings though: :4: warning: "__INTMAX_TYPE__" redefined :11: warning: this is the location of the previous definition :5: warning: "__UINTMAX_TYPE__" redefined :12: warning: this is the location of the previous definition
0 Kudos
TimP
Honored Contributor III
788 Views

When ifort is used to link, the -openmp flag will add -lguide -lpthread to the script passed to ld. Maybe your Makefile requires -openmp to be added to the Fortran link flags. Recent versions of ifort give you the choice of libiomp5 instead of libguide, for compatibility with gcc/gfortran. Only on Windows do objects carry notations about their library dependencies.

I haven't seen that type redefinition thing, but that's a different issue.

0 Kudos
Reply