Installing Tcl8.6b1.1 on Solaris2.5
I had built this nifty little web server and wanted to use it for automating some critical sysadmin tasks. It used coroutines, and so I decided to go with CVS head.
But this was the only machine with solaris 2.5 that was still working. So I had to build it on the machine. I thought no big deal.
Didn't have cvs. No big deal (NBD), checked out on linux and ftped into the solaris box.
Didn't have gcc. NBD. Went to friendly neighbourhood http://www.sunfreeware.com (I recommend it highly to anyone who does anything on solaris) and downloaded the latest gcc I could find gcc-3.4.2-sol25-sparc-local.gz. Sunfreeware clearly mentioned I needed libiconv, so I got the latest of that too: libiconv-1.11-sol25-sparc-local.gz
# gzip -d gcc-3.4.2-sol25-sparc-local.gz
# pkgadd -d gcc-3.4.2-sol25-sparc-local
pkgadd: ERROR: unable to open admin file
Ok. NBD. Google is our friend
http://www.sunmanagers.org/pipermail/sunmanagers/2001-November/008472.html gives the solution
# touch /var/sadm/install/admin/default
# chown root /var/sadm/install/admin/default
# chmod sys /var/sadm/install/admin/default
# chmod 444 /var/sadm/install/admin/default
Now retry
# pkgadd -d gcc-3.4.2-sol25-sparc-local
That printed a bunch of stuff, then aborted, the important message being
process failed, exit code 12
Now my friend Google didn't give anything directly useful. But there were some pointers indicating it was running out of space somewhere. So in another
window as a user, I did df while the process was running.
csh% while true
> df -k
> sleep 1
> end
csh%
Then I watched it while I repeated the pkgadd command as root. I soon saw
that I was running out of space on /tmp, which is the same as swap. NBD. I
found I had tons of space on /export. the uncompressed pkg file was about 110MB, so I figured 130MB more swap should cover anything
# mkfile 130m /export/moreswap
# swap -a /export/moreswap
Retry the command.
# pkgadd -d gcc-3.4.2-sol25-sparc-local
Now it went through fine. Delete the extra swap
# swap -d /export/moreswap
# rm /export/moreswap
and then as a user check it
# gcc -v
That printed something about libiconv which I forgot to install.
# pkgadd -d libiconv-1.11-sol25-sparc-local
Then gcc seemed to startup. Now onto the tcl part. Starting from the
untarred tcl folder as a user.
$ cd unix
$ ./configure --prefix=/usr/local/tcl/8.6b1.1
lots of lines here, then many sets like this:
checking float.h usability... no
checking float.h presence... yes
configure: WARNING: float.h: present but cannot be compiled
configure: WARNING: float.h: check for missing prerequisite headers?
configure: WARNING: float.h: see the Autoconf documentation
configure: WARNING: float.h: section "Present But Cannot Be Compiled"
configure: WARNING: float.h: proceeding with the preprocessor's result
configure: WARNING: float.h: in the future, the compiler will take precedence
configure: WARNING: ## ------------------------------ ##
configure: WARNING: ## Report this to the tcl lists. ##
configure: WARNING: ## ------------------------------ ##
checking for float.h... yes
Obviously I didn't report it to the tcl lists. I just let configure finish even
with all the warnings.
$ make
gcc .../generic/regcomp.c
In file included from /usr/local/tcl/8.6b1.1/tcl/generic/tcl.h:142,
from /usr/local/tcl/8.6b1.1/tcl/generic/tclInt.h:44,
from /usr/local/tcl/8.6b1.1/tcl/generic/regcustom.h:33,
from /usr/local/tcl/8.6b1.1/tcl/generic/regguts.h:36,
from /usr/local/tcl/8.6b1.1/tcl/generic/regcomp.c:33:
/usr/local/bin/../lib/gcc/sparc-sun-solaris2.5.1/3.4.2/include/stdio.h:32:25: sys/va_list.h: No such file or directory
*** Error code 1
That was strange - stdio.h couldn't find sys/va_list.h. I searched around and couldn't find it either. But grepping for va_list stuff showed that it was in
stdarg.h which was already being included. I just commented that line out
in stdio.h. (diff -u)
+ /*
#include <va_list.h>
+ */
Then I redid the configure cleaning the config cache:
$ make distclean
$ ./configure --prefix=/usr/local/tcl/8.6b1.1
after that finished.
$ make
Ignored a bunch of warnings there, then it hit an error:
gcc -c ... unix/tclUnixSock.c
.../unix/tclUnixSock.c: In function `TcpClose2Proc':
.../unix/tclUnixSock.c:554: error: `SHUT_RD' undeclared (first use in this function)
.../unix/tclUnixSock.c:554: error: (Each undeclared identifier is reported only once
.../unix/tclUnixSock.c:554: error: for each function it appears in.)
.../unix/tclUnixSock.c:557: error: `SHUT_WR' undeclared (first use in this function)
*** Error code 1
Looking at tclUnixSock.c, this was in a function called TcpClose2Proc, which
in turn called shutdown (which is used to close one half of a bidi socket)
I found shutdown.h in sys/socket.h, but there was no mention of the defines that the code was looking for. I just put the defines in the source file:
static int
TcpClose2Proc(
ClientData instanceData, /* The socket to close. */
Tcl_Interp *interp, /* For error reporting. */
int flags) /* Flags that indicate which side to close. */
{
+ #define SHUT_RD 0
+ #define SHUT_WR 1
Then it went all the way to building the executable, then failed with:
+ #define SHUT_WR 1
+
Then it went all the way to building the executable, then failed with:
gcc -DNDEBUG -O2 -pipe tclAppInit.o -L/usr/local/tcl/8.6b1.1/tcl/unix \
-ltcl8.6 -ldl -lsocket -lnsl -lm -Wl,-R,/usr/local/tcl/8.6b1.1/lib -o tclsh
Undefined first referenced
symbol in file
__register_frame_info /usr/local/bin/../lib/gcc/sparc-sun-solaris2.5.1/3.4.2/crtbegin.o (symbol belongs to implicit dependency /usr/local/bin/../lib/gcc/sparc-sun-solaris2.5.1/3.4.2/../../../libgcc_s.so.1)
vsnprintf /usr/local/tcl/8.6b1.1/tcl/unix/libtcl8.6.so
__deregister_frame_info /usr/local/bin/../lib/gcc/sparc-sun-solaris2.5.1/3.4.2/crtbegin.o (symbol belongs to implicit dependency /usr/local/bin/../lib/gcc/sparc-sun-solaris2.5.1/3.4.2/../../../libgcc_s.so.1)
ld: fatal: Symbol referencing errors. No output written to tclsh
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `tclsh'
NBD. I Have to figure out where vsnprintf is defined and add that
$ cd /usr/local/lib
$ for i in *.a; do echo $i; nm $i | grep vsnprintf; done
libcharset.a
libiberty.a
[6] | 0| 0|NOTY |GLOB |0 |UNDEF |vsnprintf
libiberty.a[vsnprintf.o]:
[8] | 0| 164|FUNC |GLOB |0 |2 |vsnprintf
[1] | 0| 0|FILE |LOCL |0 |ABS |vsnprintf.c
libobjc.a
libstdc++.a
libsupc++.a
Ah ha. In -liberty, so I just add that to the command line in link command line in the makefile. Also poked around on the web and found that the register_frame_info is in -lgcc_s which is already included, but I guess it's an ordering problem.
From:
..... -o tclsh
To:
..... -liberty -lgcc_s -o tclsh
Then we have a tclsh! But it still fails later.
Configuring package 'itcl'
Configuring package 'tdbc'
Building package 'itcl'
make: Fatal error: Don't know how to make target `itcl2TclOO.o'
Current working directory /export/home/local/tcl/8.6b1.1/tcl/unix/pkgs/itcl
*** Error code 1
make: Fatal error: Command failed for target `packages'
Let's try it out.
$ ./tclsh
ld.so.1: ./tclsh: fatal: libtcl8.6.so: can't open file: errno=2
Killed
NBD.
$ setenv LD_LIBRARY_PATH .:$LD_LIBRARY_PATH
$ ./tclsh
% info patchlevel
8.6b1.1
%
Yay!!
Now onto building the packages. Turns out I didn't have gmake installed on this. sunfreeware to the rescue. I downloaded and installed make-3.81-sol25-sparc-local.gz and a dependency libintl-3.4.0-sol25-sparc-local.gz. The tcl core does not depend on VPATH but looks like the pkgs do.
# pkgadd -d make-3.81-sol25-sparc-local
# pkgadd -d libintl-3.4.0-sol25-sparc-local
$ make
And it went all the way through compile! Then
$ make install
/bin/bash: /usr/local/tcl/8.6b1.1/tcl/pkgs/tdbc/tclconfig/install-sh: Permission denied
NBD
$ chmod +x /usr/local/tcl/8.6b1.1/tcl/pkgs/tdbc/tclconfig/install-sh
$ make install
And it went through. We're done. That was not trivial, but still pretty easy. Thanks Tcl!