Author: Andrew Watts

Compiling TGrep2 on an Intel Macintosh

Posted on Updated on

When TGrep2 (Ed: a search tool for syntactic corpora in Penn Treebank format) was originally written, all Macs were PPC, but since late 2006 all Macs have been x86 and newer ones are even x86_64. In order to compile tgrep2 on an Intel Mac you have to make some small modifications to the TGrep2 and DRUtils source directories before you compile. This fix at least works on MacOS X 10.5 and 10.6. (Apologies for WordPress mangling the <code> blocks.)

First the patch for DRUtils:
Read the rest of this entry »

Getting Lingalyzer to work on MacOS X

Posted on Updated on

We recently ran into a problem getting Lingalyzer, the analysis program from Doug Rohde’s Linger to work on MacOS X. The problem at least occurs on 10.5 and up, but could well occur on lower versions as well. Lingalyzer depends on a statistics suite called |stat, which is where the actual problem lies.

When you run the lingalyzer script, it dies with the error "warning: this program uses gets(), which is unsafe." We were initially confused, because Lingalyzer is written in Tcl, which has a gets() function, and lingalyzer uses it quite a bit. But the problem was actually the |stat programs that it was calling, which use the C gets() functions. The gets() function is well known for being a buffer overflow risk. GCC warns you sternly not to use it, but MacOS X goes so far as to trap calls to it and refuse to execute the offending program.

It turns out that there is a relatively easy solution, namely replacing all calls to gets() with calls to fgets(). Wherever in the source code you see:
while (gets (line))
replace it with:
while (fgets (line, sizeof(line), stdin))

I have a patch that can be applied to the |stat source code that replaces all of them, as well as adding the CFLAGS to the makefile to build a Universal Binary. However, the license for |stat appears to prohibit redistributing modified versions of the code, and a patch might run afoul of that. If you ask nicely I can email it to you though. The license also prohibits even local modifications for any purpose other than making it run on your system, so if MacOS didn’t terminate programs with gets() with extreme prejudice, then even the changes I made would be in violation. Weird.

www est mort, vive www

Posted on Updated on

Our web server ( bit the dust yesterday. It was a seven year old computer that originally came from a compute cluster, and then we had running non-stop for the last two years as a web server. A new computer is being ordered, but we’re likely to be down for a week or two, just so you know, if you care.

UPDATE (2009-09-16): WWW is back online.