I installed a MPI program in /opt/mpi. In my Qt code, I use system( "mpiexec -machinefile host -n 1 app.exe") call to run the command, the code complains mpiexec can not be found
Although /opt/mpi/bin is in the path. There is no issue when I run the command manually. To solve this problem, I have to add the absolute path in front of mpiexec, like
system( "/opt/mpi/bin/mpiexec -machinefile host -n 1 app.exe").

I wrote a small C++ code to test the command above

#include <stdio.h>
#include <stdlib.h>

int main()
{
system( "mpiexec -machinefile host -n 1 app.exe" );
return 0;
}

the command runs successfully. It looks like system call inside Qt does not recognize the settings in Path.

Another problem is that app.exe uses a library abc.so in /opt/app/lib. When I run /opt/mpi/bin/mpiexec -machinefile host -n 1 app.exe, the code complains about abc.so can not be found.
However, from a pure C++ code or command line, no problem at all because I set abc.so path in LD_LIBRARY_PATH. It must be a Qt problem.

system call inside Qt ignores lib path too.

What is the root reason? Thanks for your help in advance.