The "relinking" warning is emitted when installing, not when compiling. Libtool warns you that it is running a potentially slow command during the install. There may be different reasons for relinking.
In case of mpich
, the reason is completely innocuous. The libmpicxx
library depends on libmpi
library. Both are built from the same source. Libtool ensures that if you run any executable in the build directory, it would use the libraries from the build directory rather than the installed library.
There is no way to make sure (at least on Linux) that libmpicxx
would use the locally built libmpi
library without hardcoding the library search path (so called RPATH) into libmpicxx
.
For the installed libraries, the requirement is that they never refer to the build tree where they were built. So the RPATH needs to be eliminated from the installed libmpicxx
library. That is done by relinking it.
Once again, the warning is not about you or the package doing anything wrong, it's about a potentially slow operation at the install stage (slow operations at the build stage are expected and don't need a warning).