After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764657 - configure finds lzma via pkg-config, but then forgets to add the required CFLAGS and LDFLAGS (-I/path and -L/path)
configure finds lzma via pkg-config, but then forgets to add the required CFL...
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Mac OS
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-05 17:39 UTC by Mojca Miklavec
Modified: 2017-11-27 13:54 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mojca Miklavec 2016-04-05 17:39:27 UTC
This report is about version 2.9.3 (there was no appropriate entry in the "versions" field to indicate that). I was installing libxml2 as part of "gem install nokogiri" on Mac OS X 10.7. I will try to explain as accurately as I can what went wrong, even if I'm not 100% sure how to control all the variables.

Here is the failure:

Extracting libxml2-2.9.3.tar.gz into tmp/x86_64-apple-darwin11.4.2/ports/libxml2/2.9.3... OK
Running 'configure' for libxml2 2.9.3... OK
Running 'compile' for libxml2 2.9.3... ERROR, review '/Users/me/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.8.rc3/ext/nokogiri/tmp/x86_64-apple-darwin11.4.2/ports/libxml2/2.9.3/compile.log' to see what happened. Last lines are:
========================================================================
cc1: warning: -Wuninitialized is not supported without -O
  CC       parserInternals.lo
cc1: warning: -Wuninitialized is not supported without -O
  CC       parser.lo
cc1: warning: -Wuninitialized is not supported without -O
  CC       tree.lo
cc1: warning: -Wuninitialized is not supported without -O
  CC       hash.lo
cc1: warning: -Wuninitialized is not supported without -O
  CC       list.lo
cc1: warning: -Wuninitialized is not supported without -O
  CC       xmlIO.lo
cc1: warning: -Wuninitialized is not supported without -O
xmlIO.c: In function ‘xmlXzfileClose’:
xmlIO.c:1450: error: ‘LZMA_OK’ undeclared (first use in this function)
xmlIO.c:1450: error: (Each undeclared identifier is reported only once
xmlIO.c:1450: error: for each function it appears in.)
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


The reason for the failure is as follows:

    PKG_CHECK_MODULES([LZMA],[liblzma],
        [have_liblzma=yes],                   # -> yes
        [have_liblzma=no])

     # If pkg-config failed, fall back to AC_CHECK_LIB. This
     # will not pick up the necessary LIBS flags for liblzma's
     # private dependencies, though, so static linking may fail.
     if test "x$have_liblzma" = "xno"; then
                                              # -> skipped
     else
       # we still need to check for lzma,h header
       AC_CHECK_HEADERS([lzma.h])             # -> fails, but have_liblzma is still 'yes'
     fi

    # Found the library via either method?
    if test "x$have_liblzma" = "xyes"; then   # -> true
        AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
        WITH_LZMA=1
    fi

The problem is that the results of
    pkg-config --cflags liblzma
and
    pkg-config --libs liblzma
never get evaluated and thus never get added to C[XX]FLAGS and LDFLAGS, the necessary functions are missing, but HAVE_LIBLZMA is defined and leads to compile failures.
Comment 2 Nick Wellnhofer 2017-11-27 13:54:03 UTC
Should be fixed with https://git.gnome.org/browse/libxml2/commit/?id=cb5541c9f34fc29b0d7b8d89a3122c3fa46a6068

Note that we now simply assume that lzma.h and zlib.h are available if pkg-config finds the libraries.