summaryrefslogtreecommitdiffstats
path: root/unix/porting.notes
blob: f04e5ca9a521981b28b85593d125d083dfb5d684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
This file contains a collection of notes that various people have
provided about porting Tcl to various machines and operating systems.
I don't have personal access to any of these machines, so I make
no guarantees that the notes are correct, complete, or up-to-date.
If you see the word "I" in any explanations, it refers to the person
who contributed the information, not to me;  this means that I
probably can't answer any questions about any of this stuff.  In
some cases, a person has volunteered to act as a contact point for
questions about porting Tcl to a particular machine;  in these
cases the person's name and e-mail address are listed.  I'm
interested in getting new porting information to add to the file;
please mail updates to "john.ousterhout@eng.sun.com".

This file reflects information provided for Tcl 7.4 and later releases (8.x).
If there is no information for your configuration in this file, check
the file "porting.old" too;  it contains information that was
submitted for Tcl 7.3 and earlier releases, and some of that information
may still be valid.

A new porting database has recently become available on the Web at
the following URL:
    http://www.sunlabs.com/cgi-bin/tcl/info.8.0
This page provides information about the platforms on which Tcl and
and Tk 8.0 have been compiled and what changes were needed to get Tcl
and Tk to compile.  You can also add new entries to that database
when you install Tcl and Tk on a new platform.  The Web database is
likely to be more up-to-date than this file.

