<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I believe I have gained an understanding of this. See “man ld” and the following statement under the description of the “-l” option: “The linker will search an archive only once, at the location where it is specified on the command line.
If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command
line will not cause the linker to search the archive again.”<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In the command:<o:p></o:p></p>
<p class="MsoNormal">configure:15903: g++ -o conftest -g -O2 -I/usr/include -L/usr/lib -lbotan -Wl,-Bsymbolic-functions conftest.cpp >&5<o:p></o:p></p>
<p class="MsoNormal">the parameter -lbotan appears before the parameter conftest.cpp on the command line. Therefore the libbotan.so library is searched for undefined symbols before any symbols are defined in conftest.cpp, and so none are found. When conftest.cpp
is eventually compiled and linked, libbotan.so is not searched again, and the symbols remain undefined.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">To verify this, I created a test file “botantest.cpp” based on the botan test code in config.log as follows:<o:p></o:p></p>
<p class="MsoNormal">#include <botan/botan.h><o:p></o:p></p>
<p class="MsoNormal">#include <botan/hash.h><o:p></o:p></p>
<p class="MsoNormal">int<o:p></o:p></p>
<p class="MsoNormal">main ()<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> using namespace Botan;<o:p></o:p></p>
<p class="MsoNormal"> LibraryInitializer::initialize();<o:p></o:p></p>
<p class="MsoNormal"> HashFunction *h = get_hash("MD5");<o:p></o:p></p>
<p class="MsoNormal"> return 0;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Compiling it with the command:<o:p></o:p></p>
<p class="MsoNormal">g++ -o botantest -I/usr/include -L/usr/lib -lbotan botantest.cpp<o:p></o:p></p>
<p class="MsoNormal">generates the two undefined reference errors previously posted.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">However, changing the command to:<o:p></o:p></p>
<p class="MsoNormal">g++ -o botantest -I/usr/include -L/usr/lib botantest.cpp -lbotan<o:p></o:p></p>
<p class="MsoNormal">causes it to execute with no errors.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I looked at the configure script, and it appears that the function ac_fn_cxx_try_link is what is relevant to this problem. I confess to not having been able to figure out exactly how that works.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Jeffry A. Spain<br>
Network Administrator<br>
</span><span style="color:blue">Cincinnati Country Day School</span><span style="color:#1F497D"><br>
<br>
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>