Failed to build tcl8.1

Thomas Kowatsch
Tue Aug 31 23:49:00 GMT 1999

Finally got it all compiled. I figured out what the problemwas, see below


> I just renamed these function in there modules prepending a Tk. Then
> compile worked just fine but when it came to link the dll I got
> thousands of unresolved externals from tcl like
>   tkWindow.o: In function `Initialize':
>   //z/STS/TCU/thirdparty/WinNT/tk8.1/win/./../generic/tkWindow.c:2717:
> undefined reference to `_imp__Tcl_PkgRequire'
>   //z/STS/TCU/thirdparty/WinNT/tk8.1/win/./../generic/tkWindow.c:2721:
> undefined reference to `_imp__Tcl_GetThreadData'

This was because of a bug in tcl.h (same was in tk.h) together whenusing -DUSE_TCL_STUBS. In tcl.h there is
macro at the top like:

#ifdef BUILD_tcl
# else
# endif

That seems very correct. But at the end of tcl.h there was:


EXTERN int              Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));



As I understood, to define the Tcl_AppInit TCL_STORAGE_CLASS must not be
defined. That's ok, but redefining TCL_STORAGE_CLASS after that looked
wrong for me, as it should be as in the top of the file. So I changed
it like in the top. Then I was able to build wish with just linking
against the stub library and no undefined reference occured.

> I figured out that this was due to the missing -ltcl81 in the buildline
> for the libtk81.dll. So I added that and then ... everything compiled
> ok. Then I installed everything in a temporary directory and tried to
> run it. tclsh81.exe semmed to be ok but when I ran wish81.exe I got
> a core. Loaded wish81.exe into gdb and run it. Following the output:


Ok this was obviously the wrong approach linking with -ltcl81 and stub
lib together and was the reason for the core to happen. I now can run
it ok.

But a another little problem occured. There is no console input after
I started wish81.exe. When I start the cygwish80.exe coming with
b20.1 a console window pops up. I examined code again and found the
problem to be in tk8.1/win/winMain.c. There are two entry points in
there, one is main() and the other is WinMain(). If main() is called
(what is obviously done by cygwin) then before Tk_Main() is called
a variable consoleRequired is set to FALSE. If I start wish81.exe in
gdb and set this variable to TRUE before call to Tk_Main() a
console window pops up. In WinMain() the consoleRequired is TRUE
before call to Tk_Main(). My question is now, what to do:

1.) change code in main() for cygwin to set consoleRequired to TRUE
2.) Find a possibility to get WinMain be called (Any advise)

Can anybody help me on this?


Thomas Kowatsch                      | - Senior Software Engineer -
Switching Test Solutions AG          | mailto:
Wavetek Wandel & Goltermann Divison5 | web   :
Friesenbergstr. 75                   | Phone : +41 1 454-6731
CH-8055 Zuerich                      | FAX   : +41 1 454-6612

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list