<div dir="ltr">Hi,<div><br></div><div>Yes, perhaps that call to check_library_exists can be improved, e.g. by setting CMAKE_REQUIRED_LIBRARIES for the check (see <a href="https://cmake.org/cmake/help/v3.0/module/CheckLibraryExists.html">https://cmake.org/cmake/help/v3.0/module/CheckLibraryExists.html</a>). However, it is awkward to do a good job here, because libxml2 only requires zlib if the former was configured that way, so we have a fairly large number of conditions to handle in constructing our handling (shared/static, whether either was found, whether libxml2 needs zlib or not, whether test binaries need to be built, etc.).</div><div><br></div><div>Roland suggested <a href="https://gerrit.gromacs.org/#/c/5630/2">https://gerrit.gromacs.org/#/c/5630/2</a> but I am not sure if it is related.</div><div><br></div><div>Alternatively/also, since currently the only use for XML handling in master branch is for test reference data, I have uploaded <a href="https://gerrit.gromacs.org/#/c/5653/">https://gerrit.gromacs.org/#/c/5653/</a> to replace this use of libxml2 with a bundled copy of tinyxml2, as part of <a href="http://redmine.gromacs.org/issues/1908">http://redmine.gromacs.org/issues/1908</a> so that we get rid of such problematic external dependencies. These have been causing grief lately for users on BG/Q machines. I suggest we keep libxml2 detection and handling present but inactive while the future of various patches in Gerrit gets resolved.</div><div><br></div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 10, 2016 at 4:37 PM Szilárd Páll &lt;<a href="mailto:pall.szilard@gmail.com">pall.szilard@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
$ cmake -DGMX_PREFER_STATIC_LIBS=ON -DGMX_BUILD_UNITTESTS=ON<br>
<br>
[...]<br>
-- Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.a<br>
-- Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.a - found<br>
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.a (found version &quot;2.9.1&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>
CMake Error at CMakeLists.txt:562 (message):<br>
  Cannot build unit tests without libxml2.  Either set<br>
  GMX_BUILD_UNITTESTS=OFF or tell CMake how to find a working version of<br>
  libxml2.<br>
<br>
Even though both libz and libxml are detected, the<br>
xmlTextWriterEndAttribute lib test fails to link as the<br>
check_library_exists() does not pass -lz.<br>
<br>
I vaguely remember some discussion around it so I thought I&#39;d ask<br>
whether this is a known issue before filing a report.<br>
<br>
Are there any simple workarounds for this? (I tried passing -lz in the<br>
linker flags, but that does not help).<br>
Could we provide a better hint in the error?<br>
<br>
Cheers,<br>
--<br>
Szilárd<br>
--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" target="_blank">gmx-developers-request@gromacs.org</a>.</blockquote></div>