Building MikTeX is not straightforward and requires patience in particular due to difficulty to translate error messages. Some of them below:
Failed to find required Qt component "Qml" Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR) Could NOT find CAIRO (missing: CAIRO_LIBRARY CAIRO_INCLUDE_DIR) -- Package 'fribidi', required by 'virtual:world', not found Could NOT find GD (missing: GD_LIBRARY GD_INCLUDE_DIR)
Under antiX version 23, based on Debian Bookworm, it is necessary to install a bunch of programs and headers in order to fix the errors above:
apt-get install cmake libxsltproc bison flex qt6-base-dev qt6-tools-dev qt6-declarative-dev qt6-scxml-dev qt6-5compat-dev libapr1-dev libaprutil1-dev libboost-locale-dev libbz2-dev libcairo2-dev libfribidi-dev libgd-dev libgmp-dev libgraphite2-dev libharfbuzz-dev libhunspell-dev liblog4cxx-dev libmpfi-dev libmspack-dev libssl-dev libpopt-dev liburiparser-dev libzzip-dev
Now, the installation can begin:
wget https://miktex.org/download/ctan/systems/win32/miktex/source/miktex-25.4.tar.xz tar xf miktex-25.4.tar.xz mkdir miktex-build cd miktex-build/ cmake ../miktex.25.4/
In my case, the process complained with:
libmiktex-metapost.so : undefined reference to "mpfi_clears" libmiktex-metapost.so : undefined reference to "mpfi_inits2"
The reason is that mpfi version on antiX 23 is 1.5.3 but mpfi_clears and mpfi_inits2 have been introduced in version 1.5.4. In order to fix this, i built mpfi 1.5.4 from source and installed it under /usr/local:
wget https://gitlab.inria.fr/mpfi/mpfi/-/archive/1.5.4/mpfi-1.5.4.tar.bz2 tar xf mpfi-1.5.4.tar.bz2 cd mpfi-1.5.4/mpfi autoreconf -i ./configure --prefix=/usr/local make
Here, i get the following error message:
make[2]: *** No rule to make target 'div_ext.c', needed by 'div_ext.lo'. Stop.
Hopefully, page https://packages.debian.org/trixie/libmpfi-dev led me to version 1.5.4 of the package available in Debian Trixie. I downloaded http://deb.debian.org/debian/pool/main/m/mpfi/mpfi_1.5.4+ds-4.debian.tar.xz and looked for a patch corresponding to my error. Then, I removed div_ext.c from the file src/Makefile.am and restarted the mpfi build:
autoreconf -i ./configure --prefix=/usr/local make make install # as root
After that, I had to indicate to MikTeX installer the new location of mpfi:
nano CMakeCache.txt
After what:
cmake ../miktex.25.4/ make # Build takes 85 min
Finally, as root:
make install
Now, MikTeX is installed, but it still needs some post-install steps. I follow page https://miktex.org/howto/build-unx, as root:
mpm --admin --update-db initexmf --admin --set-config-value [MPM]AutoInstall=1 initexmf --admin --update-fndb initexmf --admin --mklinks mpm --admin --verbose --package-level=basic --upgrade initexmf --admin --mkmaps initexmf --admin --update-fndb rm -fr ~/.miktex
Test as normal user:
pdflatex sample2e