#1334: CCTK_CHECK_HEADER_LIB_FUNC adds library multiple times to $LIBS
| Reporter: | Frank Löffler |
| Status: | new |
| Milestone: | |
| Version: | development version |
| Type: | bug |
| Priority: | minor |
| Component: | Cactus |
Comment (by Roland Haas):
As @Frank Löffler mentions, adding a library multiple times is harmless. Sometimes, for static linking, it is even required if there are two libraries that require functions from each other.
Eg. libA contains funcA1 and funcA2. funcA1 calls funcB1 in libB which itself calls funcA2 in libA. The way to link these correctly for static linking is -lA -lB -lA that is one has to repeat one (or the other) of the libraries since the linker acts on the library list only once and does so sequentially and will only include objects from a library that if it already knows that the object is required when it processes the library file.
This may not be an issue for CCTK_CHECK_HEADER_LIB_FUNC if it only ever uses a single library, but would be an issue if it ever added two libraries since -lA -lB -lA -lB is not the same as -lA -lB.
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/1334/cctk_check_header_lib_func-adds-library