Tk Source Code

View Ticket
Login
Ticket UUID: 939496ee1bef2820c50d89809b56565414c44a60
Title: Static wish (Windows/gcc) not working
Type: Bug Version: 9.0.b3
Submitter: obermeier Created on: 2024-08-16 20:27:49
Subsystem: 85. Win Build Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2024-08-28 20:35:21
Resolution: Works For Me Closed By: obermeier
    Closed on: 2024-08-28 20:35:21
Description:
A static wish built on Windows with gcc does not work.
When starting, I get the following error message:
    Can't find a usable tk.tcl in the following directories:
    ...

Looking at the build log, I see the following error messages regarding
creating the libtk9.0b3.zip file:

creating libtk.vfs/tk_library (prepare compression)
	zip warning: expected 874 entries but found 0
zip error: Zip file structure invalid (../libtk9.0b3.zip)
(zip=`(realpath '/C/BawtBuilds/TclMinimal/TclMinimal-9.0.b3-9.0.b3/Windows/x64/Development/opt/7-Zip/zip' || readlink -m '/C/BawtBuilds/TclMinimal/TclMinimal-9.0.b3-9.0.b3/Windows/x64/Development/opt/7-Zip/zip') 2>/dev/null || \
  (echo '/C/BawtBuilds/TclMinimal/TclMinimal-9.0.b3-9.0.b3/Windows/x64/Development/opt/7-Zip/zip' | sed "s?^\./?$(pwd)/?")`; \
  cd libtk.vfs && \
  $zip -rq ../libtk9.0b3.zip * >/dev/null && \
  echo "libtk9.0b3.zip successful created with $zip" && \
  cd ..)
gcc -O2 -fomit-frame-pointer -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0 winMain.o libtcl9tk90.a \
libtkstub.a "C:/BawtBuilds/TclMinimal/TclMinimal-9.0.b3-9.0.b3/Windows/x64/Release/Build/Tcl/libtcl90.a" "C:/BawtBuilds/TclMinimal/TclMinimal-9.0.b3-9.0.b3/Windows/x64/Release/Build/Tcl/libtclstub.a" -lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32 -lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool \
wish.res.o -o wish90s.exe -mwindows -pipe -static-libgcc -municode -Wl,--enable-auto-image-base
	zip warning: central dir not where expected - could not adjust offsets
	zip warning: (try -FF)

zip error: Zip file structure invalid (wish90s.exe)
ignore zip-error by adjust sfx process (not executable?)


Inspection of the libtk9.0b3.zip file shows that it only contains directory tcl_library.

If building with nmake the static wish works. libtk9.0b3.zip contains directory tk_library.

Note, that on Linux file libtk9.0b3.zip contains both tcl_library and tk_library.
User Comments: obermeier added on 2024-08-28 20:35:21:
The remark with the zip program was good.

I used a self-compiled version of Info-ZIP, which shows the following compile options:

Compiled with mingw32 / gcc 7.2.0 for
Windows 9x / Windows NT (32-bit) on Jun 19 2021.

Zip special compilation options:
        ASM_CRC
        ASMV
        USE_EF_UT_TIME       (store Universal Time)
        NTSD_EAS             (store NT Security Descriptor)
        WIN32_OEM            (store file paths on Windows as OEM)
        LARGE_FILE_SUPPORT   (can read and write large files on file system)
        ZIP64_SUPPORT        (use Zip64 to store large files in archives)
        UNICODE_SUPPORT      (store and read UTF-8 Unicode paths)
        [encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3)

When using the zip program supplied by MSys building a static wish works. 
The MSys zip shows the following compile options:

Compiled with gcc 13.2.0 for Unix (Cygwin) on Dec 13 2023.

Zip special compilation options:
        USE_EF_UT_TIME       (store Universal Time)
        SYMLINK_SUPPORT      (symbolic links supported)
        LARGE_FILE_SUPPORT   (can read and write large files on file system)
        ZIP64_SUPPORT        (use Zip64 to store large files in archives)
        UNICODE_SUPPORT      (store and read UTF-8 Unicode paths)
        STORE_UNIX_UIDs_GIDs (store UID/GID sizes/values using new extra field)
        UIDGID_NOT_16BIT     (old Unix 16-bit UID/GID extra field not used)
        [encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3)

I did not investigate, which of the options is relevant for the zip errors.

BTW: I noticed, that the VS build does not use an external zip program, but builds the zip file using tclsh and zipfs. 
Wouldn't it be a good idea to use that way for Unix and Windows-gcc, so that no external zip program is needed for building?

jan.nijtmans added on 2024-08-27 14:59:56:

> One thing I know is not right: the registry and dde dll's are both statically linked and also included in the zip-file.

After fixing that, I tried to create a static wish built on Windows with gcc. It works fine.

Could the problem be in the "zip" utility provided by 7-Zip?


jan.nijtmans added on 2024-08-23 15:06:07:

At least on Github, the static build on Windows with gcc runs fine:

https://github.com/tcltk/tk/actions/runs/10521300222/job/29151723347

That doesn't tell the whole story. I'll investivate further.

One thing I know is not right: the registry and dde dll's are both statically linked and also included in the zip-file.