What is `relinking` warning?
Asked Answered
D

1

13

While compiling mpich, I got a few relinking warnings...

libtool: warning: relinking 'lib/libmpicxx.la'

I have not been able to find out what these mean by googling the error message. What is relinking? Why is it caused and how can I get rid of it?

Darfur answered 15/4, 2015 at 19:51 Comment(2)
you're trying to link the same library twice into a single binary.Solvable
So, does it create dead code in the binary? Does the linker take care of this?Darfur
B
14

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).

Broomstick answered 12/2, 2016 at 5:57 Comment(3)
Why does it need full relinking instead of something like chrpath?Brick
@Ruslan, I believe the reasoning was that relinking is more universal. It works whenever linking works, whereas chrpath may be missing on the system. Libtool, like other GNU autotools, is designed to generate very portable packages with minimal dependencies.Broomstick
They should write: "warning: potentially slow operation: relinking...."Rojas

© 2022 - 2024 — McMap. All rights reserved.