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 663214 - unicode/ucnv.h: No such file or directory with --prefix
unicode/ucnv.h: No such file or directory with --prefix
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: general
2.7.8
Other Mac OS
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-02 02:34 UTC by Luke Scott
Modified: 2021-07-05 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to make configure.ac honor ICU_CONFIG from environment (418 bytes, patch)
2014-11-02 19:19 UTC, Arto Bendiken
none Details | Review

Description Luke Scott 2011-11-02 02:34:46 UTC
Running:

export PATH=/Server/software/bin:$PATH
./configure --prefix=/Server/software --enable-shared --enable-static --with-icu
make

Results in:

./include/libxml/encoding.h:31:26: error: unicode/ucnv.h: No such file or directory
In file included from ./include/libxml/parser.h:807,
                 from ./include/libxml/globals.h:18,
                 from ./include/libxml/threads.h:35,
                 from ./include/libxml/xmlmemory.h:218,
                 from SAX.c:15:
./include/libxml/encoding.h:133: error: expected specifier-qualifier-list before 'UConverter'
./include/libxml/encoding.h:135: warning: struct has no members
make[2]: *** [SAX.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

The offending code:

#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
#endif

Also "export PATH=/Server/software/bin:$PATH" is a work around for this in configure.in:

WITH_ICU=0
if test "$with_icu" != "yes" ; then
    echo Disabling ICU support
else
    ICU_CONFIG=icu-config
    if ${ICU_CONFIG} --cflags >/dev/null 2>&1
    then
        ICU_LIBS=`icu-config --ldflags`
        LDFLAGS="$LDFLAGS $ICU_LIBS"
        WITH_ICU=1
        echo Enabling ICU support
    else
        AC_MSG_ERROR([libicu config program icu-config not found])
    fi
fi

Specifically:

ICU_CONFIG=icu-config

Which assumes icu-config is in PATH. For this there needs to be a --with-icu=/Server/software or --with-icu-dir=/Server/software but the current configure.in doesn't support it.

It compiles fine without "--with-icu", but this is needed when mixing libxml2 and icu when using PHP's --enable-intl option. 

Not sure if this is platform specific. I know that the version of libxml2 that comes with Mac OS X is pretty recent and also has this problem.
Comment 1 Steven R. Loomis 2013-10-03 00:52:26 UTC
also, please use pkg-config instead of icu-config. http://userguide.icu-project.org/howtouseicu
Comment 2 Daniel Veillard 2013-10-03 01:21:40 UTC
To the original bug report: the problem is that the ICU program was installed
on a non-standard path or that they dropped icu-config somehow.
ICU should not be needed for PHP support of libxml2, if they do then there is
a bug somewhere, or your platform lack proper iconv support.

On the comment of using pkg-config, it is not available on all the targeted
platforms, so in general I cannot rely on it for libxml2 configure, unless
dropping some support on some architecture. I would take a patch trying
pkg-config for ICU as long as there is a fallback to icu-config for platforms
without it.

In any case ICU support is completely optional and should not change libxml2
behaviour in any system with a decent iconv implementation.

Daniel
Comment 3 Steven R. Loomis 2013-10-03 01:39:47 UTC
(In reply to comment #2)
> .. I would take a patch trying
> pkg-config for ICU as long as there is a fallback to icu-config for platforms
> without it. ..  In any case ICU support is completely optional and should not change libxml2 behaviour in any system with a decent iconv implementation.

Daniel, 
thanks for the reply. I think what I will do is make up a "recipe" for using pkg-config and icu-config in configure, and post that. I'll report back here when done.
Comment 4 Daniel Veillard 2013-10-03 02:48:55 UTC
That would be nice indeed. libxml2 configure is a bit more complex than
usual due to the insane portability requirements of the library :-)

Daniel
Comment 5 Steven R. Loomis 2014-01-31 00:36:35 UTC
(In reply to comment #4)
> That would be nice indeed. libxml2 configure is a bit more complex than
> usual due to the insane portability requirements of the library :-)
> 
> Daniel

work in progress here - http://bugs.icu-project.org/trac/browser/icuapps/branches/srl/10465pkgconfig/acinclude.m4

attached to this ticket: http://bugs.icu-project.org/trac/ticket/10465
Comment 6 Arto Bendiken 2014-11-02 19:19:40 UTC
Created attachment 289848 [details] [review]
Patch to make configure.ac honor ICU_CONFIG from environment
Comment 7 Arto Bendiken 2014-11-02 19:20:52 UTC
I also ran into (with libxml2 2.9.2) the problem of ./configure looking for the `icu-config` program in the PATH instead of under the configured prefix directory:

    checking iconv.h usability... yes
    checking iconv.h presence... yes
    checking for iconv.h... yes
    checking for iconv... yes
    checking for iconv declaration... 
    	extern size_t iconv (iconv_t cd,  char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
    configure: error: libicu config program icu-config not found

As in the original submitter's case, I'm trying to compile a self-contained set of shared libraries, including ICU4C and libxml2, so everything must honor the configured prefix.

Googling a bit, this problem affects many downstream users and distributions. The obvious patch is for configure.ac to permit ICU_CONFIG to be specified in the environment, as in the following:

https://github.com/easior/gentoo-bionic/blob/master/dev-libs/libxml2/files/libxml2-2.7.8-icu-config.patch

Note that in Gentoo currently, they more drastically just patch configure.ac to use PKG_CHECK_MODULES instead:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch?view=markup

I've attached a patch against 2.9.2 that permits ICU_CONFIG to be specified in the environment. That solves this specific problem since one can then just run configure with an additional ICU_CONFIG=$(prefix)/bin/icu-config argument.
Comment 8 David Kilzer 2016-01-06 00:11:44 UTC
See also:  Bug 760190: configure.ac should be able to build --with-icu without icu-config tool
Comment 9 GNOME Infrastructure Team 2021-07-05 13:20:37 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.