Need to catch standard error too. 2>&1 | tee build.log. Be good to see the errors. Based on some experiments I did the other day, GCC by default is quite picky and I had to add a bunch of unexpected casts, mostly char to PCSZ.
(edit)
Another thing is that GCC will by default use os2emx.h when including os2.h. To use the toolkit version of os2.h, you have to define USE_TOOLKIT_HEADERS before including os2.h, on the command line -DUSE_TOOLKIT_HEADERS or in the program, #define (USE_TOOLKIT_HEADERS). See @UNIXROOT/usr/include/os2.h
Be interesting to try using the libc version of os2.h first.