Difference between revisions of "Cross compiling/de"

From Lazarus wiki
Jump to navigationJump to search
Line 18: Line 18:
 
* Sie müssen ein unechtes root Verzeichnis anlegen wie: $HOME/darwinroot , zumindest die /System und /Frameworks und /usr Verzeichnisse kopieren (möglicherweise müssen sie noch mehr kopieren) von ihrem Apple oder Darwin Computer zu $HOME/darwinroot
 
* Sie müssen ein unechtes root Verzeichnis anlegen wie: $HOME/darwinroot , zumindest die /System und /Frameworks und /usr Verzeichnisse kopieren (möglicherweise müssen sie noch mehr kopieren) von ihrem Apple oder Darwin Computer zu $HOME/darwinroot
 
* now that you have these files make a folder in $HOME/darwinroot called cross. where ever you installed the odcctools you need to make links for the cross tools to be more fpc friendly. there are a bunch of files from odcc tools called powerpc-apple-darwin-* you need to make links (or rename them) so powerpc-apple-darwin-ld becomes powerpc-darwin-ld, do the same for *-ar and *-as.
 
* now that you have these files make a folder in $HOME/darwinroot called cross. where ever you installed the odcctools you need to make links for the cross tools to be more fpc friendly. there are a bunch of files from odcc tools called powerpc-apple-darwin-* you need to make links (or rename them) so powerpc-apple-darwin-ld becomes powerpc-darwin-ld, do the same for *-ar and *-as.
* Jetzt sind sie bereit to crosscompile fpc. basically you need to have the fpc source and have a terminal open there.
+
* Jetzt sind sie bereit to crosscompile fpc. Im Wesentlichen müssen sie die FPC Quelle haben und ein geöffnetes Terminal dort.
type:  
+
tippen sie:  
 
  $PATH=$PATH:$HOME/darwinroot/cross (oder wo auch immer you made the symlinks)
 
  $PATH=$PATH:$HOME/darwinroot/cross (oder wo auch immer you made the symlinks)
type (iirc):
+
tippen sie (iirc):
 
  make all TARGET_OS=darwin TARGET_CPU=powerpc OPT="-Xd -Fl/$HOME/darwinroot/usr/lib"
 
  make all TARGET_OS=darwin TARGET_CPU=powerpc OPT="-Xd -Fl/$HOME/darwinroot/usr/lib"
 
wenn das gelungen ist, können sie es installieren wo auch immer sie wollen mit:  
 
wenn das gelungen ist, können sie es installieren wo auch immer sie wollen mit:  

Revision as of 21:57, 23 February 2006

Deutsch (de) English (en) español (es) français (fr) magyar (hu) português (pt) русский (ru) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

Vorwort

Dies ist eine kurze Einführung für Neulinge. Die folgenden Abschnitte beschreiben, wie man ein System für cross compile einrichtet, das bedeutet, arbeiten unter Linux und erzeugen von von Win32 executables (oder freebsd oder darwin, oder ...). FreePascal ist ein Compiler und konvertiert hauptsächlich Quellcode in binaries (Maschinensprache). Diese binaries enthalten auch Informationen darüber, wie das Betriebssystem das executable startet. Daher sind diese binaries Plattform-spezifisch. FreePascal selbst benötigt nicht viel Installation. Es kann binaries für viele Plattformen erzeugen. Just tell it to do so. Aber der Compiler ist nur ein Teil. Es gibt auch noch den Assembler und den Linker. Und diese Werkzeuge sind nicht in der Lage, cross code zu erzeugen. Daher müssen wir spezielle Linker 'ld' und Assembler 'as' für jede Zielplattform erzeugen. Dies sind die binutils. Nach Erstellung der cross tools, werden alle FPC Pascal Units cross compiled. Zum Beispiel, dann gibt es eine system.ppu Datei für jede Zielplattform. TDann wird ihre FPC Konfigurationsdatei eingerichtet, so daß cross compilation so einfach wird, daß sie alle langweiligen Details vergessen können. Das selbe wird für die LCL getan - die lazarus component library. Und danach können sie cross compile Pascal Programme für Win32. Entweder starten sie sie mit Wine oder sie kopieren sie auf eine Windows maschine und testen sie dort.

Grundsätzliche Schritte

