Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

Dynamic Linking fails due to undefined reference to __isoc99_sscanf

$
0
0

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

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>