fpc(1)
๐ fpc(1) โ Free Pascal Compiler ๐
๐ธ NAME ๐ธ
fpc โ the Free Pascal Compiler (FPC) binary. it's giving main character of your Pascal era, bestie ๐
๐ SYNOPSIS ๐
fpc [options] [sourcefile]
โจ DESCRIPTION โจ
okay so this binary? it's the main binary of the Free Pascal Compiler (FPC), which is a Turbo Pascal and Delphi (7.0) compatible standalone (non GCC frontend) multitarget Pascal compiler. no cap.
The compiler uses LD(1) and can use AS(1) (see parameter -Aas), but also has its own binary object writer. iconic.
The current main targets are Go32V2 (Dos DJGPP extender), Freebsd, Linux, MacOS, MacOSX, MorphOS, Netware, OS/2 and Win32. The other targets (M68K compilers for Atari and Amiga) are either based on older versions of the compiler or are still in development.
This manpage is meant for quick-reference only. FPC comes with a great (2000+ pages) manual, which is updated constantly, while this man page can be out of date. so if something looks stale, check the big manual ๐
๐ฆ Version number ๐ฆ
Starting with release 1.0, a new versioning system has been implemented. If the last number is even (1.0, 1.0.2), it is stable, and if the last number is odd it is a daily changing development version.(1.0.5, 1.1) just like the linux kernel. periodt.
Version 0.99.5 however is a stable release. It was made before the even/odd version naming system was introduced.
๐ธ Usage ๐ธ
The compilation process is started by typing fpc followed by a sourcefile name (normally with .pas or .pp extension). Before it even starts processing the actual source file, fpc.cfg(5) โ the configuration file of the compiler โ is read, which contains the location of the RTL, other packages (FCL, FreeVision), and optionally default values for some switches. See the separate manpage of fpc.cfg(5) for more information.
๐ OPTIONS ๐
โจ General options โจ
-hโ if you specify this option, the compiler outputs a list of all options, and exits after that. bestie it's the help menu, slay.-?โ idem as-h, but waiting after every screenfull for the enter key. so it's page-by-page help, very demure.-iโ This option tells the compiler to print the copyright information.
You can give it an option, as -ixxx where "xxx" can be one of the following:
Dโ Returns the compiler date.Vโ Returns the compiler version.SOโ Returns the compiler OS.SPโ Returns the compiler processor.TOโ Returns the target OS.TPโ Returns the target Processor.
-lโ At the top print a line stating which program this is and its version.-nโ Tells the compiler not to read the configuration filefpc.cfg(5)
๐ Options for getting feedback ๐
-vxxxโ Be verbose. "xxx" is a combination of the following:eโ Tells the compiler to show only errors. This option is on by default.iโ Tells the compiler to show some general information.wโ Tells the compiler to issue warnings.nโ Tells the compiler to issue notes.hโ Tells the compiler to issue hints.lโ Tells the compiler to show the line numbers as it processes a file. Numbers are shown per 100.uโ Tells the compiler to print the names of the files it opens.tโ Tells the compiler to print the names of the files it tries to open.pโ Tells the compiler to print the names of procedures and functions as it is processing them.cโ Tells the compiler to warn you when it processes a conditional.mโ Tells the compiler to write which macros are defined.dโ Tells the compiler to write other debugging info.aโ Tells the compiler to write all possible info. (this is the same as specifying all options)0โ Tells the compiler to write no messages. This is useful when you want to override the default setting in the configuration file.bโ Tells the compiler to show all procedure declarations if an overloaded function error occurs.xโ Tells the compiler to output some executable info (for Win32 platform only).rโ Rhide/GCC compatibility mode: formats the error differently, so they are understood by RHIDE.
๐ Options concerning files and directories ๐
-exxxโ tells the compiler that xxx is the directory where it can find the executables as (the assembler) and ld (the linker).-FDโ same as-e.-Fexxxโ This option tells the compiler to write errors, etc. to the file xxx-FExxxโ set the executable/unit output path to xxx-Fixxxโ adds xxx to the path where the compiler searches for its include files.-Flxxxโ Adds xxx to the library searching path, and is passed to the linker.-FLxxxโ ( Linux only) Tells the compiler to use xxx as the dynamic linker. Default this is/lib/ld-linux.so.2, orlib/ld-linux.so.1, depending on which one is found.-Foxxxโ Adds xxx to the object file path. This path is used when looking for files that need to be linked in.-Frxxxโ tells the compiler that xxx contains the compiler messages. Default the compiler has built-in messages. Specifying this option will override the default messages. (useful if you want to use a language other than the default language).-Fuxxxโ Adds xxx to the unit path. By default, the compiler only searches for units in the current directory and the directory where the compiler itself resides. This option tells the compiler also to look in the directory xxx-FUxxxโ Tells the compiler to write units in directory xxx instead of the current directory.-Ixxxโ Add xxx to the include file search path. This path is used when looking for include files.
๐ Options controlling the kind of output ๐
for more information on these options, see also the programmers manual.
-aโ Tells the compiler not to delete the assembler file. This also counts for the (possibly) generated batch script.-alโ Tells the compiler to include the sourcecode lines in the assembler file as comments.-anโ Tells the compiler to include node information in the generated assembler file. This is mainly for use by the compiler developers.-apโ Tells the compiler to use pipes to communicate with the assembler.-arโ Tells the compiler to include register allocation/deallocation information.-atโ Tells the compiler to include temporary register allocation/deallocation information.-Axxxโ specifies what kind of assembler should be generated . Here xxx is one of the following :ASโ A unix.o(object) file, using GNU AScoffโ coff object file (go32) using internal writer.defaultโ Use the default writer for the current platform.elfโ elf object file (linux, 32-bit only) using internal writer.nasmcoffโ a coff file using the nasm assembler.nasmelfโ a ELF32 file (LINUX only) using the nasm assembler.nasmobjโ a obj file using the nasm assembler.masmโ An obj file using the Microsoft masm assembler.pecoffโ pecoff object file (win32) using internal writer.tasmโ An obj file using the Borland tasm assembler.wasmโ An obj file using the Watcom assembler.
-Ccxxxโ set the default calling convention to XXX.-CDโ Create dynamic library.-Ceโ Compile using emulated floating point instructions.-Cfxxxโ Set the used floating point instruction set to xxx.-Cgโ Generate PIC code.-Chxxxโ Reserves xxx bytes heap. xxx should be between 1024 and 67107840.-Ciโ Generate Input/Output checking code.-Cnโ Omit the linking stage.-Coโ Generate Integer overflow checking code.-CRโ Verify object call validity (method calls must be valid).-Crโ Generate Range checking code.-Csxxxโ Set stack size to xxx bytes.-Ctโ generate stack checking code.-CXโ Create a smartlinked library.-dxxxโ Define the symbol name xxx This can be used to conditionally compile parts of your code.-Eโ Same as-Cn.-gโ Generate debugging information for debugging with GDB-ggโ idem as-g.-gdโ generate debugging info for dbx.-ghโ use the heaptrc unit (see the units part of the FPC manual).-glโ use the lineinfo unit for line information (see the units part of the FPC manual).-gvโ Generate information for debugging with valgrind.-gwโ Generate DWARF debugging information.-Oxxxโ optimize the compiler's output; xxx can have one of the following values :gโ optimize for size, try to generate smaller code.Gโ optimize for time, try to generate faster code (default).rโ keep certain variables in registers (experimental, use with caution).uโ uncertain optimizations1โ Level 1 optimizations (quick optimizations).2โ Level 2 optimizations (-O1plus some slower optimizations).3โ Level 3 optimizations (-O2plus-Ou).pnโ Specify processor : n can be one of1โ optimize for 386/4862โ optimize for Pentium/PentiumMMX (tm)3โ optimizations for PentiumPro / P-II / Cyrix 6x86 / K6 (tm)
The exact effect of these effects can be found in the programmers part of the manual.
-oxxxโ Tells the compiler to use xxx as the name of the output file (executable). Only with programs.-pgโ Generate profiler code for gprof.-sโ Tells the compiler not to call the assembler and linker. Instead, the compiler writes a script,PPAS.BATunder DOS, orppas.shunder Linux, which can then be executed to produce an executable.-shโ Tells the compiler to generate a script that can be used to assemble and link on the host system, not on the target system. Use this when cross-compiling.-srโ Skip register allocation stage in compiler (use with-ar)-stโ Tells the compiler to generate a script that can be used to assemble and link on the target system, not on the host system. Use this when cross-compiling.-Txxxโ Specifies the target operating system. xxx can be one of the following:EMXโ OS/2 and DOS via the EMX extender.FREEBSDโ FreeBSDGO32V2โ DOS and version 2 of the DJ DELORIE extender.LINUXโ Linux.NETBSDโ Netbsd.NETWAREโ Novell Netware module (clib)
NETLIBCโ Novell Netware module (libc) ๐OPENBSDโ OpenBSD ๐กOS2โ OS/2 (native mode) ๐ธSunOSโ Solaris SunOS โ๏ธWATCOMโ WatCOM dos extender ๐WDOSXโ WDosX Dos extender ๐ฆWIN32โ Windows 32 bit. ๐ช-uxxxโ undefine the symbolxxxif it is defined. This is the opposite of the-doption. it's giving anti--denergy fr. ๐-Xxโ Executable options. These tell the compiler what kind of executable should be generated. The parameterxcan be one of the following, bestie:cโ (Linux only, obsolete) Link with the C library. You should only use this when you start to port Free Pascal to another operating system. ๐งDโ Link with dynamic libraries (defines theFPC_LINK_DYNAMICsymbol) ๐dโ Don't use the standard library path. Use this when cross-compiling, to avoid linking with the host OS libraries. ๐ซPxxxโ Prepend the names of binutils (as,ld) withxxx. For use when cross-compiling. ๐งrxxxโ Set the library search path toxxx. ๐sโ Strip the symbols from the executable. โ๏ธSโ Link with static libraries (defines theFPC_LINK_STATICsymbol) ๐งฑtโ Link statically (passes-staticto the linker) ๐ฟXโ Link smart. Using this option sets theFPC_LINK_SMARTsymbol. ๐ง
okay so now we're getting into the language options, bestie. these are all about the sources, and if you want the full scoop, the Programmers Manual has your back. iykyk.
-Mmodeโ Specify the language mode.modecan be one of the following, and each one is a whole vibe:delphiโ Delphi-compatibility mode. This loads theobjpasunit, and switches on ansistring mode (-Sh). ๐fpcโ Default mode. ๐gpcโ GNU pascal mode (does nothing at the moment) ๐คmacpasโ Mac pascal mode. This loads themacpasunit and switches on some Mac extensions (mainly macros) ๐objfpcโ Object Pascal mode. This loads theobjpasunit. ๐ฏtpโ Turbo Pascal mode. ๐๏ธ
-Rxxxโ Specifies what assembler you use in your"asm"assembler code blocks. Herexxxis one of the following:attโ Asm blocks contain AT&T assembler. ๐intelโ Asm blocks contain Intel assembler. ๐ปdefaultโ Use default assembler for the selected platform. โ๏ธ
and here are the -S switches, each one doing its own iconic thing:
-S2โ Switch on Delphi 2 extensions. โจ-Saโ Generate code for assertions. ๐ก๏ธ-Scโ Support C-style operators, i.e.*=,+=,/=and-=. โ-Sdโ Tries to be Delphi compatible. ๐งฌ-Seโ The compiler stops after the first error. Normally, the compiler tries to continue compiling after an error, until 50 errors are reached, or a fatal error is reached, and then it stops. With this switch, the compiler will stop after the first error. okay so normally the compiler is a bit of a try-hard and keeps going after errors until it hits 50 errors or a fatal one. but with-Se, it's like 'nope, first error and I'm out.' ๐-Sgโ Support thelabelandgotocommands. ๐ท๏ธ-Shโ use ansistrings by default. ๐-SIxxxโ Specify the kind of interfaces.xxxcan be one of the following:COMโ use COM interfaces. (all interfaces descend fromIUnknown) ๐งฉCORBAโ use CORBA interfaces. (no inheritance is supposed) ๐
-Siโ Support C++ styleINLINE. โก-Smโ Support C-style macros. ๐ง-Soโ Try to be Borland TP 7.0 compatible (no function overloading etc.). ๐ข-Spโ Try to be GPC (GNU Pascal Compiler) compatible. ๐-Ssโ The name of constructors must be"init", and the name of destructors should be"done". ๐-Stโ Allow the"static"keyword in objects. ๐ฟ-Unโ Do not check the unit name. Normally, the unit name is the same as the filename. This option allows both to be different. ๐-Urโ Create a release unit. This sets a special flag in the unit, causing the compiler not to look for sources. ๐ฆ-Usโ Compile a system unit. This option causes the compiler to define only some very basic types. ๐งฑ
โจ SEE ALSO โจ
if you wanna dive deeper, these are the other manuals you should check out, bestie:
this iconic page was brought to you by Free Pascal on 22 feb 2002. periodt. ๐ โจ
๐ฆ where this page comes from
- arch rolling: fpc 3.2.2-11 ยท GPL AND LGPL AND custom
- epel 10: fpc 3.2.2-20.el10_1 ยท GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- epel 9: fpc 3.2.2-10.el9 ยท GPLv2+ and LGPLv2+ with exceptions
- fedora 43: fpc 3.2.2-20.fc43 ยท GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- fedora 43: fpc 3.2.2-20.fc43 ยท GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- fedora 44: fpc 3.2.4~rc1-3.fc44 ยท GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- fedora 44: fpc 3.2.4~rc1-3.fc44 ยท GPL-2.0-or-later AND LGPL-2.1-or-later WITH Independent-modules-exception
- nixos 26.05: fpc 3.2.2
- nixos 26.05: lazarus-gtk2 4.4-0
- nixos 26.05: lazarus-qt5 4.4-0
- nixos 26.05: lazarus-qt6 4.4-0
- nixpkgs unstable: fpc 3.2.2
- nixpkgs unstable: lazarus-cocoa 4.8-0
- nixpkgs unstable: lazarus-gtk3 4.8-0
- nixpkgs unstable: lazarus-qt5 4.8-0
- nixpkgs unstable: lazarus-qt6 4.8-0
- opensuse-leap 16.0: fpc 3.2.2-bp160.1.35 ยท GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: fpc 3.2.2-bp160.1.35 ยท GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: fpc 3.2.2-bp160.1.35 ยท GPL-2.0-or-later AND LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms