I compiled the lapack library with the g77 compiler and I try to link
it with a f90 program compiled by gfortran.
I get unresolved external symbols of the following form
/home/ejs/work/code/c++/beap/solver/lapack-3.1.1/lapack_LINUX.a
(ilaenv.o): In function `ilaenv_':
ilaenv.f:(.text+0x12c): undefined reference to `s_copy'
ilaenv.f:(.text+0x220): undefined reference to `s_copy'
ilaenv.f:(.text+0x23d): undefined reference to `s_copy'
I use the command ( I link it with lapack and blas).
gfortran patdgesv.f90 -o patdgesv.exe /home/ejs/work/code/c++/beap/
solver/lapack-3.1.1/lapack_LINUX.a /home/ejs/work/code/c++/beap/
solver/lapack-3.1.1/blas_LINUX.a
Many thanks for any help.
the program is the following
----------------------------------
program patdgesv
implicit none
integer, parameter :: n = 100, NRHS = 1
integer info;
real*8, allocatable, dimension(:, :) :: amat
real*8, allocatable, dimension(:) :: bmat
integer, allocatable, dimension(:) :: ipiv
!
allocate( amat(n, n), ipiv( n ) )
call fill_matrix( amat, n, n, bmat )
call dgesv( n, NRHS, amat, n, ipiv, bmat, n, info )
!
deallocate( amat, ipiv )
!
end program patdgesv
!
subroutine fill_matrix( amat, LDA, N, bmat )
implicit none
integer, intent(in) :: LDA, N
real*8, intent(out), dimension( LDA, N ) :: amat
real*8, intent(out), dimension( N ) :: bmat
real*8, parameter :: ZERO = 0.0, ONE = 1.0
integer i, j
!
amat(1, 1) = N
bmat(1) = ONE
!
do i = 2, N
do j = 2, N
amat(i, j) = ZERO
enddo
!
amat(1, i) = - ONE
amat(i, 1) = - ONE
amat(i, i) = ONE
bmat(i) = ZERO
!
enddo
!
end subroutine fill_matrix
Why are you using g77 to compile lapack, and then using gfortran
to compile and link the program? Compile lapack with gfortran;
your problem will go awy.
> I get unresolved external symbols of the following form
>
> /home/ejs/work/code/c++/beap/solver/lapack-3.1.1/lapack_LINUX.a
> (ilaenv.o): In function `ilaenv_':
> ilaenv.f:(.text+0x12c): undefined reference to `s_copy'
> ilaenv.f:(.text+0x220): undefined reference to `s_copy'
> ilaenv.f:(.text+0x23d): undefined reference to `s_copy'
>
> I use the command ( I link it with lapack and blas).
> gfortran patdgesv.f90 -o patdgesv.exe /home/ejs/work/code/c++/beap/
> solver/lapack-3.1.1/lapack_LINUX.a /home/ejs/work/code/c++/beap/
> solver/lapack-3.1.1/blas_LINUX.a
>
You need to use -ff2c and include g77 runtime library in your
command line.
--
steve