Changeset 40252 in project

07/03/21 15:37:56 (4 weeks ago)

Add some Linux-to-Windows specific notes.

1 edited


  • wiki/man/5/Cross development

    r39507 r40252  
    4949* {{PLATFORM}} determines the target platform. It must be one of the officially
    50 supported platforms CHICKEN runs on.
     50supported platforms CHICKEN runs on. Note that it actually refer to the extension of a dedicated Makefile (`Makefile.linux` in our case).
    5252* {{HOSTSYSTEM}} is an identifier for the target system and will be used as
    134134or {{$HOME}}) - some files will conflict with a normal CHICKEN installation.
    136 * {{TARGETSYSTEM}} gives the name-prefix of the cross C compiler.
     136* {{TARGETSYSTEM}} gives the name-prefix of the cross C compiler and other tools (C++ compiler, librarian (ar) and ressource compiler (for windows)).
    138138* {{PROGRAM_PREFIX}} determines the name-prefix of the CHICKEN tools to be created.
    190190Looks good.
     192==== Special notes for Linux to Windows cross development
     194To cross compile from Linux to Windows, you will need to use a Linux build of MingGW-w64 with you can find in most distribution.
     196As far as the runtime is concerned, the procedure is the same that what have been shown before, using the platform name {{cross-linux-mingw}}.
     198The procedure to compile the compiler however require some more care:
     199* The platform name is {{linux}} because it is where you want your compiler to run
     200* You have to set the {{TARGET_LIBRARIES}} as this is different between Linux and Windows:
     201  For Linux target, this variable contains {{-ldl -lm}}, while for Windows target it should be {{-lm -lws2_32}}.
     202* You have to make sure you are pointing to the right toolchain (see next paragraph).
     204In order to compile the C sources that Chicken will produce you have to make sure that you provide the right toolchain in both runtime and compiler steps.
     206In most cases, you want to do that by setting {{HOSTSYSTEM}} when building the runtime and {{TARGETSYSTEM}} when building the compiler to something similar to {{x86_64-w64-mingw32}} (check you distribution binaries).
     208If your distribution does not stick to the {{PREFIX-TOOLNAME}} convention you may want to set some following variables (runtime step/compiler step):
     211* {{LIBRARIAN}}/{{TARGET_LIBRARIAN}} for {{ar}}
     212* {{RC_COMPILER}}/{{TARGET_RC_COMPILER}} for {{windres}}
     214You may need this trick to pick {{x86_64-w64-mingw32-gcc-posix}} over {{x86_64-w64-mingw32-gcc-win32}} in Debian for example (those correspond to different thread APIs).
    192216=== Using it
Note: See TracChangeset for help on using the changeset viewer.