I have Windows 7 OS.
I have followed the instructions from the PETSc web page; in the command prompt of VS 2005 I have opened cygwin and installed PETSc with the command:
./configure --with-cc='win32fe cl' --with-fc=0 --with-mpi=0 --download-f2cblaslapack
I tried to run the following example from the web page:
cd src/ksp/ksp/examples/tutorials
make ex2
the ex2.c is a c program code. I get the following error:
$ make ex2
makefile:18: /conf/variables: No such file or directory
makefile:19: /conf/rules: No such file or directory
makefile:1151: /conf/test: No such file or directory
make: *** No rule to make target `/conf/test'. Stop.
What is causing this?
(and more importantly)
How do I fix it?
*edit: I could use a general answer as well, because at the moment I don’t really even know what to Google for and I don’t feel like just contacting PETSc support for everything.
I’ve decided to work on Ubuntu. So now, here s the deal. After installation I write:
gcc -I$PETSC_DIR/include -L$PETSC_DIR/$PETSC_ARCH/lib -libpetsc ex2
in command line. I get the erros massage:
/usr/bin/ld: cannot find -libpetsc
ex2: In function_start':_start’
(.text+0x1bc4): multiple definition of
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.text+0x0): first defined here
ex2: In function_fini':_fini’
(.fini+0x0): multiple definition of
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o:(.fini+0x0): first defined here
ex2:(.rodata+0x0): multiple definition of_IO_stdin_used'__data_start’:
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here
ex2: In function
(.data+0x0): multiple definition of__data_start'__data_start’:
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o:(.data+0x0): first defined here
ex2: In function
(.data+0x8): multiple definition of__dso_handle'_init’:
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o:(.data+0x0): first defined here
ex2: In function
(.init+0x0): multiple definition of `_init’
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o:(.init+0x0): first defined here
collect2: ld returned 1 exit status
As mentioned on the PETSc web page under section Encounter problems? for problem related to
makeyou need to setPETSC_DIRandPETSC_ARCHprinted by configure.What is causing this?:
The
makefileinsrc/ksp/ksp/examples/tutorialsdirectory refers toPETSC_DIRto include the configuration files i.e.Now as you are executing
makeas justmake ex2(as from the error it indicates that you have not setPETSC_DIRvariable),${PETSC_DIR}is empty thusmaketries to include/conf/variables,/conf/rules&/conf/testfiles which are not present.How do I fix it?
You have to run
makeas mentioned on the website asmake PETSC_DIR=<dir_output_from_configure> PETSC_ARCH=<arch_output_from_configure> ex2Before that you need to build the source correctly. To clarify from what you have mentioned in the question
./configure ...does not install PETSc but only configures the source for building. You need to runmake. When you runconfigureif it was successful, it will output the configuration details includingPETSC_DIRandPETSC_ARCH. Sample output:Then you have run
make PETSC_DIR=/XXXX/petsc-3.3-p1 PETSC_ARCH=arch-linux2-c-debug allas mentioned in the output ofconfigure. This will build the libraries. Now you should be able to build the example. (Please note that this was run on Linux, you should pretty much be able to do the same on cygwin)Side note: There does not seem to be any need to set
PETSC_ARCHfor building the example, you should be able to build withmake PETSC_DIR=<dir_output_from_configure> ex2Hope this helps!