Es gibt einige übliche Schritte, die beteiligt sind in crosscompiling, die sie in jedem Fall tun müssen:

  1. Bereits einen FreePascal Compiler haben für die Plattform, von der sie kompilieren wollen.
  2. Sie müssen den FreePascal Quellcode haben.
  3. You need to either build from source or obtain binaries of the cross-binutils that run on the platform you are on and are designed to build programs for your desired target platform.
  4. Manchmal werden sie einige Dateien benötigen von der Zielplattform, zu der sie kompilieren.

Von Linux

Zu Windows

Cross_compiling_for_Win32_under_Linux

Zu Darwin oder Apple

  • Zuerst benötigen sie die binutils für die Plattform, für die sie kompilieren wollen. Downloaden sie odcctools von dieser Seite (benutzen sie die CVS Version) und folgen ihren Instruktionen für die Installierung. http://www.opendarwin.org/projects/odcctools/
  • Sie müssen ein unechtes root Verzeichnis anlegen wie: $HOME/darwinroot , zumindest die /System und /Frameworks und /usr Verzeichnisse kopieren (möglicherweise müssen sie noch mehr kopieren) von ihrem Apple oder Darwin Computer zu $HOME/darwinroot
  • now that you have these files make a folder in $HOME/darwinroot called cross. where ever you installed the odcctools you need to make links for the cross tools to be more fpc friendly. there are a bunch of files from odcc tools called powerpc-apple-darwin-* you need to make links (or rename them) so powerpc-apple-darwin-ld becomes powerpc-darwin-ld, do the same for *-ar and *-as.
  • Jetzt sind sie bereit to crosscompile fpc. Im Wesentlichen müssen sie die FPC Quelle haben und ein geöffnetes Terminal dort.

tippen sie:

$PATH=$PATH:$HOME/darwinroot/cross (oder wo auch immer you made the symlinks)

tippen sie (iirc):

make all TARGET_OS=darwin TARGET_CPU=powerpc OPT="-Xd -Fl/$HOME/darwinroot/usr/lib"

wenn das gelungen ist, können sie es installieren wo auch immer sie wollen mit:

make install TARGET_OS=darwin TARGET_CPU=powerpc PREFIX=/cross/fpc

Jetzt kopieren sie die Datei ./compiler/ppccross irgendwohin, wo sie sie finden können as it's the compiler you'll need to build powerpc programs

  • Konfigurieren sie ihre /etc/fpc.cfg Datei,

und fügen einen Abschnitt wie diesen hinzu:

#IFDEF powerpc
-Fu/cross/fpc/lib/fpc/$fpcversion/units/$fpctarget/
-Fu/cross/fpc/lib/fpc/$fpcversion/units/$fpctarget/rtl
-Fu/cross/fpc/lib/fpc/$fpcversion/units/$fpctarget/*
-k-systemroot $HOME/darwin/cross
#ENDIF

whenever you want to crosscompile you have to have ppccross and the symlinks to powerpc-darwin-* in the PATH and you should be able to just do ppccross someprogie.pas and it will create a darwin executable.

I may have mistated some things (or most everything) as it's been a while since I did this.

Von Windows

Zu Linux

Marco vd Voort schrieb einige crossnotes. Wenn jemand Zeit hat, dann kann er sie diesem Wiki hinzufügen.

Cross compile FAQ

Warum cross compile?

Damit können sie ein Programm entwickeln für ein Betriebssystem/CPU und es kompilieren für ein anderes Betriebssystem/CPU ohne Neustart oder Wechsel des Computers.

Warum Linux zu Windows und nicht in der anderen Richtung?

Der Hauptgrund dafür ist, daß die Erzeugung von Unix binaries auf einer fremden Plattform (ein anderes Unix oder sogar Linux eingeschlossen) komplizierter ist. Statisches linking ist bereits kompliziert, let alone shared.

Sie würden die verwendeten Bibliotheken der Zielplattformen benötigen (gtk, glib,libc etc), und eine Menge zusätzlicher Konfigurierung für 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.

Ich möchte mehr Informationen über die Erstellung von Freepascal. Wo sind sie?

Eine allgemeine FAQ im PDF-Format über die Erstellung und Konfigurierung von FPC ist: http://www.stack.nl/~marcov/buildfaq.pdf.