Introduction
This is just a short post to share a workaround to a problem I ran into when building Eddie Kohler’s superb LCDF Typetools under Windows using MinGW. After running ./configure to create the make files I hit a problem during compilation with lots of error messages referring to undefined reference to `ntohl@4'
../typetools/libefont/otf.cc:863: undefined reference to `ntohl@4'
../typetools/libefont/otf.cc:861: undefined reference to `ntohs@4'
../typetools/libefont/otf.cc:861: undefined reference to `ntohs@4'
One solution
The cause of the error is failure to link to the library libwsock32.a (contained in the c:\MinGW\lib\ directory on my PC). The following workaround solves the problem but I’m sure there are better ways of doing it. Several tools within the Typetools collection depend on libwsock32.a to compile successfully. There are:
- otfinfo
- otftotfm
- cfftot1
To build these programs you need to make a small edit to the generated makefiles.
- Create a directory called (say)
libswithin the Typetools directory tree. - Copy
libwsock32.ainto that directory. - For each application listed above, that depends on
libwsock32.a, open themakefilein the appropriate application directory and look for a line starting withXXXXX_LDADDwhere XXXX isotfinfoorotftotfmorcfftot1 - Edit that line to include
libwsock32.a - Example:
cfftot1_LDADD = ../libefont/libefont.a ../libs/libwsock32.a ../liblcdf/liblcdf.a
You should now be able to run make and achieve a successful compilation. It worked for me, I hope it works for you.