![]() ![]() Wine for Win32 binaries under Linux, etc.). The resulting binaries may then be copied to a machine running the target platform, or run under an emulator (e.g. And after this you can cross compile Pascal programs for the (different) target platform. The same will be done for the LCL - the Lazarus Component Library (if using Lazarus). Then your FPC config file will be setup, so that cross compilation becomes so easy, that you can forget all the boring details. For example, on a Linux host setup to cross compile to Windows and Raspberry Pi, the /usr/lib/fpc/3.2.2/units directory may contain the following directories-Įach of those directories will contain a directory for each of the FPC units, each one with. Its worth noting that you don't necessarily need a new cross compiler for every CPU-OS combination, but you do need the FPC Units. ![]() These units may be either compiled using your compiler set up for compilation to the target platform, or you may potentially use officially distributed units compiled (and distributed) with exactly the same FPC version (if available in format usable under the particular host platform). For example, every target platform needs a different file system.ppu (System unit), etc. These are the binutils.Īfter creating (or having/installing) the cross tools, one needs FPC RTL and other units compiled for the chosen target platform. That's why we have to use different special linker 'ld' and assembler 'as' for every target platform. Usually these tools are not able to create binaries for different platforms. FPC provides an internal assembler and/or linker for some platforms, but other platforms need external tools. We also need the assembler and the linker. See the Supported target operating systems article for the full list. FPC binary can then select the right compiler (either the native compiler or the cross-compiler) for the target CPU selected using the -P parameter. Such a cross-compiler may be either compiled by yourself, or you can use a ready made distributed cross-compiler provided for some platforms directly by the FPC team (usually platforms mostly used in portable devices like arm-linux or arm-wince, because these are usually not used as host platforms). ![]() This cross-compiler is then usually stored in the same directory as the native compiler. compiler running on the host platform, but able to create machine code for a different CPU (in the case of FPC, such a cross-compiler would be again able to target all supported platforms available on the _target_ CPU). If you need to create binaries for a different CPU, you need a special cross-compiler, i.e. This means that you can perform cross-compilation with the same compiler used for native compilation as long as you stick to the same CPU. Just tell it to do so.įPC is designed so that the distributed compiler can create machine code for a certain CPU (because different CPUs need different machine code) and it knows specific requirements for all supported platforms (operating systems) available on that particular CPU. It can create binaries for many platforms. Free Pascal itself does not need much setup. Therefore these binaries are platform specific. Moreover, the binaries refer to the APIs provided by the particular operating system, that's why a different implementation of our Run-Time Library is necessary for different operating systems. These binaries also contain information on how the operating system starts the executables. In this case, the platform used for compilation is usually referred to as "host" (Linux in the example above) and the platform where you want to run your created binaries is your "target".įree Pascal is a compiler and basically converts source into binaries (machine language). working under Linux and creating Win32 executables (or those for FreeBSD or Darwin, etc.). The following sections describe how to setup a system to cross compile, that means creating binaries (executables) for a platform different from the one used for compilation - e.g. This is a short introduction for users new to cross compiling. Note: Before going any further, consider Why not to cross compile? below 10.5 Errors like compiler "/usr/bin/fpc" does not support target arm-linux.10.4 I want more information on building Free Pascal.10.3 Why cross compile from Unix to Windows and not the other way around?.8.2 Cross compiling the LCL in Lazarus 0.9.30 and below.3.7 Lazarus guide to cross-compile Win 32/64-bit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |