./configure –with-libxml2=/usr/lib64/ still get issue `No XML parser found` when configure the apr

huangapple go评论79阅读模式
英文:

./configure --with-libxml2=/usr/lib64/ still get issue `No XML parser found` when configure the apr

问题

在我的CentOS 7容器中,我通过克隆最新版本来配置已下载的/root/apr

git clone https://github.com/apache/apr.git

当我执行./configure时,出现错误:

checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
  setting LDFLAGS to "-L/usr/local/lib"
  setting INCLUDES to "-I/usr/local/include"
checking Expat 1.95.x in /usr/local... no
  setting APRUTIL_EXPORT_LIBS to ""
  setting APRUTIL_LIBS to ""
configure: error: 未找到XML解析器! 请指定 --with-expat 或 --with-libxml2

然后我安装了libxml2:

yum install -y libxml2

libxml2库位于以下位置:

sh-4.2# ls /usr/lib64/ | grep libxml
libxml2.so.2
libxml2.so.2.9.1

但是,当我执行以下configure命令时,仍然出现相同的错误:

./configure --with-libxml2=/usr/lib64/

在提出这个问题之前,我尝试了以下操作:
https://stackoverflow.com/a/9783138/7640404


编辑-01

安装了libxml2-devel后:

yum install libxml2-devel

出现了libxml2.so

sh-4.2# ls /usr/lib64 | grep libxml
libxml2.so
libxml2.so.2
libxml2.so.2.9.1

包括:

sh-4.2# ls /usr/include/libxml2/libxml/
DOCBparser.h  catalog.h   globals.h   parserInternals.h   tree.h      xmlautomata.h  xmlregexp.h        xmlversion.h
HTMLparser.h  chvalid.h   hash.h      pattern.h           uri.h       xmlerror.h     xmlsave.h          xmlwriter.h
HTMLtree.h    debugXML.h  list.h      relaxng.h           valid.h     xmlexports.h   xmlschemas.h       xpath.h
SAX.h         dict.h      nanoftp.h   schemasInternals.h  xinclude.h  xmlmemory.h    xmlschemastypes.h  xpathInternals.h
SAX2.h        encoding.h  nanohttp.h  schematron.h        xlink.h     xmlmodule.h    xmlstring.h        xpointer.h
c14n.h        entities.h  parser.h    threads.h           xmlIO.h     xmlreader.h    xmlunicode.h

但是,当我执行以下configure命令时,仍然出现相同的错误:

./configure --prefix=/usr/local/apr --with-libxml2=/usr/lib64/
checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking for xml2-config... no
  adding "-I/usr/lib64//include/libxml2" to CPPFLAGS
  adding "-lxml2" to LIBS
configure: checking for libxml2 in /usr/lib64/
checking libxml/parser.h usability... no
checking libxml/parser.h presence... no
checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
  setting LDFLAGS to "-L/usr/local/lib"
  setting INCLUDES to "-I/usr/local/include"
checking Expat 1.95.x in /usr/local... no
  setting APRUTIL_EXPORT_LIBS to ""
  setting APRUTIL_LIBS to ""
configure: error: 未找到XML解析器! 请指定 --with-expat 或 --with-libxml2

编辑-02

感谢William Pursell。我尝试了以下操作:

CFLAGS="-I/usr/include/libxml2/libxml/" ./configure 

但仍然不起作用。

甚至更改了configure文件以添加-I/usr/include/libxml2/libxml

if test "x$INCLUDES" = "x"; then
    test "x$silent" != "xyes" && echo "  setting INCLUDES to \"-I/usr/local/include  -I/usr/local/include -I/usr/include/libxml2/libxml \""
    INCLUDES="-I/usr/local/include -I/usr/include/libxml2/libxml"

仍然出现相同的错误:

...
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
  setting LDFLAGS to "-L/usr/local/lib"
  setting INCLUDES to "-I/usr/local/include  -I/usr/local/include -I/usr/include/libxml2/libxml "
checking Expat 1.95.x in /usr/local... no
  setting APRUTIL_EXPORT_LIBS to ""
  setting APRUTIL_LIBS to ""
configure: error: 未找到XML解析器! 请指定 --with-expat 或 --with-libxml2

编辑-03

我尝试了:

./configure --with-libxml2=/usr/lib64/include/libxml2

但仍然出现错误:

