Set up for cross-compilation.¹ Mind the path names! WINE
does run 64 bit .exe's so technically you could skip the
i386 target.
cd /usr/share/fpcsrc/3.2.0/ # this will vary!
# i386 (32 bit)
sudo make -j 4 clean all OS_TARGET=win32 CPU_TARGET=i386
sudo make -j 4 crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
sudo ln -sf /usr/lib/fpc/3.2.0/ppcross386 /usr/bin/ppcross386 # this will vary!
# x86_64
sudo make -j 4 clean all OS_TARGET=win64 CPU_TARGET=x86_64
sudo make -j 4 crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=/usr
sudo ln -sf /usr/lib/fpc/3.2.0/ppcrossx64 /usr/bin/ppcrossx64 # this will vary!
¹ If you try to do it later, when you add a
compilation target you'll get spurious error messages like
The system.ppu for this target was not found in the FPC binary directories.
Make sure fpc is installed correctly for this target and the fpc.cfg contains the right directories.
Fatal: Cannot find system used by fcllaz. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/fpc/3.0.4/units/x86_64-linux/rtl/system.ppu.
There is no system.ppu for win32, so it's never going to
be in the wrong place. These messages result from some
obsolete data in the .lazarus folder in your home
directory — data sufficiently obfuscated or obscure you'll
have to delete the whole folder to get rid of it.