Cross-compiling 64bit library sha256 for Windows 7 64bit with critcl

86 views
Skip to first unread message

Zbigniew Diaczyszyn

unread,
Jul 1, 2011, 9:46:56 AM7/1/11
to sta...@googlegroups.com
I hit a snag when trying to compile on a Linux (32bit) host a Windows
64bit library version of sha256 from tcllib with critcl:

I have downloaded from the ming64 download site the version for a Linux
host, set the PATH for critcl:

export PATH=/home/dia/mingw64/x86_64-w64-mingw32/bin/:$PATH

and started compiling:

$ tclkit critcl.kit -lib sha256c.tcl
Cross compiling for Windows using Xmingwin
Source: sha256c.tcl

Fri Jul 01 09:51:42 +0200 2011 - /home/dia/Projekte/gorilla/sha256c.tcl
gcc -r -nostdlib -DUSE_TCL_STUBS -I/home/dia/.critcl/Windows-x86
-DTCL_BYTE_ORDER=1234 -o
/home/dia/.critcl/Windows-x86/v035_7bf64913e94cd555e881b5a952aaab81_pic.o /home/dia/.critcl/Windows-x86/v035_7bf64913e94cd555e881b5a952aaab81.c
/home/dia/Projekte/gorilla/sha256.c

In file included from
/home/dia/.critcl/Windows-x86/v035_7bf64913e94cd555e881b5a952aaab81.c:5:0:
/home/dia/.critcl/Windows-x86/tcl.h:162:22: fatal error: stdio.h: Datei
oder Verzeichnis nicht gefunden
compilation terminated.
/home/dia/Projekte/gorilla/sha256.c:52:20: fatal error: string.h: Datei
oder Verzeichnis nicht gefunden
compilation terminated.
ERROR while compiling code in /home/dia/Projekte/gorilla/sha256c.tcl:

Error: Did not find: stdio.h and string.h

When doing the job for a 32bit Win library with the 32bit development
environment of xmingw there is no problem at all.

So I don't understand what causes the problems. My stdio.h and string.h
are in the default Linux path /usr/include ... A workaround would be to
create some symlinks but I would like to know why critcl doesn't find
the system libraries. Do I have to set some GCC environment variables or
TCL variables?

Has anyone tried to compile a 64bit library for Win64?

By the way:

As for Linux my application is downloaded 100 times for 64bit and for
32bit 114 times. I suppose for Windows it is the same meanwhile.

Zbigniew Diaczyszyn

unread,
Jul 2, 2011, 2:10:08 AM7/2/11
to sta...@googlegroups.com
Richard Ellis offered a workaround:

* Get the latest file from:

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-linux_20110627.tar.bz2/download

* Unpack it to <my-mingw64-path>

* remove machine and cpu description from the binaries' name:

cd <my-mingw64-path>/mingw/bin
for name in * ; do mv -v $name ${name:19} ; done

* Add to PATH: export PATH=<my-mingw64-path>/mingw/bin:$PATH

* Run: tclkit critcl.kit -pkg sha256c.tcl

Cross compiling for Windows using Xmingwin
Source: sha256c.tcl

Library: sha256c.dll
Package: /home/dia/Projekte/gorilla/lib/sha256c

As I have seen there is a version 2 for critcl.kit at http://www.digitalsmarties.com/pub/
dated 01-Apr-2010. It is offering a configuration file for comfortable setting of Cflags and Ldflags.
So the best will be to set there a working win64 configuration including the "-m64" option.


Reply all
Reply to author
Forward
0 new messages