makefilecompiler-errorsmpipetsc

Header files not found by 'make'


The make instruction is not finding the libraries required for compilation. They are in other folder than the usual /usr/include folder.

I'm complying a simulation software called magnum.fe I already installed all the required dependencies (FEniCS = 1.5 CMake >= 2.8 SWIG >= 2.0 G++ >= 4.0) and started to run make as the instructions suggest.

$ cd /path/to/magnum.fe
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

But when running make I get the following error:

/usr/include/petscsys.h:136:12: fatal error: petsc/mpiuni/mpi.h: No such file or directory
  136 | #  include <petsc/mpiuni/mpi.h>
      |            ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

The files do exist, but in other folder: /home/myusername/bin/petsc/include/mpiuni/mpi.h

I compiled petsc on /home/myusername/bin/petsc/ with the following instruction:

$ ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack
$ make all check

It compiled it sucessfully but I couldn't get the magnum.fe compilation to finish.

I tried moving each header file to /usr/include but now I'm stuck on if moving the whole petsc directory into this folder. It must be a more elegant way to do it.

Thanks


Solution

  • I've made it!

    There are two options available:

    Specify the libraries to use with the make command editing the MAKEfile, use the variable LDLIBS to set it up. Detailed usage in here: https://web.archive.org/web/20070723140628/http://arco.inf-cr.uclm.es/~david.villa/doc/repo/make/make.html#AEN36

    or

    Create symbolic links pointing to /usr/include. In my case I used:

    ln -s /home/myusername/bin/petsc/include/* /usr/include