Difference between revisions of "fpcup"
(crossopt support added; useful to choose e.g. ARM instruction set or soft-float/hard-float) |
m (some links) |
||
Line 39: | Line 39: | ||
== Documentation == | == Documentation == | ||
− | fpcup has a -h option, a readme.txt and fpcup.html with development notes (see the source code repository for the latest readme.txt and fpcup.html). | + | fpcup has a -h option, a [https://bitbucket.org/reiniero/fpcup/overview readme.txt] and [https://bitbucket.org/reiniero/fpcup/downloads/fpcup.html fpcup.html] with development notes (see the [https://bitbucket.org/reiniero/fpcup/src source code repository] for the latest readme.txt and fpcup.html). |
To make it easier to get user contributions for documentation/tips, this wiki page has been created. Please feel free to add your own examples etc. | To make it easier to get user contributions for documentation/tips, this wiki page has been created. Please feel free to add your own examples etc. |
Revision as of 12:43, 6 January 2014
About
fpcup is a tool that automates running a subversion client to build FPC and/or Lazarus in a self-contained directory structure. Think of it as a batch file on steriods that does the boring svn work for you.
On Windows, it can also serve as a "bare metal" installer: it can download a subversion client, binutils (make.exe etc).
fpcup allows maintaining multiple different FPC/Lazarus combinations.
It is a third party tool, not part of FPC or Lazarus.
Ready to run
fpcup is ready to run out of the box. It will download and install FPC and Lazarus. On Windows, this directory layout is used:
C:\development\config_lazarus # Default primary-config-path directory
# (contains Lazarus settings)
C:\development\cross # Place to store cross compiling binutils and libs if wanted
C:\development\extras # Third party modules (see fpcup.ini) such as fpcdocs
C:\development\fpcbootstrap # Binutils (make.exe etc) and bootstrap compiler
C:\development\fpc # FPC fixes 2.6 by default
C:\development\lazarus # Lazarus trunk by default
On Linux/OSX/BSD, a similar layout is used under ~
fpcup will create a shortcut to the installed Lazarus on your desktop.
Just run fpcup, e.g. on Windows:
fpcup
On *nix:
#replace fpcup_linux_x86 with your actual fpcup filename of course if not on linux x86
chmod u+rx fpcup_linux_x86 #make executable (one time only action)
./fpcup_linux_x86 #run
Next time, you can either run the exact same command, or run the fpcup_update desktop shortcut or home directory shell script/batch file.
Documentation
fpcup has a -h option, a readme.txt and fpcup.html with development notes (see the source code repository for the latest readme.txt and fpcup.html).
To make it easier to get user contributions for documentation/tips, this wiki page has been created. Please feel free to add your own examples etc.
Cross compilers
When you want to run a cross compiler, you need to have the relevant binutils that are specific for the host<>target system.
Often, you will also need libraries in target system format if you want to compile programs (e.g. Linux Qt or Gtk libraries for the relevant CPU if you're crosscompiling for Linux).
When you run a crosscompiler, fpcup briefly checks if it can find required binutils and libraries and will warn you if they can't be found.
Status
- Built in means no additional files are needed
- Needs binutils/libs: means that you need to supply those (see above)
- N/A: means non-applicable/impossible
- No: means no plans to implement this. However, contributions are welcome, as always
From\To | DOS | GO32v2 | Windows x86 | Windows x64 | Linux x64 | Linux x86 | Linux mipsel | Android ARM | FreeBSD x64 | FreeBSD x86 | OSX |
Any | needs binutils,libs | needs binutils,libs | |||||||||
Windows x86 | needs FPC trunk, binutils | yes, built in | N/A | yes | needs binutils,libs | needs binutils,libs | see Any | ||||
Windows x64 | no | needs binutils | yes | N/A | needs binutils,libs | needs binutils,libs | see Any | ||||
Linux x64 | no | yes, built in | N/A | see Any | no plans | no plans | |||||
Linux x86 | yes, built in | N/A | see Any | no plans | no plans | ||||||
Linux mipsel | N/A | ||||||||||
Android ARM | see Any | N/A | |||||||||
FreeBSD x64 | no | no plans | yes, built in | see Any | N/A | ||||||
FreeBSD x86 | no plans | yes, built in | see Any | N/A | |||||||
OSX | verify | see Any | N/A |
(With thanks to FPSpreadsheet's spreadsheet to wikitable conversion tool, see e.g. examples\fpsgrid)
Android ARM crosscompiler
Once you have set up a regular FPC trunk/2.7.1 compiler, you can add an Android cross compiler.
Limitations:
- only tested on FPC trunk
- only builds FPC cross compiler, Android does not have "regular" LCL support so not enabled
- patches for getting customdrawn support going are welcome
Required files
Download the Android NDK (e.g. a file like android-sdk_r22.3-windows.zip) for your platform and extract the crossbinutils, e.g. from a path like
android-ndk-r9c\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\bin
The result is something like these files (adjust for your platform etc):
arm-linux-androideabi-addr2line.exe
arm-linux-androideabi-ar.exe
arm-linux-androideabi-as.exe
arm-linux-androideabi-c++.exe
arm-linux-androideabi-c++filt.exe
arm-linux-androideabi-cpp.exe
arm-linux-androideabi-elfedit.exe
arm-linux-androideabi-g++.exe
arm-linux-androideabi-gcc-4.8.exe
arm-linux-androideabi-gcc-ar.exe
arm-linux-androideabi-gcc-nm.exe
arm-linux-androideabi-gcc-ranlib.exe
arm-linux-androideabi-gcc.exe
arm-linux-androideabi-gcov.exe
arm-linux-androideabi-gdb-orig.exe
arm-linux-androideabi-gdb.exe
arm-linux-androideabi-gprof.exe
arm-linux-androideabi-ld.bfd.exe
arm-linux-androideabi-ld.exe
arm-linux-androideabi-ld.gold.exe
arm-linux-androideabi-ld.mcld.exe
arm-linux-androideabi-nm.exe
arm-linux-androideabi-objcopy.exe
arm-linux-androideabi-objdump.exe
arm-linux-androideabi-ranlib.exe
arm-linux-androideabi-readelf.exe
arm-linux-androideabi-size.exe
arm-linux-androideabi-strings.exe
arm-linux-androideabi-strip.exe
Put these files in your cross binutils directory for the right platform - e.g. on a standard Windows fpcup install:
C:\development\cross\bin\arm-android
Libs: extract the libs from a path like
android-ndk-r9c\platforms\android-19\arch-arm\usr\lib
into
C:\development\cross\lib\arm-android
The libs in question can be like this list:
crtbegin_dynamic.o
crtbegin_so.o
crtbegin_static.o
crtend_android.o
crtend_so.o
libandroid.so
libc.a
libc.so
libdl.so
libEGL.so
libGLESv1_CM.so
libGLESv2.so
libGLESv3.so
libjnigraphics.so
liblog.so
libm.a
libm.so
libm_hard.a
libOpenMAXAL.so
libOpenSLES.so
libstdc++.a
libstdc++.so
libthread_db.so
libz.so
rs
Settings
Open your settings file or add a new file, settings.ini:
[android]
; Android ARM cross compiler
; a full fpcup run must have been done before
; please adjust paths etc
fpcdir=c:\development\fpctrunk
fpcurl=http://svn.freepascal.org/svn/fpc/trunk
fpcopt=""
fpcuplinkname=""
lazlinkname=""
binutilsdir=c:\development\fpcbootstrap
fpcbootstrapdir=c:\development\fpcbootstrap
cputarget=arm
ostarget=android
; You can specify exact instruction set and floating point support etc:
crossopt="-CpARMV7 -CfVFPV3"
; ... or something more conservative/compatible:
;crossopt="-CpARMV6"
verbose=0
; We only need an FPC here; assume FPC has been updated by regular update
only=FPCBuildOnly
; No LCL support on Android yet
Creating and using the cross compiler
Then generate the cross compiler with
fpcup --inifile=settings.ini --inisection=android
Now you can run a test compile, compiling a file test.pas with
fpc -Parm -Tandroid test.pas
(your fpc.cfg will have been modified to add some settings when cross-compiling to Android ARM)
DOS crosscompiler
Using 32 bit fpcup.exe on Windows, once you have set up a regular FPC trunk/2.7.1 compiler, you can add a DOS cross compiler.
Required files
Download the required binaries as mentioned in DOS, currently:
msdos-nasm.exe
msdos-wlib.exe
msdos-wlink.exe
nasm.exe
wlibd.dll
wlinkd.dll
wlsystem.lnk
and put them in your cross binutils directory for the right platform - e.g. on a standard Windows fpcup install:
c:\development\cross\bin\i8086-msdos
There are no files needed in the corresponding library directory,
C:\development\cross\lib\i8086-msdos
Settings
Open your settings file or add a new file, settings.ini:
[dos]
; dos cross compiler
; a full fpcup run must have been done before
; please adjust paths etc
fpcdir=c:\development\fpctrunk
fpcurl=http://svn.freepascal.org/svn/fpc/trunk
fpcopt=""
fpcuplinkname=""
lazlinkname=""
binutilsdir=c:\development\fpcbootstrap
fpcbootstrapdir=c:\development\fpcbootstrap
cputarget=i8086
ostarget=msdos
verbose=0
; We only need an FPC here; assume FPC has been updated by regular update
only=FPCBuildOnly
Creating and using the cross compiler
Then generate the cross compiler with
fpcup --inifile=settings.ini --inisection=dos
Now you can run a test compile, compiling a file test.pas with
fpc -Pi8086 -TMSDOS test.pas
(your fpc.cfg will have been modified to use DOS medium memory model, smartlinking etc)
Tips
Anchordocking
One way to enable anchordocking is by using settings.ini:
open your settings file or add a new file settings.ini
[anchordocking]
; Just a plain install except enable anchordocking package
anchordocking=1
This will use default settings but also enable the anchordocking package in the IDE.
Of course, you can use the anchordocking=1 module setting in any .ini section.
Building only FPC
You can build FPC without Lazarus if you want (or the other way round). The example below builds FPC from the fixes 2.6 SVN branch.
Settings
Open your settings file or add a new file, settings.ini
:
[fixes26]
; FPC 2.6 fixes only (no Lazarus)
fpcdir=c:\development\fpcfixes26
fpcurl=http://svn.freepascal.org/svn/fpc/branches/fixes_2_6
; Let's specify Lazarus info in case we ever want to add lazarus
lazdir=c:\development\lazarus12_fixes26
; Just an example: build Lazarus 1.2:
lazurl=http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_2
primary-config-path=c:\development\configlazarus12_fixes26
; If we ever build Lazarus, do create a link/shortcut:
lazlinkname=lazarus12_fixes26
; Do not create a batch file with shortcut
fpcuplinkname=""
; We can use the binutils/bootstrap dirs that we usually use:
binutilsdir=c:\development\fpcbootstrap
fpcbootstrapdir=c:\development\fpcbootstrap
; Just install/update, no questions asked:
noconfirm=true
; In case you want to submit patches, it's nice to be able to update
; without overwriting your fixes:
keeplocalchanges=true
; Specify we only want FPC, not Lazarus
; in case of fpc patches FPCBuildOnly
only=FPC,FPCCrossWin32-64
skip=helplazarus,lazarus,lazbuild,bigide,useride
Then get FPC and build it with:
fpcup --inifile=settings.ini --inisection=fixes26
Now you can run your compiler:
c:\development\fpcfixes26\bin\i386-win32\fpc.exe -h
Cross-compile for win64, e.g.:
c:\development\fpcfixes26\bin\i386-win32\fpc.exe -Px86_64 yourfile.pas
Avoid lengthy lcl.chm documentation generation
By default, fpcup tries to compile the $(lazarusdir)\docs\chm\lcl.chm
Lazarus help file every day or so. This can take a long time due to the fpdoc being quite slow.
You can avoid compiling lcl.chm by generating it one time (or copying over an existing file) and making the file read-only.
Download
The official site is at: https://bitbucket.org/reiniero/fpcup/downloads
License
fpcup is open source software released under the LGPL with linking exception (same as FreePascal/LCL).
Troubleshooting
When you hit errors with fpcup:
- Make sure any edits you may have made in fpc and laz source files don't mess up compiling. Run e.g. svn revert . --recursive to remove all local edits
- Try running fpcup with --verbose to see what's going on exactly
- Look into the error message fpcup generates; it also shows some troubleshooting steps you may perform
- Sometimes, the build process leaves incorrect files; you can delete all .ppu files from your FPC and Lazarus directories and run fpcup again.
- Try removing all intermediate files by running fpcup with the --clean option
- If compiling Lazarus, make sure lazarus and lhelp are not running.
- Try running followed by
svn revert THEDIRECTORY --recursive
for your Lazarus and FPC directories to remove local modifications, if anysvn update THEDIRECTORY
- Remove possible stale files:
- the bootstrap compiler and any binutils: remove all files in the fpcbootstrap directory
- if you haven't modified fpcup.ini, remove it and let fpcup regenerate it
- same for settings.ini
- See if there's a newer version available that may have fixed your problem
If the steps before do not work: use the --uninstall option to remove all files including your FPC and Lazarus directories, then run fpcup with the same commands.
Known issues
Known issues can be found in the issue tracker: https://bitbucket.org/reiniero/fpcup/issues?status=new&status=open
Info: Error running fpcup. Technical details: error executing sequence helplazarus; line: 4, param: helplazarus
HelpLazarus is often the first module that will be built after building lazbuild and the other core IDE units. However, the actual problem may be that lazbuild itself was not generated due to an error. Try running with --verbose to pinpoint where the problem is and follow the troubleshooting steps above.
Error finding (e.g.) system.ppu when compiling with FPC/Lazarus
Errors like this may be caused by an fpc.cfg from an older/different version of FPC that remains in your fpc/bin/<platform> directory. Because you can customise fpc.cfg, fpcup will not just replace it.
If you have not customised fpc.cfg, you can remove it and let fpcup regenerate it when rebuilding FPC.
Support and bug reporting
Please post support requests on the forum (e.g. in the thread dedicated to FPCUP in the Third-Party announcements section).
If you report problems, please be sure to mention
- operating system
- fpcup version (as printed in its output)
- description of what went wrong/error messge
- run fpcup with the
--verbose --noconfirm
arguments (or the equivalents in settings.ini) as well as the other arguments you used, redirect the output to file, and attach the file, e.g.:; if you post on the forum, please zip it and attach the result to your postfpcup --verbose --noconfirm > fpcupverbose.txt
You can report bugs on the forum or directly on the issue tracker: https://bitbucket.org/reiniero/fpcup/issues?status=new&status=open
Current progress
- Support for Windows 2000-7 (untested, probably works on 8). Bare metal install currently needs MS Visual C++ runtime for the subversion client.
- Linux x86: works
- Linux x64: works
- OSX 10.?: experimental support
- FreeBSD 9: lightly tested; seems to work
Changelog
This log tracks fpcup binaries as available on the download page. Note that not all binaries may be updated at the same time; fpcup prints a version string at the beginning which you can check.
For more details, please see the Mercurial commit log in https://bitbucket.org/reiniero/fpcup/commits/all
- 20131231:
- Add --crossOPT option that lets you pass options to cross compilers. Useful for e.g. specifying softfloat or hardfloat on ARM/MIPS processors. See example in settings.ini Please delete settings.ini and let fpcup regenerate it.
- 20131230:
- cross compiler modules not only add but also update fpc.cfg configuration snippets.
Snippet format changed: PLEASE REMOVE ALL # fpcup do not remove snippets from fpc.cfg or entire fpc.cfg and rerun your cross compilers.
- new Android-ARM cross-compiler module
- updated ARMEL cross compiler
- update configuration to Lazarus 1.3, avoiding upgrade process
- add dcpcrypt package
- add anchordocking package
- add CodeLibrarian package
- update rx to new repository URL. Please remove existing directory or do svn switch
- 20131122:
- New SVN URL for RXfpc components. Please delete your fpcup.ini (if not modified) to let it regenarate and remove the
extras\rx
directory before running the new fpcup so the new repository can be downloaded.
- New SVN URL for RXfpc components. Please delete your fpcup.ini (if not modified) to let it regenarate and remove the
- 20131118:
- Initial stab at support for http proxy: --httpproxy=user:password@host:port (user and password are optional). Also picks up http_proxy variable. Used in http, svn, hg over http downloads; not supported for git over http downloads. Needs testing.
- Bug fix: Ini file parameters should not be stored in fpcup start shell script/batch file
- Added fpc only example to settings.ini.
- Changed settings.ini: make full install/update default
- Split win32->win64 cross compile into FPC and Lazarus parts
- Reinstate bare metal install on Windows XP+. Windows 2000 users will get a warning that they should install SVN themselves.
- 20131023: Win32=>DOS crosscompiler support for FPC trunk
Earlier releases: please see the fpcup forum thread