gpt4 book ai didi

c++ - Windows环境下从源码构建libxml2

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:41:37 28 4
gpt4 key购买 nike

尝试从当前主分支的源代码构建 libxml2: https://github.com/GNOME/libxml2

我在 Windows 10 环境中工作并尝试构建 msvc 变体。按照这里的自述文件: https://github.com/GNOME/libxml2/tree/master/win32

我的构建步骤是:
1. 以管理员身份打开 VS 2017 开发人员命令提示符。
2. 导航到 libxml2\win32。
3. 运行以下命令:cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes
4. nmake/f Makefile.msvc
5. 获取以下信息:LINK: fatal error LNK1104:无法打开文件“iconv.lib”

请注意,我确实为我在 LIBLIBPATH 变量中用于其他项目的 libiconv 设置了所需的环境变量,我还尝试添加到 PATH 尽管它不是必需的,因为 VS 环境 cmd 读取 LIBLIBPATH。(C:\projects\libraries\libiconv\1.9.2-vc110-32bit\Release\lib)

我在想我收到此链接错误的原因是因为 libiconv 也需要在 msvc141(VS17) 下构建吗?
https://git.savannah.gnu.org/git/libiconv.git

如果不是这种情况,那会很酷,因为如果那里有更新,我可能需要在项目中做很多更改,因为当我尝试使用 VS12 和 VS15 开发人员命令提示符构建 libxml2 时,我在代码兼容性方面遇到了不同的错误,因为我猜 repo 的所有者不再支持这些版本,或者它们只能在 VS17 环境中工作。

在此先感谢您的帮助!

完整输出:

C:\projects\libraries\libxml\2.7.8-vc110-32bit\Release\bin\libxmlNEW\libxml2\win32>nmake /f Makefile.msvc

Microsoft (R) Program Maintenance Utility Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.

if not exist bin.msvc mkdir bin.msvc
if not exist int.msvc mkdir int.msvc
cl.exe /EP /nologo /I..\include /D "NOLIBTOOL" /D "_REENTRANT" libxml2.def.src > int.msvc\libxml2.def
libxml2.def.src
rc -Fo int.msvc\libxml2.res libxml2.rc
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.

cl.exe /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 /MD /I.. /I..\include /Ic:\opt\include /D "_REENTRANT" /D "HAVE_WIN32_THREADS" /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /D "_DEBUG" /Od /Z7 /Foint.msvc\ /c ..\buf.c ..\c14n.c ..\catalog.c ..\chvalid.c ..\debugXML.c ..\dict.c ..\DOCBparser.c ..\encoding.c ..\entities.c ..\error.c ..\globals.c ..\hash.c ..\HTMLparser.c ..\HTMLtree.c ..\legacy.c ..\list.c ..\nanoftp.c ..\nanohttp.c ..\parser.c ..\parserInternals.c ..\pattern.c ..\relaxng.c ..\SAX2.c ..\SAX.c ..\schematron.c ..\threads.c ..\tree.c ..\uri.c ..\valid.c ..\xinclude.c ..\xlink.c ..\xmlIO.c ..\xmlmemory.c ..\xmlreader.c ..\xmlregexp.c ..\xmlmodule.c ..\xmlsave.c ..\xmlschemas.c ..\xmlschemastypes.c ..\xmlunicode.c ..\xmlwriter.c ..\xpath.c ..\xpointer.c ..\xmlstring.c
buf.c
c14n.c
catalog.c
chvalid.c
debugXML.c
dict.c
DOCBparser.c
encoding.c
entities.c
error.c
globals.c
hash.c
HTMLparser.c
HTMLtree.c
legacy.c
list.c
nanoftp.c
..\nanoftp.c(927): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winsock2.h(2218): note: see declaration of 'gethostbyname'
..\nanoftp.c(929): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winsock2.h(2218): note: see declaration of 'gethostbyname'
nanohttp.c
parser.c
parserInternals.c
Generating Code...
Compiling...
pattern.c
relaxng.c
SAX2.c
SAX.c
schematron.c
threads.c
tree.c
uri.c
valid.c
xinclude.c
xlink.c
xmlIO.c
xmlmemory.c
xmlreader.c
xmlregexp.c
xmlmodule.c
xmlsave.c
xmlschemas.c
xmlschemastypes.c
xmlunicode.c
Generating Code...
Compiling...
xmlwriter.c
xpath.c
xpointer.c
xmlstring.c
Generating Code...
link.exe /nologo /VERSION:2.9 /LIBPATH:bin.msvc /LIBPATH:c:\opt\lib /DEBUG /DLL /IMPLIB:bin.msvc\libxml2.lib /OUT:bin.msvc\libxml2.dll int.msvc\buf.obj int.msvc\c14n.obj int.msvc\catalog.obj int.msvc\chvalid.obj int.msvc\debugXML.obj int.msvc\dict.obj int.msvc\DOCBparser.obj int.msvc\encoding.obj int.msvc\entities.obj int.msvc\error.obj int.msvc\globals.obj int.msvc\hash.obj int.msvc\HTMLparser.obj int.msvc\HTMLtree.obj int.msvc\legacy.obj int.msvc\list.obj int.msvc\nanoftp.obj int.msvc\nanohttp.obj int.msvc\parser.obj int.msvc\parserInternals.obj int.msvc\pattern.obj int.msvc\relaxng.obj int.msvc\SAX2.obj int.msvc\SAX.obj int.msvc\schematron.obj int.msvc\threads.obj int.msvc\tree.obj int.msvc\uri.obj int.msvc\valid.obj int.msvc\xinclude.obj int.msvc\xlink.obj int.msvc\xmlIO.obj int.msvc\xmlmemory.obj int.msvc\xmlreader.obj int.msvc\xmlregexp.obj int.msvc\xmlmodule.obj int.msvc\xmlsave.obj int.msvc\xmlschemas.obj int.msvc\xmlschemastypes.obj int.msvc\xmlunicode.obj int.msvc\xmlwriter.obj int.msvc\xpath.obj int.msvc\xpointer.obj int.msvc\xmlstring.obj int.msvc\libxml2.res wsock32.lib ws2_32.lib iconv.lib kernel32.lib
LINK : fatal error LNK1104: cannot open file 'iconv.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.exe"' : return code '0x450'
Stop.

最佳答案

给 future 读者的注意事项。

有一种方法可以在不依赖 iconv 的情况下构建 libxml2

为此你需要使用:

cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes iconv=no

关于c++ - Windows环境下从源码构建libxml2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48824267/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com