9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: ori@eigenstate.org, conor.williams@gmail.com, 9fans@9fans.net
Subject: Re: [9fans] Tcl 8.7a3 port to Plan 9
Date: Sun Jun 21 12:34:27 PDT 2020	[thread overview]
Message-ID: <A0B741EFDEE9ABE27A4BAF8255257756@eigenstate.org> (raw)

> ok... attached are the compiler listings...

First off, let's keep this on the list so that anyone can help out,
follow progress, or learn. (retrying, typoed the address before)
 
> i have made very few changes to the code so
> no diff yet...
> -----------------------------
> #                  file.6
> -----------------------------
> cc -c -O    -DBUILD_tcl  -I"." -I/usr/glenda/tcl8.6.10/unix
> -I/usr/glenda/tcl8.6.10/generic -I/usr/glenda/tcl8.6.10/libtommath
>  -DPACKAGE_NAME=\"tcl\" -DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\"
> -DPACKAGE_STRING=\"tcl\ 8.6\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1
> -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
> -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DNO_DLFCN_H=1
> -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=0 -D_REENTRANT=1 -D_THREAD_SAFE=0
> -DTCL_CFGVAL_ENCODING=\"iso8859-1\" -DHAVE_NET_ERRNO_H=1 -DHAVE_ZLIB=1
> -DMODULE_SCOPE=extern -DTCL_SHLIB_EXT=\"\" -DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1
> -DTCL_TOMMATH=1 -DMP_PREC=4 -DTCL_WIDE_INT_TYPE=long\ long
> -DHAVE_STRUCT_DIRENT64=0 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRTOL=1
> -DHAVE_WAITPID=1 -DNO_GETWD=1 -DNO_REALPATH=1 -DNEED_FAKE_RFC2553=0
> -DHAVE_TERMIOS_H=1 -DHAVE_SYS_IOCTL_H=1 -DNO_FD_SET=1 -DHAVE_SYS_TIME_H=1
> -DTIME_WITH_SYS_TIME=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1
> -DHAVE_MKTIME=1 -DHAVE_TIMEZONE_VAR=1 -DNO_FSTATFS=1 -Dsocklen_t=int
> -Dintptr_t=int -Duintptr_t=unsigned\ int -DNO_UNION_WAIT=1
> -DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DNO_ISNAN=1
> -DHAVE_SYS_IOCTL_H=1 -DTCL_UNLOAD_DLLS=1       -DMP_FIXED_CUTOFFS
> -DMP_NO_STDINT /usr/glenda/tcl8.6.10/generic/tclIOSock.c
>  /usr/glenda/tcl8.6.10/generic/tclIOSock.c:191[stdin:18411] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:191[stdin:18411] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:192[stdin:18412] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:203[stdin:18421] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:205[stdin:18423] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:210[stdin:18428] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:230[stdin:18440] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:230[stdin:18440] name not
> declared: AI_PASSIVE
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:233[stdin:18443] structure not
> fully declared addrinfo
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:240[stdin:18450] incompatible
> types: "IND CONST CHAR" and "INT" for op "AS"
> /usr/glenda/tcl8.6.10/generic/tclIOSock.c:255[stdin:18461] structure not
> fully declared addrinfo
> too many errors

First off, TCL seems to do

	#ifdef FOO_FEATURE
	#	thing
	#endif

That means that

	-DFOO_FEATURE=0

is the same as

	-DFOO_FEATURE=1

The exception I see is for threads, where undefined threadss means
turning threading on, and -DTCL_THREADS=0 means turn it off.

I removed the -DFOO=0 defines, and added -DTCL_THREADS=0. Note, it'd
be better to import lufia's pthreads.h code from the pull request on
9legacy, and enable all ape programs to use pthreads.

Other than that, I needed to make four changes: 

	-DHAVE_NET_ERRNO_H=1: 
		we don't have this
	-DNEED_FAKE_RFC2553=0:
		this breaks us
	-D_BSD_EXTENSION:
		we need to turn on some BSD functions. There's a good
		chance that you'll need -D_POSIX_SOURCE -D_SUSV2_SOURCE
		for some other code too; I find that pretty much any
		recent code that does nontrivial things wants these to
		be defined.
	-tclUnixPort.h:134 #include <sys/file.h>
		we don't have this, but there's no define around it;
		this works for the file I compiled, but probably breaks
		elsewhere; you'll probably need to look at what posix
		mandates is in here, and then implement it.

