Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-01-13
10:55 • Closed ticket [b89209f5cd]: compilation error Windows 10 / Visual Studio 2019</i... artifact: c348d76258 user: jan.nijtmans
10:42
Fix [b89209f5cd]: compilation error Windows 10 / Visual Studio 2019 check-in: f398cf47de user: jan.nijtmans tags: core-8-6-branch
10:38
Fix [b89209f5cd]: compilation error Windows 10 / Visual Studio 2019 check-in: 663a232202 user: jan.nijtmans tags: core-8-5-branch
2021-01-05
16:22 • Ticket [b89209f5cd] compilation error Windows 10 / Visual Studio 2019 status... artifact: 8907a738d5 user: ralfixx
13:48 • Ticket [b89209f5cd]: 3 changes artifact: 4ce9823e1a user: ralfixx
2021-01-04
19:22 • Ticket [b89209f5cd]: 3 changes artifact: b6990ccea3 user: jan.nijtmans
18:05 • New ticket [b89209f5cd]. artifact: a720c2ad44 user: ralfixx

compilation error Windows 10 / Visual Studio 2019

Closed / Fixedb89209f5cd549ecda8658c44616d29ba56fa78d7Created 6 years agoUpdated 6 years ago
Descriptionplain2021-01-04 18:05:16
When compiling with Visual Studio 2019 on Windows, using the Msys shell to
run the configure script, I get an error:

    /bin/bash ./configure --enable-threads --disable-symbols --enable-64bit
    ...
    make RC=rc STLIB_LD="link.exe -lib -nologo" SHLIB_LD="link.exe -dll -incremental:no -nologo"
    ...
    cl -nologo [...] tclAppInit.obj tcl86.dll.a tclstub86.lib [...] \
              tclsh.res -Fe"tclsh86.exe" -link [...]
      cl : Befehlszeile warning D9024 : Unbekannter Typ der Quelldatei "tcl86.dll.a", Objektdatei wird angenommen.
      LINK : fatal error LNK1181: Eingabedatei "tcl86.dll.a" kann nicht geöffnet werden.

Reason for the error is the "tcl86.dll.a" argument which is wrong IMHO (it
should be tcl86.lib, see below).

The same process runs fine with 8.6.10:

     /bin/bash ./configure --enable-threads --disable-symbols --enable-64bit
     ...
     make RC=rc STLIB_LD="link.exe -lib -nologo" SHLIB_LD="link.exe -dll -incremental:no -nologo"
     ...
     cl -nologo [...] tclAppInit.obj tcl86.lib tclstub86.lib [...] \
        tclsh.res -Fe"tclsh86.exe" -link [...]

As you can see, here "tcl86.lib" is used.

Reason is to be found in the win/configure script, where the single line
from 8.6.10
    eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\""
was replaced in 8.6.11 by
    if test ${SHARED_BUILD} = 0 ; then
     eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\""
    else
     eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${DLLSUFFIX}.a\""
    fi


But this is plain wrong when using the Visual Studio compiler.

Unfortunately I'm not fluent in configure, so I can't provide a patch
to resolve this.
Referenced by2
jan.nijtmans Ticket [b89209f5cd]: 3 changes [History diff]2021-01-04 19:22:29
ralfixxplain2021-01-05 13:48:05
There is a section in win/configure.in which addresses the same issue for zlib:

    AS_IF([test "$GCC" == "yes"],[
      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/libz.dll.a])
    ], [
      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/zdll.lib])
    ])

IMHO something along these lines should be applied to TCL_LIB_FILE, too.
ralfixxplain2021-01-05 16:22:56
Maybe this patch should do it:

diff -u tcl8.6.11/win/configure.in\~ tcl8.6.11/win/configure.in
--- tcl8.6.11/win/configure.in~	2020-12-11 18:46:23.000000000 +0100
+++ tcl8.6.11/win/configure.in	2021-01-05 17:15:36.311792936 +0100
@@ -311,7 +311,7 @@
 eval "TCL_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TCL_STUB_LIB_FILE}\""
 eval "TCL_STUB_LIB_PATH=\"${libdir}/${TCL_STUB_LIB_FILE}\""
 
-if test ${SHARED_BUILD} = 0 ; then
+if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
  eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\""
 else
  eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${DLLSUFFIX}.a\""

Diff finished.  Tue Jan  5 17:15:43 2021
jan.nijtmanswiki2021-01-13 10:55:25

Fixed now in all active branches. Thanks for the report and patch!

Log in (anonymous is fine) to add a comment.