undefined reference to ....

Ben Tay zonexo at gmail.com
Wed Jan 10 00:44:38 CST 2007


Hi,

I have a very simple fortran code. It compiles on a 32bit system with mkl
with no errors but on em64t, it gives "undefined reference to ...." error.

It works when I compiled with the supplied blas/lapack. However if I use
Intel mkl, it gives the error as stated above.

My code is

global.F

       module global_data

        implicit none

        save

#include "include/finclude/petsc.h"
#include "include/finclude/petscvec.h"
#include "include/finclude/petscmat.h"
#include "include/finclude/petscksp.h"
#include "include/finclude/petscpc.h"
#include "include/finclude/petscmat.h90"

        integer :: i,j,k

        Vec    xx,b_rhs,xx_uv,b_rhs_uv   !   /* solution vector, right hand
side vector and work vector */

        Mat    A_mat,A_mat_uv      !  /* sparse matrix */

        end module global_data

main.f90

program ns2d_c

use global_data

implicit none

integer :: ierr

i=1

call PetscInitialize(PETSC_NULL_CHARACTER,ierr)

call MatCreateSeqAIJ(PETSC_COMM_SELF,9,9,9,PETSC_NULL_INTEGER,A_mat,ierr)

end program ns2d_c


The error msg is

/tmp/ifort0JBYUf.o(.text+0x46): In function `ns2d_c':
/nfs/home/enduser/g0306332/test/main.F:11: undefined reference to
`petscinitialize_'
/tmp/ifort0JBYUf.o(.text+0xaf):/nfs/home/enduser/g0306332/test/main.F:13:
undefined reference to `matcreateseqaij_'

The compiling commands, which I rephrase from the "make ex1f" are

ifort -132 -fPIC -g -c
-I/nfs/lsftmp/g0306332/petsc-2.3.2-p8-I/nfs/lsftmp/g0306332/petsc-
2.3.2-p8/bmake/l64-nompi-noshared -I/nfs/lsftmp/g0306332/petsc-2.3.2-p8/include
-I/nfs/lsftmp/g0306332/petsc-2.3.2-p8/include/mpiuni global.F

ifort  -fPIC -g
-Wl,-rpath,/nfs/lsftmp/g0306332/petsc-2.3.2-p8/lib/l64-nompi-noshared
-L/nfs/lsftmp/g0306332/petsc-2.3.2-p8/lib/l64-nompi-noshared -lpetscksp
-lpetscdm -lpetscmat -lpetscvec -lpetsc
-Wl,-rpath,/nfs/lsftmp/g0306332/petsc-2.3.2-p8/lib/l64-nompi-noshared
-L/nfs/lsftmp/g0306332/petsc-2.3.2-p8/lib/l64-nompi-noshared -lmpiuni
-Wl,-rpath,/lsftmp/g0306332/inter/mkl/lib/em64t
-L/lsftmp/g0306332/inter/mkl/lib/em64t -lmkl_lapack -lmkl_em64t -lguide
-lpthread -ldl -Wl,-rpath,/usr/local/intel/cce9.0/lib
-L/usr/local/intel/cce9.0/lib
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64 -lsvml -limf
-lirc -lgcc_s -lirc_s -Wl,-rpath,"/usr/local/intel/cce9.0/lib"
-Wl,-rpath,"/usr/local/intel/cce9.0/lib" -L"/usr/local/intel/cce9.0/lib"
-Wl,-rpath,"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/"
-Wl,-rpath,"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/"
-L"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/"
-Wl,-rpath,"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64"
-Wl,-rpath,"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64"
-L"/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64"
-Wl,-rpath,/usr/local/intel/fc9.0/lib -L/usr/local/intel/fc9.0/lib -lifport
-lifcore -lm -Wl,-rpath,/usr/local/intel/cce9.0/lib
-Wl,-rpath,/usr/local/intel/cce9.0/lib -L/usr/local/intel/cce9.0/lib
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64 -lm  -ldl
-Wl,-rpath,/usr/local/intel/cce9.0/lib -L/usr/local/intel/cce9.0/lib
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64
-L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64 -lsvml -limf
-lirc -lgcc_s -lirc_s -ldl  -o a.out global.o  main.f90

I have used shared,static library. I wonder if it is a problem with mkl
em64t or there's something wrong with my code/compilation.



Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20070110/101043d5/attachment.htm>


More information about the petsc-users mailing list