Tcl 7.5 not compiling on Linux 2.0.1+ (EDEADLK == EDEADLOCK)

Mark Orr (markorr@intersurf.com)
Wed, 31 Jul 1996 18:10:08 -0500


This may be old news, but...I'm just curious about it -- so
here goes:

There have been a few reports on comp.lang.tcl (and similar
groups for other spoken languages), about tcl 7.5 not compiling
on linux 2.0.1 and above.

It usually ends up breaking on a file in the _generic_ directory
of the Tcl source tree called tclPosixStr.c. The output looks like
this:

---
cc -c -O  -I./../generic -I. -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 
-DTIME_WITH_SYS_TIME=1 -DHAVE_TZNAME=1 -DHAVE_TIMEZONE_VAR=1
-DSTDC_HEADERS=1  
     -DTCL_SHLIB_EXT=\".so\" ./../generic/tclPosixStr.c
/../generic/tclPosixStr.c: In function `Tcl_ErrnoId':
/../generic/tclPosixStr.c:121: duplicate case value
/../generic/tclPosixStr.c:118: this is the first entry for that value
/../generic/tclPosixStr.c: In function `Tcl_ErrnoMsg':
/../generic/tclPosixStr.c:567: duplicate case value
/../generic/tclPosixStr.c:564: this is the first entry for that value
make: *** [tclPosixStr.o] Error 1
---

The reason is that the lines in the file tclPosixStr.c -- it's checking for the definition of EDEADLK and EDEADLOCK. I guess it assumes that both aren't defined simultaneously or dont have the same value. Now, as of the 2.0.1-patch EDEADLK and EDEADLOCK are the same.

A small patch was posted to comp.lang.tcl...I modified the file and it compiles, and I've been using it daily without incident for 2+ weeks.

It probably their problem, but I'm just wondering: it's supposed to be that way, right?

---
Mark Orr
markorr@intersurf.com

=== Below is the workaround that I used ==========

--- tclPosixStr.c Sun Feb 11 18:56:21 1996 +++ /tcl/src/tcl7.5/generic/tclPosixStr.c Thu Jul 18 18:27:57 1996 @@ -114,7 +114,7 @@ #ifdef ECONNRESET case ECONNRESET: return "ECONNRESET"; #endif -#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) && (!defined(EDEADLOCK) || (EDEADLK != EDEADLOCK)) case EDEADLK: return "EDEADLK"; #endif #ifdef EDEADLOCK @@ -560,7 +560,7 @@ #ifdef ECONNRESET case ECONNRESET: return "connection reset by peer"; #endif -#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) && (!defined(EDEADLOCK) || (EDEADLK != EDEADLOCK)) case EDEADLK: return "resource deadlock avoided"; #endif #ifdef EDEADLOCK

-----------------------