[Tex/LaTex] How does one build MiKTeX on Windows

miktexpdftexprivacywindows

I want to build MiKTeX (pdflatex specifically) to resolve this privacy issue with pdflatex by applying this change.

I followed this howto.

On a new Windows 7 SP1 (32-bit) install I installed:

  • CMake (cmake-2.8.12.2-win32-x86.exe)
  • Visual Studio C++ 2008 with SP1 (VS2008ExpressWithSP1ENUX1504728.iso)
  • Cygwin (default with bison, flex and diffutil)
  • ActivePerl (ActivePerl-5.20.1.2000-MSWin32-x86-64int-298557.msi)
  • libxslt (libxslt-1.1.26.win32.zip)
  • MiKTeX basic with 'install missing packages on-the-fly' (basic-miktex-2.9.5105.exe)
  • HTML Help Workshop
  • Windows SDK for Windows Server 2008 (6.0.6001.18000.367-KRMSDK_EN.iso)
    • with only the Windows Headers and Libraries and Windows Development Tools selected
  • ImageMagick (ImageMagick-6.9.0-0-Q16-x86-dll.exe)

To Windows' PATH I appended:

;C:\cygwin\bin;C:\libxslt-1.1.26.win32\bin;C:\Program Files\HTML Help Workshop

I extracted the MiKTeX source (miktex-2.9.4106.tar.bz2) to C:\miktex

In C:\miktex\CMakeLists.txt I set NO_GUI = TRUE

I launched the Visual Studio 2008 Command Prompt and entered the following:

cd \miktex
cmake -G "NMake Makefiles"
nmake

Building stopped with the following:

[ 15%] Building C object Libraries/3rd/obsdcompat/CMakeFiles/MiKTeX209-obsdcompat.dir/bsd-asprintf.c.obj
bsd-asprintf.c
c:\miktex\libraries\3rd\obsdcompat\defines.h(91) : error C2061: syntax error : identifier 'u_int8_t'
c:\miktex\libraries\3rd\obsdcompat\defines.h(91) : error C2059: syntax error : ';'
c:\miktex\libraries\3rd\obsdcompat\defines.h(92) : error C2061: syntax error : identifier 'u_int16_t'
c:\miktex\libraries\3rd\obsdcompat\defines.h(92) : error C2059: syntax error : ';'
c:\miktex\libraries\3rd\obsdcompat\defines.h(93) : error C2061: syntax error : identifier 'u_int32_t'
c:\miktex\libraries\3rd\obsdcompat\defines.h(93) : error C2059: syntax error : ';'
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

I was able to work around this and subsequent errors, but after each workaround building again stopped with further errors unrelated to the workarounds.
I eventually gave up suspecting there must be something wrong with my build environment or the way I was using it (hence the detail), but I have no idea what the problem is.

Best Answer

Don't build in the source directory.

Historical:

Patching pdftex.web and pdftoepdf.cc in Programs\TeXAndFriends\pdftex as necessary (for example, search those files for .Fullbanner and .FileName respectively) prior to building will result in MiKTeX pdftex binaries that do not add PDF metadata/properties not explicitly specified.