Error compiling new fault constitutive law

Hi everyone,

I’m new to all this programming and compile, so I’m using the binarie version of Pylith and when i tried write the code for the rate-state friction law regularization described by Lapusta, and run the ./config I received the next error

checking whether we can link a trivial C++ MPI program… no
configure: error: in /home/jenekew/Documentos/Ivan/Tesis/pylith/src/pylith-2.2.2/templates/friction': configure: error: cannot link a trivial C++ MPI program using g++ See config.log’ for more details

When I go to the config.log file this is what I got

| /* end confdefs.h. */
| #include <stdio.h>
| #include <mpi.h>
| int
| main ()
| {
| MPI_Init(0,0);
| MPI_Finalize();
| ;
| return 0;
| }
configure:12377: result: no
configure:12379: error: in `/home/jenekew/Documentos/Ivan/Tesis/pylith/src/pylith-2.2.2/templates/friction’:
configure:12381: error: cannot link a trivial C++ MPI program using g++

I can upload the log file if anyone wants to read it and help me,

Thank you!

Hi. It looks to me like you’re missing MPI on your machine. I’m not sure if it’s possible to configure things without MPI. You should at least have a C/C++ compiler with MPI (something like mpicc and/or mpicxx). If you’re using a package manager it should be easy to install these (make sure you also install the header files). Otherwise, you may need to build your own MPI.



Actually, I’ve already have OpenMPI installed on my machine via:

sudo apt-get install openmpi-bin

and I’ve compilled another simple code with it, but it doesn’t seems to work with pylith.


Hi Ivan, Do you have the development headers installed? What do you get when you type:

mpicc --show

When I do this on my Linux machine I get:

gcc -I/usr/include/openmpi-x86_64 -pthread -Wl,-rpath -Wl,/usr/lib64/openmpi/lib -Wl,–enable-new-dtags -L/usr/lib64/openmpi/lib -lmpi

You should make sure that the directories shown all exist. Otherwise, you may be missing a package. On my machine (Fedora) I have installed both:



The problem is that configure by default uses the g++ compiler. The expectation is that if you are using the binary, you must use all of the tools supplied with the binary, because the corresponding tools with your operating system may be incompatible.

Digging a little deeper shows that the MPI compiler wrapper included with the binary will attempt to use directory structure from the machine where I made the binary, not your local version. Consequently, you will need to build from source using the PyLith installer if you want to extend the code.

Thinking about this some more, I think we can simply add some flags to configure so that either the MPI compiler wrappers will work or we set equivalent flags for the gcc/g++ compiler. I will try to work on finding the solution later today.

I have tried to build the friction templates using both the MacOS and Linux PyLith binary packages. Both failed. In theory, we should be able to correct the problems on Linux for the next release. I don’t know if we can fix the problems on MacOS. Final answer for now: you need to build PyLith from source in order to add additional modules like the one in templates/friction.


We use install_name_tool to set the path relative from the executable to the library. This works great for the pylith executable and utilities, but not building a new library or module. In fact, the friction/templates configure tests that try to link against the MPI library fail.


It should be possible to build a new library/module on Linux by setting the correct paths to the header files and libraries included with the binary. On my Linux machine, I found that some low-level compiler related files were missing. Unfortunately, I can no longer access the virtual machine I used to create the binary (IT security related issues), so I can’t easily add those missing files.

Thanks for helping me with this!
Now everythig becomes more clear, I was afraid I was doing something wrong.

So now, I will build Pylith from source and try again after that.


Iván Navarrete