Topic: punBB LaTeX support

So I was scratching through the old posts and came across this tutorial to integrate punBB with mimetex
http://www.math-linux.com/spip.php?article39

So I tried using this tutorial. I am new to the environment. I'm trying to set up tex compatibility with punBB using mimetex on a solaris 10 server.

I called the following command:
gcc -static -DAA -DREFERER=\"xxx.yyyy.zzzz.edu\" -DCACHEPATH=\"../esc/latex/pictures/\" mimetex.c gifsave.c -lm -o latex.cgi

CGI is supported.

In the root there are two folders, esc and mimetex.
the latex and pictures folders are in esc and I am compiling from the mimetex folder. I have made pictures 777 access for now.

When I run the gcc command above I get the following error:
ld: fatal: library -lm: not found
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found
ld: fatal: File processing errors. No output written to latex.cgi
collect2: ld returned 1 exit status

any ideas why this may be happening?

thanks in advance