Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

undefined symbol: for__pthread_mutex_lock_ptr when building shared library

gregfi04
Beginner
904 Views
I'm attempting to follow the procedure belowin order to build shared libraries with statically-linked Intel libraries:

All of the shared libraries are being built and most of them (seem to) function correctly. A few of them, however, produce this message when the code is executed and they're linked in:

symbol lookup error: ./code_name:undefined symbol: for__pthread_mutex_lock_ptr

Any thoughts on what may cause this?
Thanks,
Greg
0 Kudos
4 Replies
TimP
Honored Contributor III
904 Views
The usual way to link in pthreads is by giving ifort an option which implies it (-openmp or -parallel), or by appending -lpthreads to the link options. So the thought would be that you chose some less usual method.
0 Kudos
gregfi04
Beginner
904 Views
Here are my linker flags. Do any of these look out of whack?

/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o \
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbeginS.o \
--eh-frame-hdr \
-shared \
-L/tools/intel/fce/11.1.046/lib/intel64 \
-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 \
-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 \
-L/lib/../lib64 \
-L/usr/lib/../lib64 \
-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib \
-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. \
-L/lib64 \
-L/lib \
-L/usr/lib64 \
-L/usr/lib \
-Bstatic \
-lifport \
-lifcore_pic \
-limf \
-lsvml \
-Bdynamic \
-lm \
-Bstatic \
-lipgo \
-lirc \
-u \
__pthread_once \
-Bdynamic \
-lpthread \
-lc \
-lgcc_s \
-Bstatic \
-lirc_s \
-Bdynamic \
-ldl \
-lc \
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtendS.o \
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o
0 Kudos
Ron_Green
Moderator
904 Views
hmmm, interesting. In newer compilers this symbol is indeed in libifcore_pic.a BUT it's not in your old 11.1 version library for libifcore_pic.a

I am assuming you have -openmp or -parallel in your build, yes?

There were some restrictions in the past regarding using the OpenMP runtime and static builds - to the effect that you could NOT build statically with OpenMP. I'll check with our OpenMP experts.

ron
0 Kudos
Ron_Green
Moderator
904 Views
it would help to see your compiler options.

-i-static will NOT link in the static OpenMP runtime library. You need '-openmp-link static' to achieve that.

ron
0 Kudos
Reply