Community
cancel
Showing results for 
Search instead for 
Did you mean: 
gregfi04
Beginner
115 Views

problem with static linking of MKL libraries

Hi,

I'm attempting to statically-link MKL libraries, but libmkl_core seems to be unable to find its dependencies. So far as I can tell, I'm following the guidance on the Intel MKL Link Line Advisor. If I replace the static libraries with dynamic ones, everything works correctly.

Here is my linker step:
/home/user/src/hdftest1/hdf5-1.8.6/hdf5/bin/h5pfc *.o /config/LIB/extlib.a/1.12-64-bit/GNULinux_2.6_bin/extlib.a -Wl,--start-group /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_intel_lp64.a /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_intel_thread.a /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -openmp -lpthread

Here are a subset of the errors:

/tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a(pardiso_lp64.o): In function `mkl_pds_lp64_pardiso':
__tmp_lp64_pardiso.f:(.text+0x1ee): undefined reference to `mkl_pds_lp64_get_proc_pardiso'
__tmp_lp64_pardiso.f:(.text+0x221): undefined reference to `mkl_pds_lp64_get_dynamic_pardiso'
__tmp_lp64_pardiso.f:(.text+0x365): undefined reference to `mkl_pds_lp64_diag_pardiso'
__tmp_lp64_pardiso.f:(.text+0x3d5): undefined reference to `mkl_pds_lp64_sp_diag_pardiso'
__tmp_lp64_pardiso.f:(.text+0x440): undefined reference to `mkl_pds_lp64_c_diag_pardiso'
__tmp_lp64_pardiso.f:(.text+0x49d): undefined reference to `mkl_pds_lp64_sp_c_diag_pardiso'
/tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a(pardiso.o): In function `mkl_pds_pardiso':
__tmp_ilp64_pardiso.f:(.text+0xb3): undefined reference to `mkl_pds_get_proc_pardiso'
__tmp_ilp64_pardiso.f:(.text+0xe7): undefined reference to `mkl_pds_get_dynamic_pardiso'
__tmp_ilp64_pardiso.f:(.text+0x25c): undefined reference to `mkl_pds_diag_pardiso'
__tmp_ilp64_pardiso.f:(.text+0x2d5): undefined reference to `mkl_pds_sp_diag_pardiso'
__tmp_ilp64_pardiso.f:(.text+0x343): undefined reference to `mkl_pds_c_diag_pardiso'
__tmp_ilp64_pardiso.f:(.text+0x3a0): undefined reference to `mkl_pds_sp_c_diag_pardiso'
/tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a(pardiso_lp64.o): In function `mkl_pds_lp64_pardiso':__tmp_lp64_pardiso.f:(.text+0x1ee): undefined reference to `mkl_pds_lp64_get_proc_pardiso'__tmp_lp64_pardiso.f:(.text+0x221): undefined reference to `mkl_pds_lp64_get_dynamic_pardiso'__tmp_lp64_pardiso.f:(.text+0x365): undefined reference to `mkl_pds_lp64_diag_pardiso'__tmp_lp64_pardiso.f:(.text+0x3d5): undefined reference to `mkl_pds_lp64_sp_diag_pardiso'__tmp_lp64_pardiso.f:(.text+0x440): undefined reference to `mkl_pds_lp64_c_diag_pardiso'__tmp_lp64_pardiso.f:(.text+0x49d): undefined reference to `mkl_pds_lp64_sp_c_diag_pardiso'/tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a(pardiso.o): In function `mkl_pds_pardiso':__tmp_ilp64_pardiso.f:(.text+0xb3): undefined reference to `mkl_pds_get_proc_pardiso'__tmp_ilp64_pardiso.f:(.text+0xe7): undefined reference to `mkl_pds_get_dynamic_pardiso'__tmp_ilp64_pardiso.f:(.text+0x25c): undefined reference to `mkl_pds_diag_pardiso'__tmp_ilp64_pardiso.f:(.text+0x2d5): undefined reference to `mkl_pds_sp_diag_pardiso'__tmp_ilp64_pardiso.f:(.text+0x343): undefined reference to `mkl_pds_c_diag_pardiso'__tmp_ilp64_pardiso.f:(.text+0x3a0): undefined reference to `mkl_pds_sp_c_diag_pardiso'

Perhaps the complexity is caused by my linker command "h5pfc", which is a wrapper around "mpif90", which is, in turn, a wrapper around "ifort."

Any thoughts?

Thanks,
Greg
0 Kudos
2 Replies
Gennady_F_Intel
Moderator
115 Views

Would you try please add the-liomp5 explicitly instead of -openmp and check again.
gregfi04
Beginner
115 Views

I found the problem.

The wrapper script that's being used to compile HDF5 subroutines ("h5pfc") is also being used at the linker phase. The wrapper script does not appear to be correctly transporting the cyclic reference resolver ("-Wl,--start-group ...-Wl,--end-group") from the command line to the actual linking operation.

The "h5pfc" script reads environment variables HDF5_LIBS, HDF5_LDFLAGS, and HDF5_FFLAGS. (For anyone else encoutnering this problem, simply execute "h5pfc" with no arguments and will print some instructions.)

If the MKL linker commands are loaded into the HDF5_LIBS environment variable, "h5pfc" will correctly link everything together and generate the executable:

1011 xxxxx@susedev1[...]> echo $HDF5_LIBS -Wl,--start-group /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_intel_lp64.a /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_sequential.a /tools/intel/composerxe-2011.3.174/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread

1012 xxxxx@susedev1[...]> /home/xxxxx/src/hdftest1/hdf5-1.8.6/hdf5/bin/h5pfc *.o /config/LIB/extlib.a/1.12-64-bit/GNULinux_2.6_bin/extlib.a

(success!)

Thanks,
Greg
Reply