Topic: Building OOFEM with PETSc

Hi
I've managed to compile OOFEM without PETSc, but if I try to build it with PETSc im getting some errors when compiling.

I'm using OOFEM-1.7 and PETSc 2.3.3-p8. I've installed PETSc according to the instructions in http://www-unix.mcs.anl.gov/petsc/petsc … ation.html
I've configured PETSc with:
./config/configure.py --with-cc=gcc --with-fc=g77 --download-f-blas-lapack=1 --download-mpich=1
PETSC_DIR is '/home/christian/Software/src/petsc'
PETSC_ARCH is 'linux-gnu'
I've been abe to run 'make test' without encountering any errors.

I've configured OOFEM with: ./configure --enable-iml --enable-petsc --enable-dss -enable--oofeg

When I run 'make all' I get the following output from the compiler:

cd main/src; make oofem-release
make[1]: Entering directory `/home/christian/Software/src/oofem-1.7/main/src'
makefile:236: warning: overriding commands for target `clean'
/home/christian/Software/src/petsc/bmake/common/rules:95: warning: ignoring old commands for target `clean'
/usr/bin/make -C ../../oofemlib/src  oofemlib-release
make[2]: Entering directory `/home/christian/Software/src/oofem-1.7/oofemlib/src'
c -D__OOFEMLIB_MODULE -D__SM_MODULE -D__TM_MODULE -D__FM_MODULE -D__IML_MODULE -D__DSS_MODULE -D__PETSC_MODULE -O -Wall  -I/home/christian/Software/src/oofem-1.7/iml  -I/home/christian/Software/src/petsc -I/home/christian/Software/src/petsc/bmake/linux-gnu -I/home/christian/Software/src/petsc/include -I/home/christian/Software/src/petsc/externalpackages/spooles-2.2/linux-gnu/ -I/home/christian/Software/src/petsc/externalpackages/mpich2-1.0.5p4/linux-gnu/include      -I/home/christian/Software/src/oofem-1.7/dss/src bodyload.C -o ../oofem_obj/Release/bodyload.o
make[2]: c: Command not found
make[2]: [../oofem_obj/Release/bodyload.o] Error 127 (ignored)

then it's the same error message for the rest of the source files as well.

Did I configure OOFEM or PETSc incorrectly, am I just missing some pre-requisities or is it something totally different?

Thanks
Christian

2

Re: Building OOFEM with PETSc

Hi Christian,

It seems that you have configured PETSc correctly. The problem is with oofem configuration. From the compilation output, you can see that make process is trying to use "c" as a compiler. And this is probably not the right one - make reports that such command could not be run ("make[2]: c: Command not found"). Since you have used gcc for PETSc compilation, I would expect "c++" or "g++" to be used. Try to remove config.cache form oofem top directory (if exist) and run configure again. Check configure output: look for c++ compiler detection and make sure that no errors are reported. I can say more, If you can post configure output here, it can help me to find out what is going wrong.

Best regards,
Borek

Re: Building OOFEM with PETSc

Hi Borek

Thank you for the quick reply. I deleted config.cache and ran configure again. This is the output I get:

