Environment:
- Windows 10 version 1803
- Visual Studio 2015 Update 3
- CMake 3.11.4
Building steps and configurations:
- I downloaded the source of libxml2 "libxml2-2.9.8.tar.gz" from ftp://xmlsoft.org/libxml2/ and uncompress it.
- Open Visual Studio 2015 -> Visual Studio Tools -> Developer Command Prompt,run:
Code: Select all
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
vcvarsall x64
cd C:\...\libxml2-2.9.8\win32
cscript configure.js zlib=yes compiler=msvc prefix=C:\...\libxml2-2.9.8\install_ include=C:\...\zlib-1.2.11\install\include;C:\...\iconv-1.14-win32-x86_64\include lib=C:\...\3rd-parties\zlib-1.2.11\install\lib;C:\...\iconv-1.14-win32-x86_64\lib
nmake /f Makefile.msvc
nmake /f Makefile.msvc install
Code: Select all
cd C:\...\dcmtk-3.6.3\build
cmake -DCMAKE_CONFIGURATION_TYPES=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=C:\...\dcmtk-3.6.3\install_ -DDCMTK_ENABLE_STL=ON -DDCMTK_ENABLE_CXX11:BOOL=ON -DDCMTK_WITH_DOXYGEN=1 -DDCMTK_WITH_PNG=ON -DWITH_LIBPNGINC=C:\...\lpng1632\install_ -DDCMTK_WITH_TIFF=ON -DWITH_LIBTIFFINC=C:\...\libtiff-master\install -DDCMTK_WITH_ZLIB=ON -DWITH_ZLIBINC=C:\...\zlib-1.2.11\install -DDCMTK_WITH_ICONV=ON -DWITH_LIBICONVINC=C:\...\iconv-1.14-win32-x86_64 -DDCMTK_WITH_XML=ON -DWITH_LIBXMLINC=C:\...\libxml2-2.9.8\install_ -DDCMTK_WITH_OPENSSL=ON -DWITH_OPENSSLINC=C:\OpenSSL-Win64 -G"Visual Studio 14 2015 Win64" ..
Errors:
This error is caused by the invocation of xmlFree in line 213 of dcmdata\apps\xml2dcm.cc. I checked the libxml2 library I built using dumpbin, xmlFree is in it. Although I omitted my own paths, it should not cause the error because if a lib file could not be openned, VS would only report "can not open ....lib". Also, I think xmlFree is not the only xml function called by DCMTK, but only xmlFree is unresolved. If I use xml2 library in the provided pre-compile binary "dcmtk-3.6.3-win64-support_MD-msvc-14.0.zip", DCMTK builds well. So I don't know what is wrong with my building of xml2. Can you help me troubleshoot? Or, if it is allowed, could you please tell me how OFFIS built libxml2 for Windows 10 + VS2015 + /MD? Please let me know if you need other info to reproduce the problem. Thanks a lot.1>------ Build started: Project: xml2dcm, Configuration: Release x64 ------
1>xml2dcm.obj : error LNK2019: unresolved external symbol xmlFree referenced in function "class OFCondition __cdecl createNewElement(struct _xmlNode *,class DcmElement * &)" (?createNewElement@@YA?AVOFCondition@@PEAU_xmlNode@@AEAPEAVDcmElement@@@Z)
1>C:\...\dcmtk-3.6.3\build\bin\Release\xml2dcm.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========