I'm a new linux user. I'm getting this error during compilation. When I use the 'make' command within a build directory.
Fatal Error: mpi.h No such file or directory
I've installed OpenMpi using this:
sudo apt install libopenmpi-dev
I found the folder where mpi.h is located: and I attempted to add it to path:
export PATH=$PATH:/usr/lib/x86_64-linux-gnu/openmpi/include
I still get the same error when I try 'make'. What am I doing wrong? Thanks.
Edit: I think I'm using the G++ compiler, here's the full error message:
Making all in Ipopt
make[1]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt'
Making all in src/Common
make[2]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Common'
make all-am
make[3]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Common'
make[3]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Common'
make[2]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Common'
Making all in src/LinAlg
make[2]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg'
Making all in TMatrices
make[3]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg/TMatrices'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg/TMatrices'
make[3]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg'
make[2]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/LinAlg'
Making all in src/Algorithm
make[2]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Algorithm'
Making all in LinearSolvers
make[3]: Entering directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Algorithm/LinearSolvers'
if /bin/bash ../../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers` -I../../../src/Common -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/../../Common` -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/../../LinAlg` -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/../../LinAlg/TMatrices` -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/..` -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/../../Interfaces` -I`echo ../../../../../Ipopt/src/Algorithm/LinearSolvers/../../contrib/CGPenalty` -I/home/rory/Packages/Ipopt/include/coin-or/mumps -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DIPOPT_BUILD -MT IpMumpsSolverInterface.lo -MD -MP -MF ".deps/IpMumpsSolverInterface.Tpo" -c -o IpMumpsSolverInterface.lo ../../../../../Ipopt/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp; \
then mv -f ".deps/IpMumpsSolverInterface.Tpo" ".deps/IpMumpsSolverInterface.Plo"; else rm -f ".deps/IpMumpsSolverInterface.Tpo"; exit 1; fi
g++ -DHAVE_CONFIG_H -I. -I../../../../../Ipopt/src/Algorithm/LinearSolvers -I../../../src/Common -I../../../../../Ipopt/src/Algorithm/LinearSolvers/../../Common -I../../../../../Ipopt/src/Algorithm/LinearSolvers/../../LinAlg -I../../../../../Ipopt/src/Algorithm/LinearSolvers/../../LinAlg/TMatrices -I../../../../../Ipopt/src/Algorithm/LinearSolvers/.. -I../../../../../Ipopt/src/Algorithm/LinearSolvers/../../Interfaces -I../../../../../Ipopt/src/Algorithm/LinearSolvers/../../contrib/CGPenalty -I/home/rory/Packages/Ipopt/include/coin-or/mumps -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DIPOPT_BUILD -MT IpMumpsSolverInterface.lo -MD -MP -MF .deps/IpMumpsSolverInterface.Tpo -c ../../../../../Ipopt/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp -fPIC -DPIC -o .libs/IpMumpsSolverInterface.o
../../../../../Ipopt/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp:22:10: fatal error: mpi.h: No such file or directory
#include "mpi.h"
^~~~~~~
compilation terminated.
Makefile:569: recipe for target 'IpMumpsSolverInterface.lo' failed
make[3]: *** [IpMumpsSolverInterface.lo] Error 1
make[3]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Algorithm/LinearSolvers'
Makefile:688: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt/src/Algorithm'
Makefile:679: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/rory/Packages/Ipopt/build/Ipopt'
Makefile:323: recipe for target 'all-recursive' failed
mpic++
. It is a wrapper around the system C++ compiler that passes it all the necessary arguments needed to find the MPI header file and link the necessary MPI libraries. That's usually achieved by setting theCXX
variable in the environment. – Illdisposedexport CXX=mpic++ && make
or simplyCXX=mpic++ make
.CXX
is not normally set in the environment, in which casemake
uses the default value. – IlldisposedMakefile
is generated by GNU Autotools, you have to setCXX
when running theconfigure
script. – Illdisposed