$ ./configure --enable-iml --enable-petsc --enable-dss --enable-oofeg
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking how to run the C++ preprocessor... c++ -E
checking for a BSD compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking whether make sets ${MAKE}... yes
checking for ANSI C header files... yes
checking for limits.h... yes
checking for malloc.h... yes
checking for strings.h... yes
checking for unistd.h... yes
checking for sys/time.h... yes
checking for sys/resource.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking for strstr... yes
checking for strtod... yes
checking for strtol... yes
checking for strncasecmp... yes
checking for access... yes
checking for nearest... no
checking FALSE, TRUE enum/constants... no
checking typedef bool... yes
checking M_PI constant... yes
checking M_LN2 constant... yes
checking STL support... yes
checking Macro __VA_ARGS__ support... yes
checking Function Templates support... yes
checking for sqrt in -lm... yes
checking IML module location... /home/christian/Software/src/oofem-1.7/iml
checking dss module location... dss/src
checking for mpi.h... no
checking guess of MPI includes location... MPI includes not found in /usr/local/mpi/include.
Type in directory:
/home/christian/Software/src/petsc/externalpackages/mpich2-1.0.5p4/linux-gnu/include
checking PETSc module location... /home/christian/Software/src/petsc
checking PETSC_ARCH... linux-gnu
checking for X... libraries /usr/lib, headers
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for XtNameToWidget in -lXt... yes
checking for ckitcfg.h... yes
checking for _get_list_next in -lckit... yes
checking for Ecfg.h... yes
checking for ElixirInit in -lelixir... no
checking guess of libelixir.a location... Elixir library not found in /home/christian/Software/src/oofem-1.7/../Elixir/src.
Type in directory (use absolute path):
/usr/local/lib
checking for ESIBuildInterface in -lesi... no
checking guess of libesi.a location... Esi library not found in /home/christian/Software/src/oofem-1.7/../Elixir/src.
Type in directory (use absolute path):
/usr/local/lib
checking Determining hostname... christian-laptop
checking OOFEM version... 1.7
updating cache ./config.cache
creating ./config.status
creating oofemlib/src/makefile
creating oofemlib/src/oofemdef.h
creating sm/src/makefile
creating tm/src/makefile
creating fm/src/makefile
creating main/src/makefile
creating tools/makefile
creating tests/do_test
creating makefile
creating dss/src/makefile
creating oofemlib/src/oofemcfg.h
oofemlib/src/oofemcfg.h is unchanged

Modules to be included: oofemlib sm tm fm iml dss petsc
Targets to be built: oofem-release oofeg-release

Regards
Christian

4

Re: Building OOFEM with PETSc

Hi Christian,
it looks great, Try to compile now...

Borek

Re: Building OOFEM with PETSc

What I forgot to add to my last post was that I still get the same error message when compiling sad

Christian

6

Re: Building OOFEM with PETSc

Hi Christian,

this is really, really  strange. Could you check the makefile in oofemlib/src. There should be a line, where CC variable (determining compiler to use) should be set.
The line looks like this one:
CC         = c++
If CC variable is not set to a valid c++ compiler, try to supply "g++" or "c++" as the value (see line before). Then try to compile (now at least files in oofemlib should be compiled, I hope).
Please, let me know

Borek

Re: Building OOFEM with PETSc

Hi Borek

I checked the makefiles in oofemlib/src and main/src and they both say

LD         =
CC         =
SLD         = c++
SCC         = c++
PLD        =
PCC        =

I changed CC =   to CC = c++ in oofemlib/src and this time the files in oofemlib compiled ok

Which makefiles do I need to edit to compile everything?

Regards
Christian

Re: Building OOFEM with PETSc

I tried configuring with: ./configure --enable-iml --enable-dss --enable-oofeg
And looked in the makefiles. The funny thing is that this time they say:

LD         = c++
CC         = c++
SLD         = c++
SCC         = c++
PLD        =
PCC        =

So it seems as though it's the --enable-petsc that's somehow screwing up the configuration

Regards
Christian

9

Re: Building OOFEM with PETSc

Hi Christian,

you need to make the same changes in the following directories:

oofemlib/src
sm/src
tm/src
fm/src
main/src
dss/src (if you have enabled DSS)

but still I would like to figure out, what is going wrong. Could you check (before manually editing the makefiles) that after running configure the time/date of makefile has changed, since it should be generated by configure script.

thanks,
Borek

Re: Building OOFEM with PETSc

Hi borek

Thank you very much for your help!
I first ran configure with "./configure --enable-iml --enable-petsc --enable-dss --enable-oofeg --enable-spooles"
and got the following content in the makefiles.

LD         =
CC         =
SLD         = c++
SCC         = c++
PLD         =
PCC         =

I then removed config.cache and ran configure with "./configure --enable-iml --enable-dss --enable-oofeg --enable-spooles"
and the timestamps on the makefiles changed and they had the following content.

LD         = c++
CC         = c++
SLD         = c++
SCC         = c++
PLD         =
PCC         =

This is really weird. Do you suppose there's something wrong with the configure-script?

Regards
Christian

11

Re: Building OOFEM with PETSc

Hi Christian,

I do not think that there is something wrong with configure script: The config.cache stores (caches) the results from previous configure run, and when exist, the configure does not perform all tests, but uses the cached information from this file. Probably this cache file has been corrupted somehow. When you remove cache file, all test are really done and correct makefile should be generated. So if you are able to generate correct makefile now, it is ok and you can try to compile the code.

Regards from Prague,
Borek