c.c fails to compile on osx

Hi all,

can anyone help?

I am trying to compile c.c  on osx (mountain lion). See below. 

It works fine on a linux box, so I am obviously missing a flag or something else:

Thanks

Walter

bash-3.2$ cat c.c 

// q trade.q -p 5001

// l32: gcc ../c/c/c.c c.o -lpthread

// s32: /usr/local/gcc-3.3.2/bin/gcc ../c/c/c.c c.o -lsocket -lnsl -lpthread

// w32: cl  ../c/c/c.c c.lib ws2_32.lib

#include"k.h"

int main(){

   int c=khp(“localhost”,5001);                         //connect

   k(-c,“trade insert(14:34:56.789;IBM;99.54;300)”,(K)0);

   return 0;

}

bash-3.2$ 

bash-3.2$ gcc -m32 -D KXVER=3 c.c c32.o -o c -lpthread

Undefined symbols for architecture i386:

  “___emutls_get_address”, referenced from:

      _clr in c32.o

      _krr in c32.o

      _orr in c32.o

      _m5 in c32.o

      _w1 in c32.o

      _w0 in c32.o

      _g8 in c32.o

      …

ld: symbol(s) not found for architecture i386

collect2: ld returned 1 exit status

bash-3.2$ 

http://stackoverflow.com/questions/7885246/what-is-the-emutls-get-address-symbol

we can build c.o for osx that does not have this requirement, but it will then be singlethreaded.

Since I didn’t have any luck linking gcc_s on ML, I installed GCC 4.8
from Homebrew as a workaround.

Thanks Charlie, I will try out the homebrew workaround suggested.
Regards
Walter

worked, thanks again!
Walter