GNOME Bugzilla – Bug 663214
unicode/ucnv.h: No such file or directory with --prefix
Last modified: 2021-07-05 13:20:37 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.
also, please use pkg-config instead of icu-config. http://userguide.icu-project.org/howtouseicu
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
(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.
That would be nice indeed. libxml2 configure is a bit more complex than usual due to the insane portability requirements of the library :-) Daniel
(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
Created attachment 289848 [details] [review] Patch to make configure.ac honor ICU_CONFIG from environment
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.
See also: Bug 760190: configure.ac should be able to build --with-icu without icu-config tool
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.