sccsid = RCS: @(#) $Id: porting.notes,v 1.2 1998/09/14 18:40:16 stanton Exp $

--------------------------------------------
Solaris, various versions
--------------------------------------------

1. If typing "make test" results in an error message saying that
there are no "*.test" files, or you get lots of globbing errors,
it's probably because your system doesn't have cc installed and
you used gcc.  In order for this to work, you have to set your
CC environment variable to gcc and your CPP environment variable
to "gcc -E" before running the configure script.

2. Make sure that /usr/ucb is not in your PATH or LD_LIBRARY_PATH
environment variables;  this will cause confusion between the new
Solaris libraries and older UCB versions (Tcl will expect one version
and get another).

3. There have been several reports of problems with the "glob" command.
So far these reports have all been for older versions of Tcl, but
if you run into problems, edit the Makefile after "configure" is
run and add "-DNO_DIRENT_H=1" to the definitions of DEFS.  Do this
before compiling.

--------------------------------------------
SunOS 4 and potentially other OSes
--------------------------------------------

On systems where both getcwd(3) and getwd(3) exist, check the man
page and if getcwd, like on SunOS 4, uses popen to pwd(1)
add -DUSEGETWD to the flags CFLAGS so getwd will be used instead.

That is, change the CFLAGS = -O line so it reads 
CFLAGS = -O -DUSEGETWD

--------------------------------------------
Linux, ELF, various versions/distributions
--------------------------------------------

If ./configure --enable-shared complains it can not do a shared
library you might have to make the following symbolic link:
ln -s /lib/libdl.so.1 /lib/libdl.so
then remove config.cache and re run configure.

--------------------------------------------
Pyramid DC/OSx SVr4, DC/OSx version 94c079
--------------------------------------------

Tcl seems to dump core in cmdinfo.test when compiled with the
optimiser turned on in TclEval which calls 'free'.  To get around
this, turn the optimiser off.

--------------------------------------------
SGI machines, IRIX 5.2, 5.3, IRIX64 6.0.1
--------------------------------------------

1. If you compile with gcc-2.6.3 under some versions of IRIX (e.g.
   4.0.5), DBL_MAX is defined too large for gcc and Tcl complains
   about all floating-point values being too large to represent.
   If this happens, redefining DBL_MAX to 9.99e299.

2. Add "-D_BSD_TIME" to CFLAGS in Makefile.  This avoids type conflicts
in the prototype for the gettimeofday procedure.

2. If you're running under Irix 6.x and tclsh dumps core, try
removing -O from the CFLAGS in Makefile and recompiling;  compiler
optimizations seem to cause problems on some machines.

--------------------------------------------
IBM RTs, AOS
--------------------------------------------

1. Steal fmod from 4.4BSD
2. Add a #define to tclExpr such that:
extern double fmod(); 
is defined conditionally on ibm032

--------------------------------------------
QNX 4.22
--------------------------------------------

tclPort.h
	- commented out 2 lines containing #include <sys/param.h>

tcl.h
	- changed  #define VARARGS ()
	- to       #ifndef __QNX__
	             #define VARARGS ()
	           #else
	             #define VARARGS (void *, ...)
	           #endif

--------------------------------------------
Interactive UNIX
--------------------------------------------

Add the switch -Xp to LIBS in Makefile;  otherwise strftime will not
be found when linking.

--------------------------------------------
Motorola SVR4 V4.2 (m88k)
--------------------------------------------

For Motorola Unix R40V4.2 (m88k architechure), use /usr/ucb/cc instead of
/usr/bin/cc.  Otherwise, the compile will fail because of conflicts over
the gettimeofday() call.

Also, -DNO_DIRENT_H=1 is required for the "glob" command to work.

--------------------------------------------
NeXTSTEP 3.x
--------------------------------------------

Here's the set of changes I made to make 7.5b3 compile cleanly on
NeXTSTEP3.x.

Here are a couple lines from unix/Makefile:

# Added utsname.o, which implements a uname() emulation for NeXTSTEP.
COMPAT_OBJS =		 getcwd.o strtod.o tmpnam.o utsname.o

TCL_NAMES=\
	-Dstrtod=tcl_strtod -Dtmpnam=tcl_tmpnam -Dgetcwd=tcl_getcwd \
	-Dpanic=tcl_panic -Dmatherr=tcl_matherr \
	-Duname=tcl_uname -Dutsname=tcl_utsname

# Added mode_t, pid_t, and O_NONBLOCK definitions.
AC_FLAGS =		 -DNO_DIRENT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1  
-DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1  
-DSTDC_HEADERS=1 -Dmode_t=int -Dpid_t=int -DO_NONBLOCK=O_NDELAY ${TCL_NAMES}


Here are diffs for other files.  utsname.[hc] are a couple files I added
to compat/  I'm not clear whether that's where they legitimately belong
- I considered stashing them in tclLoadNext.c instead.  The tclIO.c
change was a bug, I believe, which I reported on comp.lang.tcl and
has apparently been noted and fixed.  The objc_loadModules() change
allows "load" to load object code containing Objective-C code in
addition to plain C code.

---
scott hess <shess@winternet.com> (WWW to "http://www.winternet.com/~shess/")
Work: 12550 Portland Avenue South #121, Burnsville, MN  55337  (612)895-1208


diff -rc tcl7.5b3.orig/compat/utsname.c tcl7.5b3/compat/utsname.c
*** tcl7.5b3.orig/compat/utsname.c	Tue Apr  2 13:57:23 1996
--- tcl7.5b3/compat/utsname.c	Mon Mar 18 11:05:54 1996
***************
*** 0 ****
--- 1,27 ----
+ /*
+  * utsname.c --
+  *
+  *	This file is an emulation of the POSIX uname() function
+  *	under NeXTSTEP 3.x.
+  *
+  */
+ 

+ #include "utsname.h"
+ #include <mach-o/arch.h>
+ #include <stdio.h>
+ 

+ int uname( struct utsname *name)
+ {
+     const NXArchInfo *arch;
+     if( gethostname( name->nodename, sizeof( name->nodename))==-1) {
+ 	return -1;
+     }
+     if( (arch=NXGetLocalArchInfo())==NULL) {
+ 	return -1;
+     }
+     strncpy( name->machine, arch->description, sizeof( name->machine));
+     strcpy( name->sysname, "NEXTSTEP");
+     strcpy( name->release, "0");
+     strcpy( name->version, "3");
+     return 0;
+ }
diff -rc tcl7.5b3.orig/compat/utsname.h tcl7.5b3/compat/utsname.h
*** tcl7.5b3.orig/compat/utsname.h	Tue Apr  2 13:57:26 1996
--- tcl7.5b3/compat/utsname.h	Mon Mar 18 10:34:05 1996
***************
*** 0 ****
--- 1,22 ----
+ /*
+  * utsname.h --
+  *
+  *	This file is an emulation of the POSIX uname() function
+  *	under NeXTSTEP.
+  *
+  */
+ 

+ #ifndef _UTSNAME
+ #define _UTSNAME
+ 

+ struct utsname {
+     char sysname[ 32];
+     char nodename[ 32];
+     char release[ 32];
+     char version[ 32];
+     char machine[ 32];
+ };
+ 

+ extern int uname( struct utsname *name);
+ 

+ #endif /* _UTSNAME */
diff -rc tcl7.5b3.orig/generic/tclIO.c tcl7.5b3/generic/tclIO.c
*** tcl7.5b3.orig/generic/tclIO.c	Fri Mar  8 12:59:53 1996
--- tcl7.5b3/generic/tclIO.c	Mon Mar 18 11:38:57 1996
***************
*** 2542,2548 ****
              }
              result = GetInput(chanPtr);
              if (result != 0) {
!                 if (result == EWOULDBLOCK) {
                      chanPtr->flags |= CHANNEL_BLOCKED;
                      return copied;
                  }
--- 2542,2548 ----
              }
              result = GetInput(chanPtr);
              if (result != 0) {
!                 if (result == EAGAIN) {
                      chanPtr->flags |= CHANNEL_BLOCKED;
                      return copied;
                  }
diff -rc tcl7.5b3.orig/unix/tclLoadNext.c tcl7.5b3/unix/tclLoadNext.c
*** tcl7.5b3.orig/unix/tclLoadNext.c	Sat Feb 17 16:16:42 1996
--- tcl7.5b3/unix/tclLoadNext.c	Mon Mar 18 10:02:36 1996
***************
*** 55,61 ****
    char *files[]={fileName,NULL};
    NXStream *errorStream=NXOpenMemory(0,0,NX_READWRITE);
  

!   if(!rld_load(errorStream,&header,files,NULL)) {
      NXGetMemoryBuffer(errorStream,&data,&len,&maxlen);
      Tcl_AppendResult(interp,"couldn't load file \"",fileName,"\": ",data,NULL);
      NXCloseMemory(errorStream,NX_FREEBUFFER);
--- 55,61 ----
    char *files[]={fileName,NULL};
    NXStream *errorStream=NXOpenMemory(0,0,NX_READWRITE);
  

!   if(objc_loadModules(files,errorStream,NULL,&header,NULL)) {
      NXGetMemoryBuffer(errorStream,&data,&len,&maxlen);
      Tcl_AppendResult(interp,"couldn't load file \"",fileName,"\": ",data,NULL);
      NXCloseMemory(errorStream,NX_FREEBUFFER);
diff -rc tcl7.5b3.orig/unix/tclUnixFile.c tcl7.5b3/unix/tclUnixFile.c
*** tcl7.5b3.orig/unix/tclUnixFile.c	Thu Mar  7 18:16:34 1996
--- tcl7.5b3/unix/tclUnixFile.c	Mon Mar 18 11:10:03 1996
***************
*** 31,37 ****
--- 31,41 ----
  

  static int executableNameExitHandlerSet = 0;
  

+ #if NeXT
+ #define waitpid( p, s, o) wait4( p, s, o, NULL)
+ #else
  extern pid_t waitpid _ANSI_ARGS_((pid_t pid, int *stat_loc, int options));
+ #endif
  

  /*
   * Static routines for this file:
diff -rc tcl7.5b3.orig/unix/tclUnixInit.c tcl7.5b3/unix/tclUnixInit.c
*** tcl7.5b3.orig/unix/tclUnixInit.c	Sat Feb 17 16:16:39 1996
--- tcl7.5b3/unix/tclUnixInit.c	Mon Mar 18 11:50:28 1996
***************
*** 14,20 ****
  #include "tclInt.h"
  #include "tclPort.h"
  #ifndef NO_UNAME
! #   include <sys/utsname.h>
  #endif
  #if defined(__FreeBSD__)
  #include <floatingpoint.h>
--- 14,24 ----
  #include "tclInt.h"
  #include "tclPort.h"
  #ifndef NO_UNAME
! #    if NeXT
! #        include "../compat/utsname.h"
! #    else
! #        include <sys/utsname.h>
! #    endif
  #endif
  #if defined(__FreeBSD__)
  #include <floatingpoint.h>
diff -rc tcl7.5b3.orig/unix/tclUnixPort.h tcl7.5b3/unix/tclUnixPort.h
*** tcl7.5b3.orig/unix/tclUnixPort.h	Thu Mar  7 18:16:31 1996
--- tcl7.5b3/unix/tclUnixPort.h	Mon Mar 18 11:53:14 1996
***************
*** 76,82 ****
   */
  

  #include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
! #include <sys/utsname.h>	/* uname system call. */
  #include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
  #include <arpa/inet.h>		/* inet_ntoa() */
  #include <netdb.h>		/* gethostbyname() */
--- 76,88 ----
   */
  

  #include <sys/socket.h>		/* struct sockaddr, SOCK_STREAM, ... */
! #ifndef NO_UNAME
! #    if NeXT
! #        include "../compat/utsname.h"
! #    else
! #        include <sys/utsname.h>	/* uname system call. */
! #    endif
! #endif
  #include <netinet/in.h>		/* struct in_addr, struct sockaddr_in */
  #include <arpa/inet.h>		/* inet_ntoa() */
  #include <netdb.h>		/* gethostbyname() */

--------------------------------------------
SCO Unix 3.2.4 (ODT 3.0)
--------------------------------------------
 
The macro va_start in /usr/include/stdarg.h is incorrectly terminated by
a semi-colon.  This causes compile of generic/tclBasic.c to fail.  The
best solution is to edit the definition of va_start to remove the `;'.
This will fix this file for anything you want to compile.  If you don't have
permission to edit /usr/include/stdarg.h in place, copy it to the tcl unix
directory and change it there.
 
Contact me directly if you have problems on SCO systems.
Mark Diekhans <markd@grizzly.com>
 
--------------------------------------------
SCO Unix 3.2.5 (ODT 5.0)
--------------------------------------------

Expect failures from socket tests 2.9 and 3.1.

Contact me directly if you have problems on SCO systems.
Mark Diekhans <markd@grizzly.com>
 
--------------------------------------------
Linux 1.2.13 (gcc 2.7.0, libc.so.5.0.9)
--------------------------------------------

Symptoms:

*	Some extensions could not be loaded dynamically, most
	prominently Blt 2.0

	The given error message essentially said:
	Could not resolve symbol '__eprintf'.

	(This procedure is used by the macro 'assert')

Cause

*	'__eprintf' is defined in 'libgcc.a', not 'libc.so.x.y'.
	It is therefore impossible to load it dynamically.

*	Neither tcl nor tk make use of 'assert', thereby
	preventing a static linkage.

Workaround

*	I included <assert.h> in 'tclAppInit.c' / 'tkAppInit.c'
	and then executed 'assert (argc)' just before the call
	to Tcl_Main / Tk_Main.

	This forced the static linkage of '__eprintf' and
	everything went fine from then on.

	(Something like 'assert (1)', 'assert (a==a)' is not
	sufficient, it will be optimized away).