Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

linking lapack compiled with g77 with a g90 fortran program

30 views
Skip to first unread message

John Smith

unread,
May 8, 2009, 1:18:43 PM5/8/09
to
Hello,

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

kar...@comcast.net

unread,
May 8, 2009, 1:56:14 PM5/8/09
to
On May 8, 10:18 am, John Smith <Brutus...@hotmail.com> wrote:
>  Hello,
>
>  I compiled the lapack library with the g77 compiler and I try to link
> it with a f90 program compiled by gfortran.

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

0 new messages