Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-22
17:19 • Ticket [2f507c8f73] compiling core8-6 branch on windows/msys2 with clang sta... artifact: 029dc563de user: serhiy.storchaka
2026-10-15
11:29 • Closed ticket [2f507c8f73]. artifact: 114ee988dc user: serhiy.storchaka
2020-12-22
07:24 • Pending ticket [2f507c8f73]. artifact: 66a4c4e953 user: jan.nijtmans
07:11 • Ticket [2f507c8f73]: 3 changes artifact: f98c54cc40 user: anonymous
2020-12-10
14:21 • Ticket [2f507c8f73]: 3 changes artifact: 016ead8862 user: jan.nijtmans
2020-11-04
13:01 • Ticket [2f507c8f73]: 3 changes artifact: b8cef38144 user: jan.nijtmans
12:38 • New ticket [2f507c8f73]. artifact: 9312037c1e user: anonymous

compiling core8-6 branch on windows/msys2 with clang

Closed / Works For Me2f507c8f7354e431dc1921478853584223a506ecCreated 6 years agoUpdated 41 days ago
Descriptionplain2020-11-04 12:38:09
Hi,
I'm trying to compile Tcl core8-6 branch using clang.
compilation seems ok but not the linking

C:\msys64\mingw64\bin\ld▒: bn_mp_mul.o:bn_mp_mul.c:(.rdata$.refptr.KARATSUBA_MUL_CUTOFF[.refptr.KARATSUBA_MUL_CUTOFF]+0x0)▒: r▒f▒rence ind▒finie vers ▒▒KARATSUBA_MUL_CUTOFF▒▒
C:\msys64\mingw64\bin\ld▒: bn_mp_mul.o:bn_mp_mul.c:(.rdata$.refptr.TOOM_MUL_CUTOFF[.refptr.TOOM_MUL_CUTOFF]+0x0)▒: r▒f▒rence ind▒finie vers ▒▒TOOM_MUL_CUTOFF▒▒
C:\msys64\mingw64\bin\ld▒: bn_mp_sqr.o:bn_mp_sqr.c:(.rdata$.refptr.KARATSUBA_SQR_CUTOFF[.refptr.KARATSUBA_SQR_CUTOFF]+0x0)▒: r▒f▒rence ind▒finie vers ▒▒KARATSUBA_SQR_CUTOFF▒▒
C:\msys64\mingw64\bin\ld▒: bn_mp_sqr.o:bn_mp_sqr.c:(.rdata$.refptr.TOOM_SQR_CUTOFF[.refptr.TOOM_SQR_CUTOFF]+0x0)▒: r▒f▒rence ind▒finie vers ▒▒TOOM_SQR_CUTOFF▒▒
/mingw64/bin/clang -shared  -o tcldde14.dll -pipe -static-libgcc -municode         -Wl,--out-implib,libtcldde14.dll.a tclWinDde.o libtclstub86.a -lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32 C:/Users/nico/dev/dlight/win64/tcl-165a804445/compat/zlib/win64/libz.dll.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:492 : tcl86.dll] Erreur 1
make: *** Attente des tâches non terminées....
cp tclsh.exe.manifest tcldde14.dll.manifest

best regards,
Nicolas
jan.nijtmans Ticket [2f507c8f73]: 3 changes [History diff]2020-11-04 13:01:15
jan.nijtmanswiki2020-12-10 14:21:48

In Makefile.in:

CC_SWITCHES = $(STUB_CC_SWITCHES) ${NO_DEPRECATED_FLAGS} -DMP_FIXED_CUTOFFS -DMP_NO_STDINT

In tommath_private.h:

#ifdef MP_FIXED_CUTOFFS
#  include "tommath_cutoffs.h"
#  define MP_KARATSUBA_MUL_CUTOFF MP_DEFAULT_KARATSUBA_MUL_CUTOFF
#  define MP_KARATSUBA_SQR_CUTOFF MP_DEFAULT_KARATSUBA_SQR_CUTOFF
#  define MP_TOOM_MUL_CUTOFF      MP_DEFAULT_TOOM_MUL_CUTOFF
#  define MP_TOOM_SQR_CUTOFF      MP_DEFAULT_TOOM_SQR_CUTOFF
#else
#  define MP_KARATSUBA_MUL_CUTOFF KARATSUBA_MUL_CUTOFF
#  define MP_KARATSUBA_SQR_CUTOFF KARATSUBA_SQR_CUTOFF
#  define MP_TOOM_MUL_CUTOFF      TOOM_MUL_CUTOFF
#  define MP_TOOM_SQR_CUTOFF      TOOM_SQR_CUTOFF
#endif

So, if MP_FIXED_CUTOFFS is defined, KARATSUBA_MUL_CUTOFF and friends shouldn't be used. Are you really compiling with -DMP_FIXED_CUTOFFS ???

anonymousplain2020-12-22 07:11:19
Hi Jan,
so I've added -DMP_FIXED_CUTOFFS and compilation is fine.
here's what I'm doing:
export CC=/mingw64/bin/clang.exe
./configure --enable-threads --disable-symbols --enable-64bit --prefix=/opt/local
make -j 4 CFLAGS="-DMP_FIXED_CUTOFFS"

++
Nicolas
jan.nijtmansplain2020-12-22 07:24:16
Well, Makefile.in already contains

      CC_SWITCHES = ... -DMP_FIXED_CUTOFFS ...

So, I simply don't understand why you have to add it to CFLAGS as well....
serhiy.storchakawiki2026-10-15 11:29:06

Closing: no reply since 2020.

serhiy.storchaka Ticket [2f507c8f73]: 3 changes [History diff]2026-10-22 17:19:26
Log in (anonymous is fine) to add a comment.