Source

tex2sws / tex4ht-compile.txt

Instructions to create  tex4ht  binaries on 
KUbuntu/Ubuntu/Debian 64-bit (aka amd64) systems
Rob Beezer, beezer@ups.edu, http://buzzard.ups.edu

2009/01/31  Tested on a Kubuntu 8.10 amd64 stock installation
            (presumably Debian is similar and Ubuntu identical)
2010/08/23  libpathsea upgraded in 10.04, forced recompile
2010/12/07  verified with a rebuild of SVN 66 source

a.  There are three Ubuntu/Debian packages you may need and not have installed.  If you are unsure if you have them, just try installing them.  If you do have any of them, then you will get a warning and a chance to retry after omitting the request for the installed package.

gcc: the standard C compiler
libkpathsea4: library for TeX path searching, part of the texlive distribution
              provides files like /usr/lib/libkpathsea.so.4.0.0
libkpathsea-dev: development files for libkpathsea
                 provides numerous header files (*.h) in /usr/include/kpathsea

To install, execute (as root):  apt-get install gcc libkpathsea4 libkpathsea-dev

b.  Install tex4ht,  or unpack the latest distribution into a scratch directory (/tmp, say)

c.  Move/copy  src/t4ht.c, src/tex4ht.c  into a working directory (/tmp/tex4ht, say)
    (htcmd.c is not necessary or needed and can be ignored)

d.  Within your working directory, issue the following two commands
  
gcc -O2 -DKPATHSEA -I/usr/include -L/usr/lib -o t4ht   t4ht.c   -DHAVE_DIRENT_H -lkpathsea
gcc -O2 -DKPATHSEA -I/usr/include -L/usr/lib -o tex4ht tex4ht.c -DHAVE_DIRENT_H -lkpathsea

(2010/08/23 Question:
Is there a way to link dynamically to libkpathsea,
so upgrades of kpathsea do not require recompiling?)

e.  Determine where you need/want to place these executables.  If your setup is otherwise complete, then the command

which t4ht

might provide the answer.  The locate database is typically regenerated automatically overnight, and so

locate t4ht

might also indicate the location sometime after installation.  The  find  command is another possibility.

From your working directory, move/copy the files  t4ht, tex4ht  to the place you want them to be.  If you end up with several versions of these executables, a command like  file t4ht  will tell you if one is 32-bit or 64-bit.