Reputation:
Trying to build libxml2 from source from the current master branch: https://github.com/GNOME/libxml2
I'm working in Windows 10 environment and trying to build the msvc variant. Following the readme here: https://github.com/GNOME/libxml2/tree/master/win32
My steps for building are:
1. Open Developer Command Prompt for VS 2017 as admin.
2. Navigate to libxml2\win32.
3. Running the following command: cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes
4. nmake /f Makefile.msvc
5. Getting the following: LINK : fatal error LNK1104: cannot open file 'iconv.lib'
Note that i do have the required environment variables set for the libiconv that I use for other projects in my LIB
and LIBPATH
variable, I also tried adding to PATH
even though it's not nececcasry as VS environment cmd reads the LIB
and LIBPATH
.
(C:\projects\libraries\libiconv\1.9.2-vc110-32bit\Release\lib)
I'm thinking the reason I get this linking error, is because libiconv needs to be build under msvc141(VS17) too?
https://git.savannah.gnu.org/git/libiconv.git
That would cool if it's not the case, as I might need to change a lot in the project if things are updated there, because when I tried building libxml2 with VS12 and VS15 developer command prompt, I got different error in code compatibility, as I guess the owner of the repo doesn't support these versions anymore or they just work in VS17 environment.
Thanks in advance for the help!
Full output:
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.
Upvotes: 3
Views: 7949
Reputation: 31
Note for future readers.
There is a way to build libxml2
without iconv
dependency.
For that you need to use:
cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes iconv=no
Upvotes: 3
Reputation: 123
first, you need to make sure all these packages are build under same arch, which is either all x86 or x64, then libxml2's makefile don't recognize custom INCLUDE and LIB folders, you need to add those folder's into INCLUDE and LIB enviroment variables.
set INCLUDE=%INCLUDE%;<your include dir>
set LIB=%LIB%;<your lib dir>
which should let you compile.
Upvotes: 1