Skip to content
Tcl Source Code View Ticket
Login

View Ticket

win/makefile: wrong recipe to buid libtcl.a and missing dependencies

Closed / Fixedbc693446a90017832580f0fe6dc289fc70c346c8Created 2 years agoUpdated 2 years ago
Descriptionwiki2024-10-22 21:29:52
The recipe for ${TCL_LIB_FILE} seems to be incorrect: normally it'd be built from ${TCL_DLL_FILE}, but if something has dependency to libtcl.a only, or it get removed for some reason (but tcl.dll not), or it will be built earlier, for instance if one uses parallelized make (-jN), the libtcl.a is built incorrect, the following compilation steps may fail with:
  gcc -O2 ... tclAppInit.o libtcl86.dll.a libtclstub86.a ... \
    tclsh.res.o -o tclsh86.exe -mconsole -pipe -static-libgcc -municode -Wl,--enable-auto-image-base
  ld: tclAppInit.o:tclAppInit.c:(.text+0xc): undefined reference to `__imp_Tcl_Init'
  ld: tclAppInit.o:tclAppInit.c:(.text+0x18): undefined reference to `__imp_Tcl_NewStringObj'
  ld: tclAppInit.o:tclAppInit.c:(.text+0x51): undefined reference to `__imp_Tcl_ObjSetVar2'
  ld: tclAppInit.o:tclAppInit.c:(.text+0xc0): undefined reference to `__imp_Tcl_CreateInterp'
  ld: tclAppInit.o:tclAppInit.c:(.text+0xd5): undefined reference to `__imp_Tcl_MainExW'
  collect2.exe: error: ld returned 1 exit status
  Makefile:473: recipe for target `tclsh86.exe' failed
  make: *** [tclsh86.exe] Error 1

Also it seem to be missing dependency for some targets, like tclsh and tcltest... for proof:

  $ rm *.exe *.a; make -j4 tcltest
  ...
  gcc -O2 ... tclAppInit.o libtcl86.dll.a libtclstub86.a ... \
    tclsh.res.o -o tclsh86.exe -mconsole -pipe -static-libgcc -municode -Wl,--enable-auto-image-base
  cp tclsh.exe.manifest tclreg13.dll.manifest
  ld: cannot find libtcl86.dll.a: No such file or directory
  collect2.exe: error: ld returned 1 exit status
  Makefile:473: recipe for target `tclsh86.exe' failed
  make: *** [tclsh86.exe] Error 1
  make: *** Waiting for unfinished jobs....
  gcc -O2 ... tclTest.o  tclTestObj.o  tclTestProcBodyObj.o  tclThreadTest.o  tclWinTest.o tclTestMain.o libtcl86.dll.a libtclstub86.a ... \
    tclsh.res.o -o tcltest.exe -mconsole -pipe -static-libgcc -municode -Wl,--enable-auto-image-base
  ld: cannot find libtcl86.dll.a: No such file or directory
  collect2.exe: error: ld returned 1 exit status
  Makefile:517: recipe for target `tcltest.exe' failed
  make: *** [tcltest.exe] Error 1
sebreswiki2024-10-22 22:07:01

Fixed in [f70f06573b2fb304], I'll merge it tomorrow to 8.7+ if tests in GHA will pass.

jan.nijtmanswiki2024-10-23 10:15:18

The build failed: https://github.com/tcltk/tcl/actions/runs/11475003899

So, re-opening.

@sebres, can you have a look?

sebreswiki2024-10-23 10:42:48

Already... fixed in [e2ad8bcdfd].

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