When i compile example of interoperation between C and erlang with next command:
gcc -o fac -I/usr/local/lib/erlang/lib/erl_interface-3.5.9/include \
-L/usr/local/lib/erlang/lib/erl_interface-3.5.9/lib fac.c -lerl_interface -lei
My system is Ubuntu. I got next errors:
/usr/lib/libei.a(ei_pthreads.o): In function
__erl_errno_place':pthread_once’
(.text+0x4c): undefined reference to
/usr/lib/libei.a(ei_pthreads.o): In function__erl_errno_place':pthread_getspecific’
(.text+0x7a): undefined reference to
/usr/lib/libei.a(ei_pthreads.o): In function__erl_errno_place':pthread_setspecific’
(.text+0xa2): undefined reference to
/usr/lib/libei.a(ei_pthreads.o): In function__erl_errno_place':pthread_getspecific’
(.text+0xb4): undefined reference to
/usr/lib/libei.a(ei_pthreads.o): In functionerl_errno_key_alloc':pthread_key_create’
(.text+0x136): undefined reference to
/usr/lib/libei.a(ei_pthreads.o): In functionei_m_trylock':pthread_mutex_trylock’
(.text+0x189): undefined reference to
collect2: ld returned 1 exit status
Any suggestions?
You need to link
pthreadlibrary. Try:gcc -o fac -I/usr/local/lib/erlang/lib/erl_interface-3.5.9/include -L/usr/local/lib/erlang/lib/erl_interface-3.5.9/lib fac.c -lerl_interface -lei -lpthreadHope this helps!