<html>#2772: Issues link against Kadath thorns and Intel MKL due to link ordering
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>tootle</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></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>major</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

<p>A recurring issue that keeps coming up with the KadathThorn/Importer is centered around linking when using intel MKL.  It is worth noting that this is not restricted to the ETK, but I had not been able to reproduce the error myself until now.</p>
<p>The problem is resolved if I specify all of the dependencies of Kadath in a specific order in the final build command that outputs the cactus executable. e.g, adding the following directly after -lkadath:</p>
<div class="codehilite"><pre><span></span>-lgsl -lgslcblas -lfftw3 -L<span class="cp">${</span><span class="n">MKLROOT</span><span class="cp">}</span>/lib/ -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_blacs_intelmpi_lp64 -Wl,--end-group -lgomp -lpthread -lmkl_scalapack_lp64 -lm -ldl
</pre></div>


<p>results in a working executable on the local HPC in Idaho.  Excluding this link order or adding it somewhere else in the command other than directly after -lkadath will result in an executable that yields undefined behavior. Note: the undefined behavior leads to a crash during ID import from all known cases (in and out of the ETK) where this problem has come up. </p>
<p>Solution:</p>
<ol>
<li>Ability to specify a controlled link order in the options.cfg file (LDFLAGS does not work)</li>
<li>Ability to specify a controlled link order during the build script of KadathThorn</li>
</ol>
<p>‌</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2772/issues-link-against-kadath-thorns-and'>https://bitbucket.org/einsteintoolkit/tickets/issues/2772/issues-link-against-kadath-thorns-and</a></p>
</html>