Running on 9front amd64. the command that worked for this file:

	cc -c -O -D_BSD_EXTENSION -DTCL_THREADS=0 -DBUILD_tcl -I"."
	-I/tmp/tcl8.7a3/unix -I/tmp/tcl8.7a3/generic
	-I/tmp/tcl8.7a3/libtommath -DPACKAGE_NAME=\"tcl\"
	-DPACKAGE_TARNAME=\"tcl\" -DPACKAGE_VERSION=\"8.6\"
	-DPACKAGE_STRING=\"tcl\ 8.6\" -DPACKAGE_BUGREPORT=\"\"
	-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
	-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1
	-DNO_VALUES_H=1 -DNO_DLFCN_H=1 -DHAVE_SYS_PARAM_H=1
	-D_REENTRANT=1 -DTCL_CFGVAL_ENCODING=\"iso8859-1\"
	-DHAVE_ZLIB=1 -DMODULE_SCOPE=extern -DTCL_SHLIB_EXT=\"\"
	-DNDEBUG=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_TOMMATH=1 -DMP_PREC=4
	-DTCL_WIDE_INT_TYPE=long\ long -DHAVE_GETCWD=1
	-DHAVE_OPENDIR=1 -DHAVE_STRTOL=1 -DHAVE_WAITPID=1 -DNO_GETWD=1
	-DNO_REALPATH=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_IOCTL_H=1
	-DNO_FD_SET=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
	-DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MKTIME=1
	-DHAVE_TIMEZONE_VAR=1 -DNO_FSTATFS=1 -Dsocklen_t=int
	-Dintptr_t=int -Duintptr_t=unsigned\ int -DNO_UNION_WAIT=1
	-DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DNO_ISNAN=1
	-DHAVE_SYS_IOCTL_H=1 -DTCL_UNLOAD_DLLS=1 -DMP_FIXED_CUTOFFS
	-DMP_NO_STDINT /tmp/tcl8.7a3/generic/tclIOSock.c

With this diff applied:

diff -urN tcl8.7a3/unix/tclUnixPort.h tcl8.7a3.new/unix/tclUnixPort.h
--- tcl8.7a3/unix/tclUnixPort.h	Sun Jun 21 12:32:13 2020
+++ tcl8.7a3.new/unix/tclUnixPort.h	Sun Jun 21 12:33:16 2020
@@ -131,7 +131,7 @@
  *---------------------------------------------------------------------------
  */
 
-#include <sys/file.h>
+//#include <sys/file.h>
 #ifdef HAVE_SYS_SELECT_H
 #   include <sys/select.h>
 #endif


             reply	other threads:[~2020-06-21 19:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-21 19:34 ori [this message]
     [not found] <CAL6pNZ_=-_KOertAzg=zhdcsu+0xPL-=Fy3HnwA50funft3mdw@mail.gmail.com>
     [not found] ` <5F3FC59B3F854BF644300D24C6D2BBFF@eigenstate.org>
     [not found]   ` <CAL6pNZ9eG116b7C3Z_7CFw57jU7tB36vLQkj6YDi5dF_OOYrXA@mail.gmail.com>
2020-06-21 19:47     ` Conor Williams
2020-06-21 19:50       ` ori
2020-06-21 20:41         ` Conor Williams
2020-06-21 21:24           ` Conor Williams
2020-06-21 22:40             ` Conor Williams
2020-06-21 23:01               ` ori
     [not found]                 ` <CAL6pNZ9iHNNKYYvOFzGF6AweZXFKJA-b5hY3UXGaEOONHsyz6Q@mail.gmail.com>
2020-06-21 23:27                   ` Fwd: " Conor Williams
2020-06-21 23:56                     ` Conor Williams
2020-06-22  0:08                       ` ori
2020-06-22  0:47                         ` Conor Williams
2020-06-22  0:53                           ` ori
2020-06-22  1:32                             ` Conor Williams
2020-06-22 11:18                               ` Conor Williams
  -- strict thread matches above, loose matches on Subject: below --
2020-06-21 10:27 Conor Williams
2020-06-21 12:54 ` [9fans] " Mat Kovach
2020-06-21 13:01   ` Conor Williams
2020-06-21 16:20 ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A0B741EFDEE9ABE27A4BAF8255257756@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9fans@9fans.net \
    --cc=conor.williams@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).