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

undefined reference to `pthread_atfork'

rakkota
Novice
2,085 Views

Hi,

I am having problems linking a FORTRAN OMP based program under Linux (Red Hat Enterprise 4).

I am linking withINTEL library libomp5.a and the system library /lib/libpthread.so.0.

The exact error that I am getting is:

/opt/intel/fc/10.1.018/lib/libiomp5.a(z_Linux_util.o)(.text+0x15ec): In function `__kmp_register_atfork':
: undefined reference to `pthread_atfork'

Does anyone know with which library(ies) should I link in order to get it right?

Thanks,

Rak

0 Kudos
3 Replies
af123_af007
Beginner
2,085 Views
Quoting - rakkota

Hi,

I am having problems linking a FORTRAN OMP based program under Linux (Red Hat Enterprise 4).

I am linking withINTEL library libomp5.a and the system library /lib/libpthread.so.0.

The exact error that I am getting is:

/opt/intel/fc/10.1.018/lib/libiomp5.a(z_Linux_util.o)(.text+0x15ec): In function `__kmp_register_atfork':
: undefined reference to `pthread_atfork'

Does anyone know with which library(ies) should I link in order to get it right?

Thanks,

Rak

Did you use -lpthread?

0 Kudos
TimP
Honored Contributor III
2,085 Views
Quoting - af123_af007

Did you use -lpthread?

As you are using ifort, there is no reason to be using libiomp5, unless you are using -openmp or -parallel (at least implicitly, by using a library built with OpenMP). Using the same ifort options at link specifies the OpenMP and pthread libraries.

0 Kudos
rakkota
Novice
2,085 Views
Quoting - af123_af007

Did you use -lpthread?

Thanks for the replay. I finally found the solution. Using -lpthread alone didn't solve the problem. I had to specify -lpthread and to explicitly link with /opt/intel/fc/10.1.018.lib/libguide.a and /usr/lib/libpthread_nonshared.a.

Rak

0 Kudos
Reply