Monday, September 29, 2008

Build HTK 3.4 from Source with Visual Studio 2008

I don't know why the HTK website itself did not provide a download for Windows binary release so we don't have to rebuild it again. However, I found that the binary for HTK 3.3 is available for download at their software archive page here (you need to be a registered user first, free of charge.)

I followed the notes posted by Ivan Uemlianin. The notes suggest me to convert the HTK source files which is in Mac format to Windows format. These source files have additional characters (CR CR CR LF) instead of Windows' (CR LF.) So you need to correct them before using Visual Studio's nmake.

Convert Mac's files to Windows'

Ivan Uemlianin himself uses a Python script to convert the files. The method I used here is not involved with programming. But you need a open-source software Notepad++ instead. Download Notepad++ here.

First, I drag all the files those need to be compile into Notepad++. Then, I turn on the "Show all characters in View -> Show all characters.

Next, the most important part, replace all the (CR CR CR LF) with (CR LF.) Fill in the "Find what :" with "\r\r\r\n" and "Replace with" with "\r\n" as shown in the picture below. Notice that the "Extended (..." checkbox at the bottom of dialog is checked. When you are ready, click "Replace all in all opened documents."

It will take a while on an old computer. Mine takes around 40 seconds :(

After the process finished, press the "Save All" button. Now you are ready to nmake the source files! You can follow the readme provided with HTK from now on :)


Marcus said...


I still have some troubles with the installation of HTK under Windows XP.
I've downloaded Visual Studio C++ 2008 Express Edition and followed the instructions on the HTK Website.

When I try to build the files in the HTKTools and the HLMTools directory the following error message appear:

NMAKE : fatal error U1077: ""C:\Programme\Microsoft Visual Studio 9.0\VC\bin\link.exe"" return code "0xc0000135"

tried your suggestions with replacing the stuff you wrote about, but the files were already correct..
do you have any suggestions?

thank you very much!

greetings from germany!

.:: m3rLinEz ::. said...


It looks like an environment problem. Please make sure you run VCVARSALL.bat located around Visual Studio directory before proceed on the NMAKE stuff. You also need to run VCVARSALL.bat and NMAKE from the same cmd window since the settings changed by the bat file don't live permanently. Another way is to use cmd of Visual Studio 2008 Command Prompt which I'm not sure if this comes with Express edition.


Marcus said...

hmm.. still not working.
the strange thing is that it does compile the sources in the HTKLib directory, but not from the HTKTools directory..

i'll try the executables, which i've found here:

but thank you anyway!

Brian King said...

I'm having a similar U1077 error when trying to install HTK on my 64-bit Win7 computer:

C:\htk\HTKLib>nmake /f htk_htklib_nt.mkf all

Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

cl /nologo /c /ML /W0 /GX /O2 /G5 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDO
WS" /I "." /D "WIN32_AUDIO" /D ARCH=\"WIN32\" /D "PHNALG" HAdapt.c
cl : Command line warning D9035 : option 'GX' has been deprecated and will be re
moved in a future release
cl : Command line warning D9036 : use 'EHsc' instead of 'GX'
cl : Command line warning D9002 : ignoring unknown option '/ML'
cl : Command line warning D9002 : ignoring unknown option '/G5'
c:\htk\htklib\HShell.h(49) : fatal error C1083: Cannot open include file: 'Winso
ck2.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 8\VC
\BIN\cl.EXE"' : return code '0x2'

Does anyone have an idea of what could be causing the problem? I ran the VCVARS file, so that's not the problem. Thanks in advance!

Brian King said...

And my PATH is the following:

PATH=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE;C:\Program Fil
es (x86)\Microsoft Visual Studio 8\VC\BIN;C:\Program Files (x86)\Microsoft Visua
l Studio 8\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2
.0\bin;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Micr
osoft Visual Studio 8\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Stud
io 8\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN;C:\Prog
ram Files (x86)\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files (x86)\M
icrosoft Visual Studio 8\SDK\v2.0\bin;C:\Windows\Microsoft.NET\Framework\v2.0.50
727;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCPackages;C:\Program Fi
les (x86)\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files (x86)\Microsoft
Visual Studio 8\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7
\Tools;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\Windows\
Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studi
o 8\VC\VCPackages;C:\Program Files\Perl64\site\bin;C:\Program Files\Perl64\bin;C
wsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\MATLAB\R200
9b\runtime\win64;C:\Program Files\MATLAB\R2009b\bin;C:\Program Files\MATLAB\R200
7b\bin;C:\Program Files\MATLAB\R2007b\bin\win64;C:\Python25;C:\CUDA\bin64;C:\Pro
gram Files (x86)\Microsoft Visual Studio 8\VC\bin;C:\htk\bin.win32;C:\Program Fi

Anonymous said...

Same issue "fetal error u1077" , while running "nmake /f htk_hlmtools_nt.mkf all".
Can someone help?
Thanks in advance.


hmm.. still not working.
the strange thing is that it does compile the sources in the HTKLib directory, but not from the HTKTools directory..

i'll try the executables, which i've found here ios emulator for pc

but thank you anyway!