Reputation: 36644
I have seen that it is possible but not easy to configure cross-compiling with Free Pascal, as there have to be libraries of the target OS on the system.
But I only need a quick syntax-check to verify that the project can be compiled, linking an executable is not required.
So: are there compiler options which I can use to do a cross-platform test compile (only) with Free Pascal?
In my case, before checking in the project in source control, I would like to verify on a Windows workstation if the compiler can compile for a Linux or OSX target.
Upvotes: 2
Views: 520
Reputation: 26356
(Note that the origin of the problem is not FPC , but Apple no longer releasing source for its binutils, contrary to early (ppc) OS X times when a version of cctools was available)
Yes, that is possible. Basically one then (cross)compiles to assembler, and tries to assemble and link on target.
Commandline parameters to look at are
The linker commandline will be written to a ppas.bat/sh file.
The transfer all generated .s assembler files and the link.res linker script and ppas.sh to the destination system, and run ppas.sh
In theory that should then assembler and compile, but in practice you might need to adapt link.res and ppas.sh to add proper search paths. Many of the early ports to new targets were done this way (since the initial port was done before adding a proper target in the compiler)
Upvotes: 1
Reputation: 4909
AFAIK, compiling and linking the application with a cross-compiler is the only way to truly check your project. This is how the major IDE are working today (background compilation).
You simply need to install on your host machine the cross-compiler for the CPU/OS target you need.
http://wiki.freepascal.org/Cross_compiling#Host_and_target_on_different_CPUs
Upvotes: 1