On Thu, 7 Nov 2013, at 12:34, Jed Brown wrote: > Svetlana Tkachenko <svetlana.tkache...@fastmail.fm> writes: > > > On Thu, 7 Nov 2013, at 10:22, Jed Brown wrote: > >> Svetlana Tkachenko <svetlana.tkache...@fastmail.fm> writes: > >> > Right. I have spent half of an hour now trying to imagine what to do > >> > to link trying everything like a headless chicken and it did not > >> > work. > >> > >> You always have to send the error message. > >> > >> > I would appreciate if you could come up with something that links, not > >> > just runs a single program. > >> > >> The makefiles we suggested link a program of the same name as the source > >> file. Do you have multiple source files? You only have to edit the one > >> line and run "make". > >> > >> program: several.o object.o files.o > >> ${CLINKER} -o $@ $^ ${PETSC_LIB} > >> > >> include ${PETSC_DIR}/conf/variables > >> include ${PETSC_DIR}/conf/rules > >> Email had 1 attachment: > >> + Attachment2 > >> 1k (application/pgp-signature) > > > > ~/dev/test/petsc $ cat makefile > > myexample: myexample.o solver.o > > ${CLINKER} -o $@ $^ ${PETSC_LIB} > > > > include ${PETSC_DIR}/conf/variables > > include ${PETSC_DIR}/conf/rules > > ~/dev/test/petsc $ cat solver.f > > subroutine solver() > > #include <finclude/petscsys.h> > > Name your source file solver.F so that the Fortran compiler preprocesses > it. (Or add the option -cpp, but that is more confusing and less > portable, so rename the source file.) > Email had 1 attachment: > + Attachment2 > 1k (application/pgp-signature)
~/dev/test/petsc $ mv solver.f solver.F ~/dev/test/petsc $ make gfortran -c -fPIC -Wall -Wno-unused-variable -g -fopenmp -I/home/<username>/petsc/include -I/home/<username>/petsc/linux-amd64/include -I/home/<username>/petsc/include/mpiuni -o solver.o solver.F solver.F:8.46: if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr 1 Error: Missing ')' in statement at or before (1) solver.F:8.72: if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr 1 Warning: Line truncated at (1) solver.F:13.46: if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr 1 Error: Missing ')' in statement at or before (1) solver.F:13.72: if (ierr .ne. 0) call MPI_Abort(PETSC_COMM_WORLD,ierr,ierr 1 Warning: Line truncated at (1) make: [solver.o] Error 1 (ignored) gcc -fopenmp -fopenmp -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -fno-inline -O0 -fopenmp -o myexample myexample.o solver.o -Wl,-rpath,/home/<username>/petsc/linux-amd64/lib -L/home/<username>/petsc/linux-amd64/lib -lpetsc -Wl,-rpath,/home/<username>/petsc/linux-amd64/lib -lflapack -lfblas -lX11 -lpthread -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -lgfortran -lm -lm -lstdc++ -lstdc++ -ldl -lgcc_s -ldl gcc: solver.o: No such file or directory make: *** [myexample] Error 1 ~/dev/test/petsc $