Problem
After adding an external interface for Lapack, the code fails during linking with the message
Undefined symbols for architecture x86_64:
"___msolutionsvd_MOD_dgesvd", referenced from:
___msolutionsvd_MOD_svd_pseudoinverse_solve_sub in m-solution-svd.o
It seems that the linker is looking for a DGESVD.mod
file which is not included with my openblas
installation.
Code
This works
The module module mSolutionSVD
used the declaration
external DGESVD
to point to the BLAS routine and contains
subroutine svd_pseudoinverse_solve_sub
which calls DGESVD
.
This fails
The declaration was replaced with the explicit interface
interface lapack
module subroutine DGESVD ( JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK, LWORK, INFO )
character ( kind = kindA, len = 1 ), intent ( in ) :: JOBU, JOBVT
integer ( kind = ip ), intent ( in ) :: M, N, LDA, LDU, LWORK
integer ( kind = ip ), intent ( out ) :: INFO
real ( kind = rp ), intent ( out ) :: S ( : ), U ( : , : ), VT ( : , : ), WORK ( : )
real ( kind = rp ), intent ( inout ) :: A ( : , : )
end subroutine DGESVD
end interface lapack
Background
The kind statements are sourced from a routine with these statements:
use, intrinsic :: iso_fortran_env, only : INT8, REAL64
integer, parameter :: kindA = kind ( 'A' )
integer, parameter :: rp = selected_real_kind ( REAL64 )
integer, parameter :: ip = selected_int_kind ( INT64 )
Question
Can we use an external interface for Lapack without having to recompile Lapack?