Subject: Re: Failed to build tcl8.1
From: Brendan Simon <[email-masked]>
To: Thomas Kowatsch <[email-masked]>
Cc: Cygwin List <[email-masked]>
Date: Wed, 25 Aug 1999 10:11:48 +1000

Thomas Kowatsch wrote:

> Mumit Khan wrote:
>
> > Thomas Kowatsch <[email-masked]> writes:
> > > I just tried to compile tcl8.1 following Mumit's directions but failed.
> > >
> > > I have dowloaded tcl8.1.1, gcc-2.95, w32api-0.1.5. I have installed the
> > > B20.1 release and replaced compiler with gcc-2.95 from Mumit's build.
> > > Apllied also Mumit's patch for w32api-0.1.5, maked and installed it into
> >
> > My patches are for 8.1, not for 8.1.1, which is quite different in some
> > areas (eg., it uses winsock2, not supported (yet) by the w32api headers).
> >
> > Regards,
> > Mumit
>
> Sorry for picking up this thread again but I still have problems but had
> to do something else for the last two weeks.
> As Mumit suggested I downloaded 8.1, applied his patches. Tcl build very
> fine without problems. But I had problems with building TK. There were
> some functions defined locally in modules which have the same name
> as prototypes in wingdi.h and winuser.h. These were:
>
> - CreateBitmap() in generic/tkCanvBmap.c
> - GetCursor() in generic/tkCursor.c
> - SetFocus() in generic/tkFocus.c
>
> 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'
>
> 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:
>
> (gdb) r
> Starting program: /tmp/tcl/bin/wish81.exe
> 6d500000:/tmp/tcl/bin/tcl81.dll
>
> [failed reading symbols from DLL]
> "/c/WINNT/system32/ADVAPI32.DLL": error reading line numbers
>
> [failed reading symbols from DLL]
> "/c/WINNT/system32/KERNEL32.dll": error reading line numbers
>
> 77e70000:/c/WINNT/system32/USER32.dll
> 77ed0000:/c/WINNT/system32/GDI32.dll
> 77e10000:/c/WINNT/system32/RPCRT4.dll
> 61000000:/usr/local/cygnus/cygwin-b20/usr/bin/cygwin1.dll
> 642c0000:/tmp/tcl/bin/tk81.dll
> 77d80000:/c/WINNT/system32/COMDLG32.DLL
> 77c40000:/c/WINNT/system32/SHELL32.dll
> 71030000:/c/WINNT/system32/COMCTL32.dll
> 5f810000:/c/WINNT/System32/rpcltc1.dll
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x643450ca in Tk_InitStubs (interp=0x247b178, version=0x64345eca "8.1",
>     exact=1) at ./../generic/tkStubLib.c:91
> 91          actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, exact,
> (gdb) bt
> #0  0x643450ca in Tk_InitStubs (interp=0x247b178, version=0x64345eca "8.1",
>     exact=1) at ./../generic/tkStubLib.c:91
> #1  0x643479f0 in Initialize (interp=0x247b178) at
> ./../generic/tkWindow.c:2956
> #2  0x64347376 in Tk_Init (interp=0x247b178) at ./../generic/tkWindow.c:2618
> #3  0x401104 in Tcl_AppInit ()
> #4  0x6431bc51 in Tk_MainEx (argc=1, argv=0xa0310b8,
>     appInitProc=0x4010dc <Tcl_AppInit>, interp=0x247b178)
>     at ./../generic/tkMain.c:218
> #5  0x4013c8 in main ()
> #6  0x6100442e in _size_of_stack_reserve__ ()
> #7  0x61004517 in _size_of_stack_reserve__ ()
> #8  0x40156e in cygwin_crt0 (f=0x401364 <main>)
>     at /home/noer/src/b20/comp-tools/devo/winsup/libccrt0.cc:81
> (gdb) list
> 86          char *version;
> 87          int exact;
> 88      {
> 89          char *actualVersion;
> 90
> 91          actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, exact,
> 92                      (ClientData *) &tkStubsPtr);
> 93          if (!actualVersion) {
> 94              return NULL;
> 95          }
> (gdb) print interp
> $1 = (Tcl_Interp *) 0x247b178
> (gdb) print version
> $2 = 0x64345eca "8.1"
> (gdb) print exact
> $3 = 1
> (gdb) print tkStubsPtr
> $4 = (TkStubs *) 0x0
> (gdb) print &tkStubsPtr
> $5 = (TkStubs **) 0x64365c70
> (gdb) print  Tcl_PkgRequireEx
> $6 = {char *(Tcl_Interp *, char *, char *, int,
>     ClientData *)} 0x6d54ab8c <Tcl_PkgRequireEx>
>
> Anybody got an idea? The link line of the wish produces following output:
>
> gcc  -o wish81.exe   -mwindows  wish.res.o \
>         winMain.o  libtk81.a ../../tcl8.1/win/./libtcl81.a \
>           -luser32 -lcomdlg32 -lgdi32 -lwinspool
> /usr/local/cygnus/cygwin-b20/usr/bin/../lib/gcc-lib/i586-cygwin32/2.95/../../../../i586-cygwin32/bin/ld:
> warning: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000

I think this is a common problem with cygwin compiles.  You have to undefine a symbol on the linker command
line but I don't recall what the symbol is.  I'm pretty sure there are plenty of posts in the mail
archives.  Go to sourceware.cygnus.com and search the archives and you should be set.

Brendan Simon.

--
Want to unsubscribe from this list?
Send a message to [email-masked]