Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Dynamic Linking fails due to undefined reference to __isoc99_sscanf

lrobison_arl
Beginner
1,686 Views

I've recently upgraded from Intel Fortran 2013 to 2015 and now I'm having trouble linking with MKL on Linux. Now, any kind of linking (dynamic, static, or with just -static-intel) fails with errors due to undefined references to __isoc99_sscanf. (Dynamic linking also has trouble with __isoc99_fscanf.) I've seen a few posts that at first glance appear similar:

https://software.intel.com/en-us/articles/link-error-when-static-linking-to-intel-mkl-on-linux-6
https://software.intel.com/en-us/forums/topic/393920
https://software.intel.com/en-us/forums/topic/393889

However, each of those posts refer to Intel Fortran 2013, and *none* of them cover problems with dynamic linking. It seems that MKL now depends on some static component that I am apparently missing. I can't figure out how to link successfully. Is this a bug, or is there a viable workaround?

Below I have provided a simplified test case (mkl_test.f90), my Makefile, and the output with the three variations of linking.
 

program mkl_test

use LAPACK95

implicit none
integer :: stat
integer, parameter :: length = 5
real(kind = 8) :: x(length), y(length), A(length, 3), b(length)

print *, 'Start.'

call gels(A, b, info = stat)
if (stat .ne. 0) then
    print *, 'Bad status from gels.'
else
    print *, 'Success'
end if

end program mkl_test

 

FC := ifort

all: mkl_test

clean:
    rm -f mkl_test mkl_test.o

mkl_test: mkl_test.o
    $(FC) -o $@ $^ $(FCFLAGS) $(FLFLAGS) -lmkl_lapack95_lp64 -mkl -static-intel

mkl_test.o: mkl_test.f90
    $(FC) -c -o $@ $< $(FCFLAGS) -mkl



 

$ make clean all
rm -f mkl_test mkl_test.o
ifort -c -o mkl_test.o mkl_test.f90  -mkl
ifort -o mkl_test mkl_test.o   -lmkl_lapack95_lp64 -mkl
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__isoc99_sscanf'
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_core.so: undefined reference to `__isoc99_fscanf'
make: *** [mkl_test] Error 1


$ make clean all
rm -f mkl_test mkl_test.o
ifort -c -o mkl_test.o mkl_test.f90  -mkl
ifort -o mkl_test mkl_test.o   -lmkl_lapack95_lp64 -mkl -static
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_core.a(load_library.o): In function `mkl_ueaa_prv_load_backend_lib':
loadl_library.c:(.text+0x1d1): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_core.a(load_dll_static_patched.o): In function `mkl_serv_cpu_detect':
../../../../serv/kernel/load_dll.c(.text+0x86): undefined reference to `__isoc99_sscanf'
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_intel_thread.a(d__gemm_drv.o): In function `mkl_blas_dgemm':
../../../../blas/thread/level3/common/_gemm.c:(text+0xe29): undefined reference to `__isoc99_sscanf'
make: *** [mkl_test] Error 1


$ make clean all
rm -f mkl_test mkl_test.o
ifort -c -o mkl_test.o mkl_test.f90  -mkl
ifort -o mkl_test mkl_test.o   -lmkl_lapack95_lp64 -mkl -static-intel
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_core.a(load_dll_static_patched.o): In function `mkl_serv_cpu_detect':
../../../../serv/kernel/load_dll.c(.text+0x86): undefined reference to `__isoc99_sscanf'
/opt/intel/composer_xe_2015.0.090/mkl/lib/intel64/libmkl_intel_thread.a(d__gemm_drv.o): In function `mkl_blas_dgemm':
../../../../blas/thread/level3/common/_gemm.c:(text+0xe29): undefined reference to `__isoc99_sscanf'
make: *** [mkl_test] Error 1

 

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
1,686 Views

the fix of this problem would be available very soon into the MKL v.11.2 update 1. When this update would be available, we will post the announcement on the top of the forum.

0 Kudos
lrobison_arl
Beginner
1,686 Views

Hello Gennady,

Thank you for the information and for putting together a fix. Do you have an estimate of when that update might be available?

Thanks.

0 Kudos
Gennady_F_Intel
Moderator
1,686 Views

please see the the latest ML 11.2 Update 1 available right now 

0 Kudos
Reply