[MacPorts] #57990: libxml2 @2.9.7_2: ICU include directory not in pkg-config output

MacPorts noreply at macports.org
Fri Feb 1 12:12:01 UTC 2019


#57990: libxml2 @2.9.7_2: ICU include directory not in pkg-config output
-----------------------+--------------------
  Reporter:  dsedivec  |      Owner:  (none)
      Type:  defect    |     Status:  new
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.5.4
Resolution:            |   Keywords:
      Port:  libxml2   |
-----------------------+--------------------
Changes (by ryandesign):

 * cc: ryandesign (added)


Old description:

> Since [https://github.com/macports/macports-ports/commit/0ed53fa9e884ed50
> libxml2 now builds against ICU], I cannot build software against MacPorts
> libxml2 without manually including `-I$prefix/include` when building.
> Quick example:
>
> {{{
> $ command -v pkg-config
> /opt/local/bin/pkg-config
>
> $ cat repro.c
> /* Include inspired by PostGIS's configure script: */
> #include <libxml/tree.h>
>
> int main() { return 0; }
>
> $ clang $(pkg-config --cflags libxml-2.0) repro.c $(pkg-config --libs
> libxml-2.0)
> In file included from repro.c:2:
> In file included from /opt/local/include/libxml2/libxml/tree.h:1307:
> In file included from /opt/local/include/libxml2/libxml/xmlmemory.h:218:
> In file included from /opt/local/include/libxml2/libxml/threads.h:35:
> In file included from /opt/local/include/libxml2/libxml/globals.h:18:
> In file included from /opt/local/include/libxml2/libxml/parser.h:810:
> /opt/local/include/libxml2/libxml/encoding.h:31:10: fatal error:
> 'unicode/ucnv.h' file not found
> #include <unicode/ucnv.h>
>          ^~~~~~~~~~~~~~~~
> 1 error generated.
>
> $ clang -I/opt/local/include $(pkg-config --cflags libxml-2.0) repro.c
> $(pkg-config --libs libxml-2.0)
>
> $ ls a.out
> a.out*
> }}}
>
> After a brief conversation on IRC it was requested that I open a ticket
> for this, since the ICU cflags/libs flags should probably be included in
> pkg-config output for libxml-2.0 now.  (It was also suggested that maybe
> this is really an upstream issue, rather than MacPorts.)

New description:

 Since [changeset:0ed53fa9e884ed502af61d2d0db8146e4354467c/macports-ports
 libxml2 now builds against ICU], I cannot build software against MacPorts
 libxml2 without manually including `-I$prefix/include` when building.
 Quick example:

 {{{
 $ command -v pkg-config
 /opt/local/bin/pkg-config

 $ cat repro.c
 /* Include inspired by PostGIS's configure script: */
 #include <libxml/tree.h>

 int main() { return 0; }

 $ clang $(pkg-config --cflags libxml-2.0) repro.c $(pkg-config --libs
 libxml-2.0)
 In file included from repro.c:2:
 In file included from /opt/local/include/libxml2/libxml/tree.h:1307:
 In file included from /opt/local/include/libxml2/libxml/xmlmemory.h:218:
 In file included from /opt/local/include/libxml2/libxml/threads.h:35:
 In file included from /opt/local/include/libxml2/libxml/globals.h:18:
 In file included from /opt/local/include/libxml2/libxml/parser.h:810:
 /opt/local/include/libxml2/libxml/encoding.h:31:10: fatal error:
 'unicode/ucnv.h' file not found
 #include <unicode/ucnv.h>
          ^~~~~~~~~~~~~~~~
 1 error generated.

 $ clang -I/opt/local/include $(pkg-config --cflags libxml-2.0) repro.c
 $(pkg-config --libs libxml-2.0)

 $ ls a.out
 a.out*
 }}}

 After a brief conversation on IRC it was requested that I open a ticket
 for this, since the ICU cflags/libs flags should probably be included in
 pkg-config output for libxml-2.0 now.  (It was also suggested that maybe
 this is really an upstream issue, rather than MacPorts.)

--

Comment:

 And just blindly adding `-I${prefix}/include` to libxml2's pkgconfig file
 can have other consequences. See how I
 [changeset:e302b20bdd71e9e16b142c525d8d809ee56ffd05/macports-ports fixed
 this issue] for glib2 by patching glib2's header to `#include` the
 absolute path of the non-glib2 header it was requiring. I suggest doing
 something similar for libxml2: patching encoding.h so that it `#include`s
 the absolute path of ucnv.h.

-- 
Ticket URL: <https://trac.macports.org/ticket/57990#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list