title: Signal: Segmentation fault (11) in PETSc in Ubuntu
body: <p>I am new in MPI and PETSc. I installed PETSc and MPICH2 in my system and trying to run the simplest Hello World. But in place of the intended output, a lot of gibberish is coming out.</p>
  
  <p>My make file is :</p>
  
  <pre><code>ALL:exam_petsc1
  
  CFLAGS          =
  FFLAGS          =
  CPPFLAGS        =
  FPPFLAGS        =
  CLEANFILES      = exam_petsc1
  
  include ${PETSC_DIR}/conf/variables
  include ${PETSC_DIR}/conf/rules
  
  exam_petsc1: exam_petsc1.o chkopts
      ${CLINKER} -o exam_petsc1 exam_petsc1.o  ${PETSC_LIB}
      ${RM} exam_petsc1.o
  </code></pre>
  
  <p>My program is:</p>
  
  <pre><code>#include &lt;petscksp.h&gt;
  
  int main(int argc, char *argv[])
  {
  PetscInitialize(&amp;argc,&amp;argv,PETSC_NULL,PETSC_NULL);
  PetscPrintf(PETSC_COMM_WORLD,"Hi\n");
  PetscFinalize();
  return 0;
  }
  </code></pre>
  
  <p>"make" in the terminal does not gives, but the following</p>
  
  <pre><code>/usr/bin/mpicc -o exam_petsc1.o -c -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -fno-inline -O0 -I/home/soumyadipta/PETSC/petsc-3.3-p1/include -I/home/soumyadipta/PETSC/petsc-3.3-p1/arch-linux2-c-debug/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -D__INSDIR__= exam_petsc1.cpp
  
  /usr/bin/mpicc -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -fno-inline -O0  -o exam_petsc1 exam_petsc1.o  -Wl,-rpath,/home/soumyadipta/PETSC/petsc-3.3-p1/arch-linux2-c-debug/lib -L/home/soumyadipta/PETSC/petsc-3.3-p1/arch-linux2-c-debug/lib  -lpetsc -lpthread -llapack -lblas -Wl,-rpath,/usr/lib/openmpi/lib -L/usr/lib/openmpi/lib -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.6.1 -L/usr/lib/gcc/x86_64-linux-gnu/4.6.1 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -lmpi_f90 -lmpi_f77 -lgfortran -lm -lgfortran -lm -lgfortran -lm -lm -lquadmath -lm -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl 
  /bin/rm -f exam_petsc1.o
  </code></pre>
  
  <p>"mpiexec -np 4 exam_petsc1" gives a long list of errors as bellow....</p>
  
  <pre><code>[SoumyadiptaS:13130] *** Process received signal ***
  [SoumyadiptaS:13130] Signal: Segmentation fault (11)
  [SoumyadiptaS:13130] Signal code: Address not mapped (1)
  [SoumyadiptaS:13130] Failing at address: 0x44000098
  [SoumyadiptaS:13128] *** Process received signal ***
  [SoumyadiptaS:13128] Signal: Segmentation fault (11)
  [SoumyadiptaS:13128] Signal code: Address not mapped (1)
  [SoumyadiptaS:13128] Failing at address: 0x44000098
  [SoumyadiptaS:13130] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f50398e9060]
  [SoumyadiptaS:13130] [ 1] /usr/lib/libmpi.so.0(PMPI_Comm_set_errhandler+0x60) [0x7f50391efc80]
  [SoumyadiptaS:13130] [ 2] exam_petsc1(PetscInitialize+0x515) [0x41cec9]
  [SoumyadiptaS:13130] [ 3] exam_petsc1(main+0x29) [0x40d89d]
  [SoumyadiptaS:13130] [ 4] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f5038e2030d]
  [SoumyadiptaS:13130] [ 5] exam_petsc1() [0x40d7b9]
  [SoumyadiptaS:13130] *** End of error message ***
  [SoumyadiptaS:13129] *** Process received signal ***
  [SoumyadiptaS:13129] Signal: Segmentation fault (11)
  [SoumyadiptaS:13129] Signal code: Address not mapped (1)
  [SoumyadiptaS:13129] Failing at address: 0x44000098
  [SoumyadiptaS:13128] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f5e8c830060]
  [SoumyadiptaS:13128] [ 1] /usr/lib/libmpi.so.0(PMPI_Comm_set_errhandler+0x60) [0x7f5e8c136c80]
  [SoumyadiptaS:13128] [ 2] exam_petsc1(PetscInitialize+0x515) [0x41cec9]
  [SoumyadiptaS:13128] [ 3] exam_petsc1(main+0x29) [0x40d89d]
  [SoumyadiptaS:13128] [ 4] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f5e8bd6730d]
  [SoumyadiptaS:13128] [ 5] exam_petsc1() [0x40d7b9]
  [SoumyadiptaS:13128] *** End of error message ***
  [SoumyadiptaS:13131] *** Process received signal ***
  [SoumyadiptaS:13131] Signal: Segmentation fault (11)
  [SoumyadiptaS:13131] Signal code: Address not mapped (1)
  [SoumyadiptaS:13131] Failing at address: 0x44000098
  [SoumyadiptaS:13131] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f9e7c261060]
  [SoumyadiptaS:13131] [ 1] /usr/lib/libmpi.so.0(PMPI_Comm_set_errhandler+0x60) [0x7f9e7bb67c80]
  [SoumyadiptaS:13131] [ 2] exam_petsc1(PetscInitialize+0x515) [0x41cec9]
  [SoumyadiptaS:13131] [ 3] exam_petsc1(main+0x29) [0x40d89d]
  [SoumyadiptaS:13131] [ 4] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f9e7b79830d]
  [SoumyadiptaS:13131] [ 5] exam_petsc1() [0x40d7b9]
  [SoumyadiptaS:13131] *** End of error message ***
  --------------------------------------------------------------------------
  mpiexec noticed that process rank 2 with PID 13130 on node SoumyadiptaS exited on signal 11 (Segmentation fault).
  --------------------------------------------------------------------------
  [SoumyadiptaS:13129] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060) [0x7f73a8ac2060]
  [SoumyadiptaS:13129] [ 1] /usr/lib/libmpi.so.0(PMPI_Comm_set_errhandler+0x60) [0x7f73a83c8c80]
  [SoumyadiptaS:13129] [ 2] exam_petsc1(PetscInitialize+0x515) [0x41cec9]
  [SoumyadiptaS:13129] [ 3] exam_petsc1(main+0x29) [0x40d89d]
  [SoumyadiptaS:13129] [ 4] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f73a7ff930d]
  [SoumyadiptaS:13129] [ 5] exam_petsc1() [0x40d7b9]
  [SoumyadiptaS:13129] *** End of error message ***
  </code></pre>
  
  <p>Whats wrong with my program???</p>