<html>#2679: How to link an externally compiled library during ET compilation
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Maria Mutz</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>I have compiled the COCAL code separately from the ET, generating a library for which I have the .a file. I’m trying to link to that library when compiling the ET on Expanse. When I try to link it without copying all the source files in the thorn that uses it into the src directory I get “undefined reference to” errors for anything in a subdirectory. I tried moving all the files in subdirectories into the src directory as a work-around, but then I started getting errors that look like this:</p>
<p>‌</p>
<p>‌</p>
<p>```</p>
<p>‌</p>
<p>/lib/../lib64/crt1.o: In function `_start':</p>
<p>(.text+0x24): undefined reference to `main'</p>
<p>collect2: error: ld returned 1 exit status</p>
<p>make[3]: *** [&lt;builtin&gt;: include_modulefiles_MRNS.f90] Error 1</p>
<p>make[2]: *** [/home/mmutz/Cactus/lib/make/make.thornlib:113: make.checked] Error 2</p>
<p>make[1]: *** [/home/mmutz/Cactus/lib/make/make.configuration:179: /home/mmutz/Cactus/configs/sim17/lib/libthorn_Cocalthorn.a] Error 2</p>
<p>```</p>
<p>‌</p>
<p>What is the proper way to link the library during compilation?</p>
<p>I’ve attached a copy of my config file.</p>
<p>‌</p>
<p><table><tr><td>attachment:</td><td><a href="https://api.bitbucket.org/2.0/repositories/einsteintoolkit/tickets/issues/2679/attachments/OptionList.pdf">OptionList.pdf</a></td></tr>
</table></p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2679/how-to-link-an-externally-compiled-library'>https://bitbucket.org/einsteintoolkit/tickets/issues/2679/how-to-link-an-externally-compiled-library</a></p>
</html>