You may not use a path containing spaces or a bunch of weird things would happen
mklink /D <name> <src>
under cmd
to make a link to actual directory and write PATH
records using the path without spaces.This may not be the best solution as it involves the use of both MSVC and GNU toolchain, just for troubleshooting.
This one is pretty easy though.
First make some modifications with CMakeLists.txt
, turning off the dependencies you do not have and do not want to install.
For me,
- option(LIBXML2_WITH_ICONV "Add ICONV support" ON)
+ option(LIBXML2_WITH_ICONV "Add ICONV support" OFF)
- option(LIBXML2_WITH_LZMA "Use liblzma" ON)
+ option(LIBXML2_WITH_LZMA "Use liblzma" OFF)
# This requires Python 2
- option(LIBXML2_WITH_PYTHON "Build Python bindings" ON)
+ option(LIBXML2_WITH_PYTHON "Build Python bindings" OFF)
- option(LIBXML2_WITH_TESTS "Build tests" ON)
+ option(LIBXML2_WITH_TESTS "Build tests" OFF)
- option(LIBXML2_WITH_ZLIB "Use libz" ON)
+ option(LIBXML2_WITH_ZLIB "Use libz" OFF)
And then, as always,
mkdir build && cd build
cmake .. -G <MSVC>
cmake --build .
cmake --install .
Then, add bin
and lib/pkgconfig
to your PATH
. Slightly modify your lib/pkgconfig/libxml-2.0.pc
:
Confirm prefix
be the root directory of your libxml2
Change Libs
line to Libs: "${libdir}/libxml2.lib"
lib.private
using -lws2_32
but it somehow did not make it fail so I left it as it is. time_t
PATH
, especially with priority higher than other ones like bin
and lib
!Do the followings in git bash:
git clone [email protected]:rioki/libxmlmm.git
Replace all occurrences of pkg-config
in configure
to pkg-config.exe
pkg-config.exe libxml-2.0 --modversion
$ which pkg-config.exe
/c/Users/ksyx/scoop/shims/pkg-config.exe
$ which pkg-config
/c/Strawberry/perl/bin/pkg-config
export PKG_CONFIG_PATH=$PATH
, this makes pkg-config
search the directories we usually expect (PATH
s)
`./configure --prefix="C:/libs/libxmlmm"
$(pwd)
git bash gives you.Open libxmlmm.pc
, change Libs
line to Libs: "${libdir}/libxmlmm.a"
Note that you may need specifying something in the CMakeLists.txt
.
Download this test gist and run under root of repo:
mkdir bin && mkdir build && cd build
cmake .. -G "Unix Makefiles"
cmake --build .
cd ../bin
./test.exe
cat index.html
And you should get the same HTML as the example.
Congrats!
Copyright (c) ksyx 2021, licensed under CC-BY-SA. Download Markdown file at libxml.md
< Back to posts