checking for libpq-fe.h... no
checking postgresql/libpq-fe.h usability... no
checking postgresql/libpq-fe.h presence... no
checking for postgresql/libpq-fe.h... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite.h usability... no
checking sqlite.h presence... no
checking for sqlite.h... no
checking for odbc_config... no
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking for xml2-config... no
  adding "-I/usr/lib64/include/libxml2/include/libxml2" to CPPFLAGS
  adding "-lxml2" to

<details>
<summary>英文:</summary>

In my centos7 container, I configure the downloaded `/root/apr` by cloning the latest version:

git clone https://github.com/apache/apr.git


when I execute the `./configure`

I get error:

checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
setting LDFLAGS to "-L/usr/local/lib"
setting INCLUDES to "-I/usr/local/include"
checking Expat 1.95.x in /usr/local... no
setting APRUTIL_EXPORT_LIBS to ""
setting APRUTIL_LIBS to ""
configure: error: No XML parser found! Please specify --with-expat or --with-libxml2


then I installed libxml2:

yum install -y libxml2


the libxml2 libraries are:

sh-4.2# ls /usr/lib64/ | grep libxml
libxml2.so.2
libxml2.so.2.9.1



but I still get this error when I execute this configure command:

./configure --with-libxml2=/usr/lib64/


---


Before asking this question I have tried:
https://stackoverflow.com/a/9783138/7640404  

----

**EDIT-01**

After installed `libxml2-devel`:

yum install libxml2-devel


there have `libxml2.so`

sh-4.2# ls /usr/lib64 | grep libxml
libxml2.so
libxml2.so.2
libxml2.so.2.9.1

the include:

sh-4.2# ls /usr/include/libxml2/libxml/
DOCBparser.h catalog.h globals.h parserInternals.h tree.h xmlautomata.h xmlregexp.h xmlversion.h
HTMLparser.h chvalid.h hash.h pattern.h uri.h xmlerror.h xmlsave.h xmlwriter.h
HTMLtree.h debugXML.h list.h relaxng.h valid.h xmlexports.h xmlschemas.h xpath.h
SAX.h dict.h nanoftp.h schemasInternals.h xinclude.h xmlmemory.h xmlschemastypes.h xpathInternals.h
SAX2.h encoding.h nanohttp.h schematron.h xlink.h xmlmodule.h xmlstring.h xpointer.h
c14n.h entities.h parser.h threads.h xmlIO.h xmlreader.h xmlunicode.h



but still get this issue:

./configure --prefix=/usr/local/apr --with-libxml2=/usr/lib64/


checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking for xml2-config... no
adding "-I/usr/lib64//include/libxml2" to CPPFLAGS
adding "-lxml2" to LIBS
configure: checking for libxml2 in /usr/lib64/
checking libxml/parser.h usability... no
checking libxml/parser.h presence... no
checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
setting LDFLAGS to "-L/usr/local/lib"
setting INCLUDES to "-I/usr/local/include"
checking Expat 1.95.x in /usr/local... no
setting APRUTIL_EXPORT_LIBS to ""
setting APRUTIL_LIBS to ""
configure: error: No XML parser found! Please specify --with-expat or --with-libxml2


---

**EDIT-02**

thanks for William Pursell.
I tried 

CFLAGS="-I/usr/include/libxml2/libxml/" ./configure

but still not work.
 
and even changed the `configure` file to add `-I/usr/include/libxml2/libxml`: 

if test "x$INCLUDES" = "x"; then
test "x$silent" != "xyes" && echo " setting INCLUDES to &quot;-I/usr/local/include -I/usr/local/include -I/usr/include/libxml2/libxml &quot;"
INCLUDES="-I/usr/local/include -I/usr/include/libxml2/libxml"


still get this error:

...
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
setting LDFLAGS to "-L/usr/local/lib"
setting INCLUDES to "-I/usr/local/include -I/usr/local/include -I/usr/include/libxml2/libxml "
checking Expat 1.95.x in /usr/local... no
setting APRUTIL_EXPORT_LIBS to ""
setting APRUTIL_LIBS to ""
configure: error: No XML parser found! Please specify --with-expat or --with-libxml2


---

**EDIT-03**

I tried :

./configure --with-libxml2=/usr/lib64/include/libxml2


but still get error:

checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking for nl_langinfo... yes
setting have_unicode_fs to "0"
setting apr_has_xthread_files to "0"
setting apr_procattr_user_set_requires_password to "0"
setting apr_thread_func to ""
setting apr_has_user to "1"
Applying apr-util hints file rules for aarch64-unknown-linux-gnu
checking for default DBM... sdbm (default)
checking for pg_config... no
checking libpq-fe.h usability... no
checking libpq-fe.h presence... no
checking for libpq-fe.h... no
checking postgresql/libpq-fe.h usability... no
checking postgresql/libpq-fe.h presence... no
checking for postgresql/libpq-fe.h... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite.h usability... no
checking sqlite.h presence... no
checking for sqlite.h... no
checking for odbc_config... no
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking for xml2-config... no
adding "-I/usr/lib64/include/libxml2/include/libxml2" to CPPFLAGS
adding "-lxml2" to LIBS
configure: checking for libxml2 in /usr/lib64/include/libxml2
checking libxml/parser.h usability... no
checking libxml/parser.h presence... no
checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
setting LDFLAGS to "-L/usr/local/lib"
setting INCLUDES to "-I/usr/local/include -I/usr/local/include -I/usr/include/libxml2/libxml "
checking Expat 1.95.x in /usr/local... no
setting APRUTIL_EXPORT_LIBS to ""
setting APRUTIL_LIBS to ""
configure: error: No XML parser found! Please specify --with-expat or --with-libxml2


---

**EDIT-04**

When I execute `./configure --with-libxml2=/usr/include/libxml2` 

I still get error:

checking for libpq-fe.h... no
checking postgresql/libpq-fe.h usability... no
checking postgresql/libpq-fe.h presence... no
checking for postgresql/libpq-fe.h... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite.h usability... no
checking sqlite.h presence... no
checking for sqlite.h... no
checking for odbc_config... no
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking for xml2-config... no
adding "-I/usr/include/libxml2/include/libxml2" to CPPFLAGS
adding "-lxml2" to LIBS
configure: checking for libxml2 in /usr/include/libxml2
checking libxml/parser.h usability... no
checking libxml/parser.h presence... no
checking for libxml/parser.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
setting LDFLAGS to "-L/usr/local/lib"
setting INCLUDES to "-I/usr/local/include -I/usr/local/include -I/usr/include/libxml2/libxml "
checking Expat 1.95.x in /usr/local... no
setting APRUTIL_EXPORT_LIBS to ""
setting APRUTIL_LIBS to ""
configure: error: No XML parser found! Please specify --with-expat or --with-libxml2


</details>


# 答案1
**得分**: 1

在一个普通的CentOS 7容器中:

docker run --rm -it centos:centos7


安装这些依赖项:

yum groupinstall "Development Tools"
yum install git which libxml2-devel
git clone https://github.com/apache/apr.git # 5a86456
cd apr


这将成功配置并构建项目:

./buildconf
./configure CFLAGS=-I/usr/include/libxml2
make


它将报告类似以下内容:

checking libxml/parser.h usability... yes
checking libxml/parser.h presence... no
configure: WARNING: libxml/parser.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: libxml/parser.h: proceeding with the compiler's result
checking for libxml/parser.h... yes
checking for xmlCreatePushParserCtxt in -lxml2... yes
setting APRUTIL_CPPFLAGS to ""
setting APRUTIL_PRIV_INCLUDES to ""
setting APRUTIL_LIBS to "-lxml2"


`--with-libxml2` 标志似乎是不必要的。

<details>
<summary>英文:</summary>

In a plain Centos 7 container

docker run --rm -it centos:centos7


With these dependencies installed

yum groupinstall "Development Tools"
yum install git which libxml2-devel
git clone https://github.com/apache/apr.git # 5a86456
cd apr


This successfully configures and builds the project:

./buildconf
./configure CFLAGS=-I/usr/include/libxml2
make


It will report something like this

checking libxml/parser.h usability... yes
checking libxml/parser.h presence... no
configure: WARNING: libxml/parser.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: libxml/parser.h: proceeding with the compiler's result
checking for libxml/parser.h... yes
checking for xmlCreatePushParserCtxt in -lxml2... yes
setting APRUTIL_CPPFLAGS to ""
setting APRUTIL_PRIV_INCLUDES to ""
setting APRUTIL_LIBS to "-lxml2"


The `--with-libxml2` flag seems unnecessary.

</details>



huangapple
  • 本文由 发表于 2023年1月9日 19:46:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75056822.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定