I cannot get Tcl (or an extension) to compile

Purpose: Document common problems attempting to compile Tcl or some extension.


Configure says: cross-compiling... yes

When I run configure I get:

loading cache ./config.cache
checking for ranlib... :
checking whether cross-compiling... yes
    .
    .

Well, I would point you to some threads at http://www.deja.com/ , (You can usually trim most of the junk out of a Deja pathname, as it seems to usually be related to the search that lead you to the info, and not the thread itself - DKF) but they use such bizarre pathnames that it causes Wiki to have heartburn. So here's what I can tell you:

The cross-compiling yes message is generally trouble. Cross-compiling is a feature of at least gcc (and perhaps other compilers as well) where executable code for platform A is generated on platform B. The reason that tests cannot be run is that in general processor B can't execute code for processor A. For instance, if your SGI computer/compiler were generating MSDOS executable code, it is unlikely that configure would know how to run MSDOS code.

Other reasons configure think it's cross-compiling:

licensing difficulties
the compiler is installed, but doesn't generate legit objects because it's somehow disabled
unclean source directory
if (a) the source tree is NFS-mounted from a foreign OS, or (b) someone duplicated a source tree from a foreign OS, there will often be enough configuration information from the foreign OS to make configure think it's cross-compiling
dueling compilers
if there are a couple of compilers present (/usr/ucb/cc, /bin/cc, /usr/local/bin/gcc), and your PATH is weird enough to trigger a configure misfeature, configure will be confused about what it's doing, and collapse in the direction of cross-compilation.

JC, regarding the heartburn mentioned above: see the archive of *-URL messages for pointers to deja.com which work: http://www.purl.org/mini/cgi-bin/url/ (like [L1 ] or [L2 ]).


Howto compile document

See https://www.tcl-lang.org/doc/howto/compile.html - How to Compile Tcl for Unix, Windows, and MacOS.

Tk needs X11

Be certain to have X11 installed on Unix and similar systems before attempting to build Tk and related exensions. And before running the test suite for Tk and likely other related extensions, X should be running and the environmental variable DISPLAY set appropriately.