[gmx-developers] libxml2 detection problem (bug?)

Roland Schulz roland at utk.edu
Wed Jul 2 21:44:00 CEST 2014


Hi,

static libraries don't pull in dependencies automatically. Thus this error.
We could
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.
2) Do the same as we do in FindFFTW and manually add the dependencies
before check_library_exists:
  if (HAVE_LIBM)
    #adding MATH_LIBRARIES here to allow static libs, this does not harm us
as we are anyway using it
    set(CMAKE_REQUIRED_LIBRARIES m)
  endif ()

Roland




On Wed, Jul 2, 2014 at 3:35 PM, Szilárd Páll <pall.szilard at gmail.com> wrote:

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




-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20140702/c478967d/attachment.html>


More information about the gromacs.org_gmx-developers mailing list