First of all, you should compile the app with -noixemul.
Additionally the code depends on the library bases being opened automagically so you may need to add libauto (-lauto). Some systems don't have working libauto in which case you need to open the library bases manually as described earlier.
I was wondering about libauto. By some systems don't have it, do you mean that some compilers don't provide it or do you mean literally that like OS3 might not have it vs. OS 3.1?