Some tips and tricks for Tcl/Tk and extensions on Solaris. Getting Tcl/Tk for Solaris: ActiveState is now building binaries of ActiveTcl for Solaris, available at http://aspn.activestate.com/ASPN/Downloads/ActiveTcl/. It is the most up-to-date and comprehensive binary available for Solaris right now. Unfortunately, the BLT extension is not yet included (as of July 2001). http://sunfreeware.com/ is also another useful location for binary packages, but the Tcl and expect versions there are rather dated. Building Tcl/Tk on Solaris: First, make absolutely sure you have eradicated all instances of /usr/ucb from your environment. Remove instances from your PATH, LD_LIBRARY_PATH, etc. until the following command comes up empty: env | grep /usr/ucb The reason for doing this is that there are, in various combinations of Solaris, conflicts between the functions found in the /usr/ucb libraries and the /usr/lib libraries. Mixing the two is almost certain to cause malfunctioning applications on various iterations of Solaris. For instance, one conflict that [LV] has found is that at times, using functions compiled against the /usr/ucb libraries results in directory reading functions which think they are a different format than libraries compiled against non-ucb libraries. This manifests itself as glob's failing, or directory entries missing letters, etc. A decent ANSI C compiler should be your next quest and you basically have two choices -- the free gcc compiler or Sun's non-free SunPro C compiler. gcc: Pre-built binaries for specific versions of Solaris are available at http://sunfreeware.com/ -- be absolutely sure to get a version for your ''exact'' version of Solaris, as a gcc installation is very tightly coupled to the Solaris header files, which tend to "evolve" between OS versions. Any of the gcc binaries at this site may be used to build Tcl/Tk and all of the C-based extensions. A more recent version of gcc (such as 2.95.3) is suggested for C++ extensions, which one would build from source using an older gcc binary. SunPro/Forte C: The name has apparently evolved now. More information is available at http://www.sun.com/forte/c/ as are trial downloads. Historically the SunPro compiler had done a better job at high optimization levels, which are mostly irrelevant for Tcl/Tk and extensions. Other build tools: Be certain to have /usr/ccs/bin in your PATH, so that you can find make, ar, and other useful tools. The Build: Once you have either of the above compilers installed and in your path, Tcl source and most extensions should build with: ./configure && make && make test && make install If you want to use cc, consider a slight variant: CC=cc export CC ./configure && make && make test && make install Otherwise, the configure defaults to looking for gcc . WARNING! Solaris comes with a file called /usr/ucb/cc . This is a shell that sets environment flags , etc. to put the ucb libraries into the compile environment. Be certain NOT to run that version of cc (see above). ---- [Martin Lemburg] 11.02.2003: I just built tcl 8.3.5 on Solaris 2.8 and had following problems: * the configure script doesn't build in the usage of the switch HAVE_TIMEZONE_VAR * the configure script uses CC instead of cc (on IRIX and AIX no problem) * the configure script doesn't build in the usage of the libraries socket and nsl Since building tcl 8.0.5 in 1999 on Solaris I have these problems with the configure script. Couldn't someone of the distribution team change this? ---- Note that I have been building Tcl on Solaris since the late 80s and I don't see the problem that Martin reports. Also, I don't see the situation being quite as ''desperate'' with regards to removing ucb from your environment. You just need to make certain that you don't use /usr/ucb/cc as your compiler. Also, note that Solaris 8 comes with an installation disk that contains gcc, if you can't afford Sun ONE's compiler. The remark regarding CC above is however quite important. Another thing I have found when building '''some''' Tcl applications and extensions is that when I install Tcl/Tk into some ''non-standard'' directory, I sometimes have to edit the generated Makefile to include a -R flag for each -L flag that is used when creating .so libraries or any executable programs. ---- [Martin Lemburg] 11.02.2003: * We don't use ucb. We have restrictions for the usage of our compilation/linkage environment. We are even not allowed to use gcc. * We use /opt/SUNWspro/WS6U2/bin/CC as CC and /opt/SUNWspro/WS6U2/bin/cc as cc. * Compiling with CC results in an abort while trying to compile the first source file * Could someone suggest what should be done that the configure script recognize the usage of the timezone variable? * Could someone suggest what should be done that the configure script recognize the usage of libsocket and libnsl? * the problems I have since 1999 in building tcl on Solaris where ever the same. The workstation I built on, was updated since 1999 regulary from Solaris 2.5 to 2.8, but it is probably not configured in an optimal way. ---- Have you reported the errors to the bug data base at http://tcl.sf.net/ ? ---- [Martin Lemburg] 11.02.2003: Sorry ... no - but 'd just changed it. ---- [Martin Lemburg] 11.02.2003: Me again ... we built tcl 8.3.5 with 64bit and our application uses Motif 1.1. The problem is, that for compability issues the opendir, readdir, closedir functions are redefined within tcl and that now Motif has problems with the redefined symbols. I deleted the symbol USE_DIRENT2 and the file compat/opendir.c from the makefile and recompiled. Everything seems to work, but we are a little bit afraid of causing now trouble with this changes! Could anybody help? ---- I don't understand this description of the problem - but then, I don't use Motif. I'm rather surprised that Tcl is redefining standard functions. Note that I just built tcl 8.3.5 on sparc solaris 8 using Sun's solaris c compiler version 5.3 and the test suite only fails one test. I think that something else on your system is contributing to some problems - I just don't know what. Could you consider trying the ActiveTcl Solaris binary distribution available from [ActiveState]? ---- [Category Porting] | [Category Operating System]