undefined reference to ....
Ben Tay
zonexo at gmail.com
Wed Jan 10 21:44:25 CST 2007
Hi,
regarding "> > > -lirc -lgcc_s -lirc_s -ldl -o a.out global.o main.f90"
is it the correct order? my make file is in that order.
anyway, compiling 1st then linking solve the problem. Strange that it didn't
work compiling/linking at the same step. it worked for other configuration.
thanks anyway.
On 1/11/07, Satish Balay <balay at mcs.anl.gov> wrote:
>
> Ah - I wasn't checking your make output closly..
>
> Looks like you are listing your libs after petsclibs. You'll have to
> list the object files - in the correct order of dependencies..
>
> > > > -lirc -lgcc_s -lirc_s -ldl -o a.out global.o main.f90
>
> Also - looks like you are compiling & linking at the same step.. [i.e
> using .o and .f90 in the same command]. Sugest crearing .o files before
> linking..
>
> i.e
>
> ${FLINKER} -o a.out global.o main.o ${PETSC_LIB}
>
> Satish
>
>
> On Thu, 11 Jan 2007, Ben Tay wrote:
>
> > Yes it ran successfully. I've attached the output.
> >
> > thank you very much.
> >
> >
> > On 1/11/07, Satish Balay <balay at mcs.anl.gov> wrote:
> > >
> > > Do PETSc examples work?
> > >
> > > Send us the output from
> > >
> > > make test
> > >
> > > Staish
> > >
> > > On Wed, 10 Jan 2007, Ben Tay wrote:
> > >
> > > > 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/20070111/99b049bd/attachment.htm>
More information about the petsc-users
mailing list