Closed Zamy846692 closed 10 months ago
It's hard to tell what's wrong, but my guess is that the compiler can't find Tcl/Tk.
I'm guessing you have them installed?
Check the C:/Users/[X]/AppData/Local/Programs/Git/mingw64/lib
directory. I suspect you want C:/Users/[X]/AppData/Local/Programs/Git/mingw64/lib
to be renamed to C:/Users/[X]/AppData/Local/Programs/Git/mingw64
and --with-tcl=$TCLCON --with-tk=$TCLCON
to --with-tcl=$TCLCON/lib --with-tk=$TCLCON/lib
.
It's been a while since I compiled it last, but if I remember correctly, you want tcl.h
and tcl.sh
in the directory set in --with-tclinclude=$TCL/include
and -with-tkinclude=$TCL/include
. I think you need a tcltk
folder in the --with-tcl=$TCLCON/lib
and --with-tk=$TCLCON/lib
folders. Make sure you send the right folders to ../configure
.
Let me know if this helps!
According to https://stackoverflow.com/questions/8024440/what-causes-the-error-undefined-reference-to-some-function “undefined reference to” is a linker error, from what I’ve been able to tell the compiler is unable to link to tclstub86.lib
/ tkstub86.lib
in MinGW\lib
(which seems to be where GCC’s C library flies https://stackoverflow.com/questions/6407975/what-are-header-files-and-library-files are kept). Weirdly when I replace those files with libtclstub86.a
/ libtkstub86.a
which I downloaded, I get:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtclstub86.a(tclStubLib.o):(.text+0x18): undefined reference to `__stack_chk_guard'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtclstub86.a(tclStubLib.o):(.text+0xfa): undefined reference to `__stack_chk_guard'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtclstub86.a(tclStubLib.o):(.text+0x1b2): undefined reference to `__stack_chk_fail'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtkstub86.a(tkStubLib.o):(.text+0x8): undefined reference to `__stack_chk_guard'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtkstub86.a(tkStubLib.o):(.text+0x106): undefined reference to `__stack_chk_guard'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libtkstub86.a(tkStubLib.o):(.text+0x21a): undefined reference to `__stack_chk_fail'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:273: libTkhtml3.0] Error 1
This seems to mean that the compiler can link to the UNIX files (like shown in mingw.mk
) but which themselves can’t link to libssp
- I think.
My guess is that I don’t actually have the right MinGW installation (COMPILE.txt
isn't very specific and I know little about it), or more specifically the .a
flies in MinGW\lib
, installed, given I had to manually add these two (the .lib
flies were added manually from Python39\tcl
). I am wondering what MinGW / GCC / TCL installation your using to compile it, because it don’t seem to be having these problems.
Weird... It's been a while since I last ran Mingw, and I don't have it on my computer anymore, but I'll try to offer some suggestions.
Do you have tk-dev
and tcl-dev
installed? I think that is what I had installed last time. If you have the right packages installed you should not have to download binaries and copy them into folders. I never had to do that.
Try running tclsh
or wish
in the terminal and type package require Tk
. A window should open and the Tk version should be printed. If it works, then you should have everything you need already on your system, it's just a matter of finding where all the files are located.
Let me know if this works?
I’m unaware of installing anything called tcl-dev
or tk-dev
, all the installations I’m aware of are in C:\Users\[X]\AppData\Local\rograms\Git\mingw64
and C:\MinGW
.
Ran tclsh
the in Git Bash terminal:
$ tclsh
% package require Tk
8.6.12
%
The window opened.
Couldn't find the stubs
archive library the complier needs. Looked around for tcl-dev
online but wasn't sure what to look for, where did you get tcl-dev
from? and I suppose they're what I need so how do I install them?
Source of MinGW: https://sourceforge.net/projects/mingw/
OK, I believe I may have successfully compiled it, but it is named libTkhtml3.0
(it claims to be a “.0
flie”) not Tkhtml30
and is only 333 KB whilst the one in TkinterWeb is 650 KB. All the .o
files are still in build
, is that normal?
Also should I be using MinGW or Mingw-w64?
Git Bash output:
gcc -static-libgcc -pipe -DPACKAGE_NAME=\"Tkhtml\" -DPACKAGE_TARNAME=\"tkhtml\" -DPACKAGE_VERSION=\"3.0\" -DPACKAGE_STRING=\"Tkhtml\ 3.0\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY
_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DNO_SYS_WAIT_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_LSEEK64=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=
1 -I"C:/MinGW/include" -I"C:/MinGW/include" -O2 -Wall -Wno-implicit-int -c -I. -I../src `echo ../src/htmltext.c` -o htmltext.o
gcc -static-libgcc -pipe -DPACKAGE_NAME=\"Tkhtml\" -DPACKAGE_TARNAME=\"tkhtml\" -DPACKAGE_VERSION=\"3.0\" -DPACKAGE_STRING=\"Tkhtml\ 3.0\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY
_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DNO_SYS_WAIT_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_LSEEK64=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=
1 -I"C:/MinGW/include" -I"C:/MinGW/include" -O2 -Wall -Wno-implicit-int -c -I. -I../src `echo ../src/htmlutil.c` -o htmlutil.o
gcc -static-libgcc -pipe -DPACKAGE_NAME=\"Tkhtml\" -DPACKAGE_TARNAME=\"tkhtml\" -DPACKAGE_VERSION=\"3.0\" -DPACKAGE_STRING=\"Tkhtml\ 3.0\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY
_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DNO_SYS_WAIT_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_LSEEK64=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=
1 -I"C:/MinGW/include" -I"C:/MinGW/include" -O2 -Wall -Wno-implicit-int -c -I. -I../src `echo ../src/cssprop.c` -o cssprop.o
rm -f libTkhtml3.0
gcc -static-libgcc -pipe -shared -o libTkhtml3.0 css.o cssdynamic.o cssparser.o csssearch.o htmldraw.o htmlfloat.o htmlhash.o htmlimage.o htmlinline.o htmllayout.o htmlparse.o htmlprop.o htmlstyle.o htmltagdb.o htmltable.o htmltcl.o htmltree.o swproc.o restrack.o htmldec
ode.o htmltext.o htmlutil.o cssprop.o -L/mingw64/lib -ltclstub86 -L/mingw64/lib -ltkstub86
: libTkhtml3.0
echo 'package ifneeded Tkhtml 3.0 [list load [file join $dir libTkhtml3.0]]' > pkgIndex.tcl
echo 'package ifneeded hv3 0.1 [list source [file join $dir hv3-0.1.tm]]' >> pkgIndex.tcl
And no, as of writing I haven't loaded it
As far as I can remember, it is perfectly normal for the .o
files to be there. The name should be fine. The binaries are given slightly different names on different platforms, so I renamed the binaries after compiling for consistency.
I would use MinGW-w64. It is a bit more advanced and supports both 32-bit and 64-bit programs, while MinGW only supports 32-bit programs. I'm pretty sure that I used the code from https://www.mingw-w64.org/
last time I compiled Tkhtml. However, most 32-bit programs will run on both 32-bit and 64-bit machines, so hey, if you have better luck getting usable binaries out of MinGW
, I'd stick to that instead.
https://www.mingw-w64.org/downloads/ has several Pre-built toolchains, which one do you mean?
Good point... It was MSYS2. I might have actually downloaded it from https://www.msys2.org; I can't remember.
Did the binary you compiled work?
On Wed, Nov 8, 2023, 12:31 p.m. Zamy846692 @.***> wrote:
https://www.mingw-w64.org/downloads/ has several Pre-built toolchains, which one do you mean?
— Reply to this email directly, view it on GitHub https://github.com/Andereoo/TkinterWeb/issues/86#issuecomment-1802346454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMA4CXQVV76QCIFMOLPKEMLYDO6V3AVCNFSM6AAAAAA6LAYPS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBSGM2DMNBVGQ . You are receiving this because you commented.Message ID: @.***>
I have been able to install MSYS2 (it’s recommended for mingw-w64
by https://code.visualstudio.com/docs/cpp/config-mingw) and successfully compile Tkhtml
64-bit, rename it, and place it in tkinterweb\tkhtml\Windows\64-bit
, and so far so good!
The generated file is smaller than the default (593 KB
, 650 KB
), not sure why that is, assuming it is just a compiling difference, did you ever got a different size for the same version? / experienced anything like that?
Strangely the file is still a 0 file (libTkhtml3.0
/*.0
) https://github.com/Andereoo/TkinterWeb/issues/86#issuecomment-1793612551, when changed to *.dll
it works fine though, may just be because it’s called libTkhtml3.0
in the last gcc
command, just wondering if that is normal – was yours a 0 file as well?
Also what does the folder tkhtml\src\MODIFIED
do? Its just there and its files were modified later than src
, is it any different?
Yes, the filename is normal. Compiling Tkhtml on Windows has a lot of quirks. As for the generated file size, I never noticed much of a difference, but as long as it works I wouldn't worry. The MODIFIED
folder was just a different version of the code; if I remember correctly it is missing some edits I made to prevent crashes on some websites. It shouldn't be there. I just removed it.
Attempted to follow instructions on https://github.com/Andereoo/TkinterWeb/issues/26 and compile tkhtml on Windows 10 64-bit, using MinGW in Git Bash. Tried:
Got: