From: Jan M. <0x...@gm...> - 2024-09-23 10:04:17
|
Hi list. I'm still not able to produce working Tcl/Tk Windows arm64 dlls on Linux. I'm using the latest llvm cross toolchain (llvm-mingw-20240917-ucrt-ubuntu-20.04-x86_64.tar.xz from https://github.com/mstorsjo/llvm-mingw/releases/tag/20240917). The .configure && make approach mostly works with some minor tweaks. This is the part of a Makefile I'm using in my project and the target I'm trying zo use for producing the Windows/arm64 stuff: 130 lib_winarm64: download 131 if [ "$(GOOS)" != "linux" ]; then exit 1 ; fi 132 if [ "$(GOARCH)" != "amd64" ]; then exit 1 ; fi 133 rm -rf ~/tmp/tcl9* ~/tmp/tk9* $(WINARM64) 134 mkdir -p $(WINARM64) 135 tar xf $(TAR) -C ~/tmp 136 tar xf $(TAR2) -C ~/tmp 137 sh -c "cd ~/tmp/tcl9.0.0/win ; ./configure --build=x86_64-linux-gnu --host=aarch64-w64-mingw32 --enable-64bit=aarch64" 138 sh -c "cd ~/tmp/tcl9.0.0/win ; sed -i 's/-DHAVE_CPUID=1/-UHAVE_CPUID/g' *" 139 make -C ~/tmp/tcl9.0.0/win -j12 140 cp -v ~/tmp/tcl9.0.0/libtommath/win64-arm/libtommath.dll ~/tmp/tcl9.0.0/compat/zlib/win64-arm/zlib1.dll ~/tmp/tcl9.0.0/win/ 141 cp -v ~/tmp/tcl9.0.0/win/*.dll $(WINARM64) 142 sh -c "cd ~/tmp/tk9.0.0/win ; ./configure --build=x86_64-linux-gnu --host=aarch64-w64-mingw32 --with-tcl=$$HOME/tmp/tcl9.0.0/win --enable-64bit=aarch64" 143 make -C ~/tmp/tk9.0.0/win -j12 144 cp -v ~/tmp/tk9.0.0/win/tcl9tk90.dll ~/tmp/tk9.0.0/win/libtk9.0.0.zip $(WINARM64) 145 zip -j $(WINARM64)/lib.zip.tmp $(WINARM64)/*.dll $(WINARM64)/*.zip 146 rm -f $(WINARM64)/*.dll $(WINARM64)/*.zip 147 mv $(WINARM64)/lib.zip.tmp $(WINARM64)/lib.zip 148 On lines 137 and 142 the '--enable-64bit=aarch64' works around producing x86_64 dlls othewrwise. However libtommath.dll and zlib1.dll produced in the win/ directory are still x86_64 dlls. Hence line 140 takes the prebuilt ones instead. Line 138 patches out x86_64 CPUID. Without the patch the build fails: tclWin32Dll.c:472:2: error: unknown register name '%eax' in asm 472 | "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | ^ 1 error generated. make[1]: *** [Makefile:766: tclWin32Dll.o] Error 1 However, the preceding guard at tclWin32Dll:445 should have not been taken, I think: #elif defined(__GNUC__) && defined(HAVE_CPUID) Hence I suspect I have the configuration still wrong even with --host=aarch64-w64-mingw32 as AFAIK, HAVE_CPUID should not be defined when targeting aarch64 CPU. When I try the results that correctly show being for Windows/arm64, Tcl shell fails before prompt with "illegal instruction". The CPU used for testing is Cortex-A72. Please let me know if I can help somehow in solving this issue from the Linux side, thanks. -j |