Experiences with cross-compiling Tcl packages ...
sbasi 2016-05-29: I successfully cross-compiled a Tcl extension from Linux for Windows. I did it with cmake[L1 ] and MinGW-w64[L2 ]. The only problem was that cmake did not find the Tcl header files and libraries. Apart from that, it was actually surprisingly simple.
A little more detail:
# # Toolchain file to cross-compile for windows # # the name of the target operating system SET(CMAKE_SYSTEM_NAME Windows) # which compilers to use for C and C++ SET(CMAKE_C_COMPILER i686-w64-mingw32-cc) SET(CMAKE_CXX_COMPILER i686-w64-mingw32-c++) # here is the target environment located SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # settings for Tcl/tk # we need to set these variables manually, because cmake does not find them set (TCL_INCLUDE_PATH /home/foo/crosscompile/include/) set (TCL_STUB_LIBRARY /home/foo/crosscompile/lib/libtclstub86.a) set (TK_INCLUDE_PATH /home/foo/crosscompile/include/) set (TK_STUB_LIBRARY /home/foo/crosscompile/lib/libtkstub86.a)
$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/foo/crosscompile/toolchain.cmake ${path_to_source_dir} $ make
To be noted that the only dependencies of the extension in question were the standard C library and Tcl/Tk. With more deps, things might get a little harder.