[erlang-bugs] libei_st.a broken in R11B-4

Nicolas Charpentier <>
Thu Jun 14 13:31:12 CEST 2007


Hi,
This problem was previously reported by Dominic Williams some days ago.

I have some problems to port a software from R10B-5 to R11B-4 on a linux OS.
I have several ports linked with the single thread version of erl_interface
(liberl_interface_st.a and libei_st.a) all is working right with R10B-5
but when I try to compile with R11B-4 I got this error:

gcc -o ../priv/i386-redhat-linux/mysql_port.out
../priv/i386-redhat-linux/mysql_port.o -L/usr/X11R6/lib -L/usr/lib
-L/usr/lib/mysql -lmysqlclient
-L/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib
-lerl_interface_st -lei_st
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x105b):
In function `erl_copy_term':
legacy/erl_eterm.c:776: undefined reference to `__erl_errno'
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x11f2):
In function `erl_mk_var':
legacy/erl_eterm.c:497: undefined reference to `__erl_errno'
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x1288):
In function `__erl_mk_reference':
legacy/erl_eterm.c:254: undefined reference to `__erl_errno'
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x13b7):
In function `erl_mk_port':
legacy/erl_eterm.c:223: undefined reference to `__erl_errno'
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x145d):
In function `erl_mk_pid':
legacy/erl_eterm.c:192: undefined reference to `__erl_errno'
/usr/local/R11B-4/lib/erlang/lib/erl_interface-3.5.5.3/lib/liberl_interface_st.a(erl_eterm.o)(.text+0x14de):legacy/erl_eterm.c:127:
more undefined references to `__erl_errno' follow
collect2: ld returned 1 exit status

The symbol __erl_errno is defined in the file "src/misc/ei_pthread.c".
In the version R11B-4, the declation of the symbol is surrounded by 2 ifdef
making it not available on linux

---- ei_pthread.c r11B-4

#ifdef __WIN32__
#ifdef USE_DECLSPEC_THREAD
/* Define (and initialize) the variable __erl_errno */
volatile __declspec(thread) int __erl_errno = 0;
#else
static volatile DWORD errno_tls_index = TLS_OUT_OF_INDEXES;
static LONG volatile tls_init_mutex = 0;
#endif
#endif

----- ei_pthread.c r10B-5

/* Define (and initialize) the variable __erl_errno */
volatile __declspec(thread) int __erl_errno = 0;


Are the 2 ifdef right ?
if they are right, why does the lib still need __erl_errno  ?

Regards

----
Nicolas Charpentier
http://charpi.net



More information about the erlang-bugs mailing list