wenn man unter Linux Windows-Programme erstellen will, muß man die IDE ja entsprechend vorbereiten.
Dazu gibt es dann verschiedene Informationen.
Im Wiki http://wiki.lazarus.freepascal.org/Cros ... nder_Linux heißt es für FPC:
und für Lazarus:Why *nix to Windows and not the other way around
The main reason for this is that generating Linux/Unix binaries on a foreign platform (even another Unix or Linux system) is more complicated. Static linking is already complicated, let alone shared.
You would need the used libraries from the target platform (gtk, glib, libc etc), and a lot of additional configuring for ld (library paths, dynlinker path etc).
This has been partially done (for the static case), but it is hard since it needs manual postediting of linker files and linker commandline, and a deep understanding about what makes Unix binaries tick.
Newer FPCs - 2.1.1 and newer
If you are compiling a 2.1.1 or newer version of FPC you can just do:
$ make all OS_TARGET=win32 CPU_TARGET=i386
and then
$ su -c "make crossinstall OS_TARGET=win32 CPU_TARGET=i386"
Note-icon.png
Note: make crossinstall by default installs all files in /usr/local/lib/fpc/$fpcversion/units directory that's why you will need to add to /etc/fpc.cfg file new search path -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget. Other option is to use INSTALL_PREFIX=/usr while performing crossinstall in this case you will not need to change anything in /etc/fpv.cfg file because all will be instaled in /usr/lib/fpc/$fpcversion/units witch is alredy there
Note-icon.png
Note: To build for win64 the make command is: make all OS_TARGET=win64 CPU_TARGET=x86_64
The reason for this simplicity is the internal linker included in this version of fpc.
In einem Beitrag hier im Forum http://www.lazarusforum.de/viewtopic.php?f=3&t=8990 schrieb "theo"Lazarus/LCL
Cross compiling the LCL and Lazarus components
The IDE automatically cross compiles all used packages when you change the target of your project and build it.
Cross compiling a project
In Project->Compiler Options->Code, set the Target OS to 'win32' and in Paths the 'LCL Widget Type' to win32. That's all. The next time you build, you will create a win32 executable.
The IDE will rescan for win32 units, so that 'Find declaration' and code completion features will now work with the win32 rtl instead of the linux rtl. When you open another project or reopen this project the IDE will automatically switch.
und meint dann weiter auf Lazarus 1.5 bezogen:Ich würde den FPC selber kompilieren, dann die gewünschten crossinstalls dazu.
Bei mir geht das z.B. so, da ich den Compiler (trunk) unter Home habe:
Code: Alles auswählen
make all crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=~/lazarus/fpc
Und zeigt ein Bild der IDE, wo man einfach das Ziel OS auswählen kann.Wenn man alles eingerichtet hat, muss man nur noch auswählen. Bei mir sieht es so aus:
Nur wie man in den IDE-Einstellungen alles konfiguriert, finde ich nichts.
Ich habe jetzt mal auf einem Notebook "Linux Mint17.3" und Lazarus installiert.
Für die Installation von Lazarus nahm ich dieses Script aus dem "Blaise Pascal Magazin 48" (der Author hat der Veröffentlichung zugestimmt):
Code: Alles auswählen
#!/bin/bash
#
# run in your HOME-directory with: sudo sh getlaz.sh (HR)
#
# (C)by: Michael Van Canneyt (michael@freepascal.org)
#
# Release from: 2016-01-30 (HR)
# additional comments from: Heiko Rompel (HR)
########################################################
# Some variables. Set this to whatever you want
########################################################
#
# Where to download/install everything ? (below home directory)
#
INSTALLDIR=fpc
#
# Which FPC version to use ?
#
VERSION=3.0.0
CPUARCH=`uname -p`
#
# Install FPC/Lazarus as root ? (YES or NO)
#
USEROOT=YES
#
# Which lazarus version ?
# set either tag or branch variable.
# If neither is set, trunk is used.
# When lazarus 1.6 is out, this becomes lazarus_1_6
#
# A newer RC is out (HR)
TAG=lazarus_1_6_RC2/
BRANCH=
#########################################################
# No variables after this point.
#########################################################
#
# Install preliminaries. This must be done as root.
#
sudo apt-get install subversion make binutils gdb gcc libgtk2.0-dev
#
# Check if the rest must be done as root.
#
if [ "$USEROOT" = YES ]; then
SUDO=sudo
fi
#
#######################################################################
# Get and install FPC.
#######################################################################
#
# Create installation directory
#
mkdir ~/$INSTALLDIR
cd ~/$INSTALLDIR
#
# Fetch the necessary files for FPC.
#
wget ftp://ftpmaster.freepascal.org/pub/fpc/dist/$VERSION/source/fpc-$VERSION.source.tar.gz
wget ftp://ftpmaster.freepascal.org/pub/fpc/dist/$VERSION/$CPUARCH-linux/fpc-$VERSION.$CPUARCH-linux.tar
#
# extract installer.
#
tar xvf fpc-3.0.0.$CPUARCH-linux.tar
cd fpc-3.0.0.$CPUARCH-linux
#
# Install FPC (possibly as root)
#
$SUDO sh ./install.sh
#
# Extract sources.
#
cd ~
tar xvzf $INSTALLDIR/fpc-$VERSION.source.tar.gz
cd ~/$INSTALLDIR
#
#######################################################################
# Get and install Lazarus
#######################################################################
#
# Determine SVN url
#
BASEURL=http://svn.freepascal.org/svn/lazarus/
#
if [ ! -z "$TAG" ]; then
SVNURL=$BASEURL/tags/$TAG
else
if [ ! -z "$BRANCH" ]; then
SVNURL=$BASEURL/branches/$BRANCH
else
SVNURL=$BASEURL/trunk
fi
fi
#
# Check out sources
#
svn co $SVNURL lazarus
#
# Build the IDE
#
cd lazarus
make bigide
#
# Install lazarus (possibly as root)
#
$SUDO make install
#
# That's all folks !
#
Wenn wir das alles zum laufen haben, dann wäre der nächste Schritt, z.B. eine Verbindung zu einem Windows PC einzurichten um den Code auf einem echten Windows zu debuggen.
Ansschließend könnte man sich dann noch Android und Mac zu wenden.
Was meint Ihr?
Gruß Heiko