<html>#1334: CCTK_CHECK_HEADER_LIB_FUNC adds library multiple times to $LIBS
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Frank Löffler</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td>development version</td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>Cactus</td></tr>
</table>

<p>Comment (by Roland Haas):</p>
<p>As <span class="ap-mention" data-atlassian-id="557058:cf051f66-042f-4a92-a2c7-f2be5a7912de">@Frank Löffler</span> 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.</p>
<p>Eg. <code>libA</code> contains <code>funcA1</code> and <code>funcA2</code>. <code>funcA1</code> calls <code>funcB1</code> in <code>libB</code> which itself calls <code>funcA2</code> in <code>libA</code>. The way to link these correctly for static linking is <code>-lA -lB -lA</code> 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 <em>already</em> knows that the object is required when it processes the library file. </p>
<p>This may not be an issue for <code>CCTK_CHECK_HEADER_LIB_FUNC</code> if it only ever uses a single library, but would be an issue if it ever added two libraries since <code>-lA -lB -lA -lB</code> is not the same as <code>-lA -lB</code>.</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/1334/cctk_check_header_lib_func-adds-library'>https://bitbucket.org/einsteintoolkit/tickets/issues/1334/cctk_check_header_lib_func-adds-library</a></p>
</html>