<div dir="ltr">Hi,<div><br></div><div>static libraries don&#39;t pull in dependencies automatically. Thus this error.</div><div>We could </div><div>1) Skip the check whether we can link the library (check_library_exists) if the library is static. Then if the library which was found is not OK (e.g. 32bit instead of 64bit, or host instead of Phi) then the user will only get a error at the end of the build.</div>

<div>2) Do the same as we do in FindFFTW and manually add the dependencies before check_library_exists:</div><div><div>  if (HAVE_LIBM)</div><div>    #adding MATH_LIBRARIES here to allow static libs, this does not harm us as we are anyway using it</div>

<div>    set(CMAKE_REQUIRED_LIBRARIES m)</div><div>  endif ()</div></div><div><br></div><div>Roland</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 3:35 PM, Szilárd Páll <span dir="ltr">&lt;<a href="mailto:pall.szilard@gmail.com" target="_blank">pall.szilard@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I&#39;m having trouble getting libxml2 detection pass with<br>
-DGMX_PREFER_STATIC_LIBS=ON with 5.0 release.<br>
<br>
I keep getting:<br>
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.a (found version &quot;2.7.8&quot;)<br>
-- Looking for xmlTextWriterEndAttribute in /usr/lib/x86_64-linux-gnu/libxml2.a<br>
-- Looking for xmlTextWriterEndAttribute in<br>
/usr/lib/x86_64-linux-gnu/libxml2.a - not found<br>
<br>
even though:<br>
nm -g /usr/lib/x86_64-linux-gnu/libxml2.a | grep -i xmlTextWriterEndAttribute<br>
0000000000001090 T xmlTextWriterEndAttribute<br>
<br>
It looks like the trouble is caused by some linking order issue<br>
because I see this in the CMakeError.log:<br>
<br>
/usr/bin/gcc-4.8  -Wno-maybe-uninitialized -Wextra<br>
-Wno-missing-field-initializers -Wno-sign-compare -Wpointer<br>
-arith -Wall -Wno-unused -Wunused-value -Wunused-parameter<br>
-DCHECK_FUNCTION_EXISTS=xmlTextWriterEndAttribute<br>
    CMakeFiles/cmTryCompileExec3409173216.dir/CheckFunctionExists.c.o<br>
-o cmTryCompileExec3409173216 -rdynamic<br>
 -Wl,-Bstatic -lxml2 -Wl,-Bdynamic<br>
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxml2.a(xmlIO.o):<br>
In function `xmlGzfileOpenW&#39;:<br>
(.text+0x253): undefined reference to `gzdopen&#39;<br>
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxml2.a(xmlIO.o):<br>
In function `xmlGzfileOpenW&#39;:<br>
(.text+0x285): undefined reference to `gzopen64&#39;<br>
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxml2.a(xmlIO.o):<br>
In function `xmlFreeZMemBuff&#39;:<br>
(.text+0x2f8): undefined reference to `deflateEnd&#39;<br>
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxml2.a(xmlIO.o):<br>
In function `xmlGzfileClose&#39;:<br>
(.text+0x995): undefined reference to `gzclose&#39;<br>
<br>
... and so one with all kinds of libz and even math.h functions listed.<br>
<br>
Any idea what&#39;s going on?<br>
<br>
Cheers,<br>
--<br>
Szilárd<br>
<span class="HOEnZb"><font color="#888888">--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.</font></span></blockquote>

</div><br><br clear="all"><div><br></div>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov">cmb.ornl.gov</a><br>865-241-1537, ORNL PO BOX 2008 MS6309
</div>