Sign in Join
Wiki copytemporary

Installation Troubleshooting: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Installation Troubleshooting

OldNewLine
1+These hints should (hopefully) be applicable across platforms; please adjust paths etc. according to your platform. Also, problems and solutions might be mentioned in the [[Lazarus Faq]].
2+
3+## Isolating the component
4+
5+There may be multiple problems when installing Free Pascal and Lazarus. If you have problems with starting Lazarus or compiling with it, first make sure your underlying FPC installation works, e.g. by trying to compile a simple example program.
6+
7+## Location of installed components
8+
9+On Linux/Unix/macOS, package/distribution provided installations will often install FPC in /bin or /usr/bin, with the libraries in /lib or /usr/lib, and probably the configuration in /etc/fpc.cfg Source (Subversion) downloads often install in /usr/local/bin (libraries in /usr/local/lib).
10+
11+## Missing or corrupt fpc.cfg file
12+
13+The fpc.cfg file is the configuration file for FPC. For windows, it can normally be found in the fpc compiler's executable directory. On Unix/Linux/OSX, it is first searched in /etc/fpc.cfg, then \[where?\].
14+
15+Only some problems that often occur are covered. Please see the Free Pascal User's guide, e.g. chapter Compiler usage/configuration file for more details, including the search order for fpc.cfg
16+
17+If it is not present, FPC will in general not compile your programs properly.
18+
19+### Create fpc.cfg automatically
20+
21+You can try to create fpc.cfg via a tool:
22+
23+```dos
24+rem Change to the FPC executable directory, adjust to taste
25+cd /d C:\freepascal\fpc\2.4.5\bin\i386-win32
26+rem Create fpc.cfg; basepath is the "root" of your fpc tree
27+fpcmkcfg -d basepath=C:\freepascal\fpc\2.4.5 -o .\fpc.cfg
28+```
29+
30+> **Note:** earlier instructions had \bin\i386-win32 appended to the basepath. This is not needed since at least FPC 2.4.4.
31+
32+### Create fpc.cfg manually
33+
34+If the above doesn't work for you, you can copy/paste the code below to a new file named fpc.cfg to your fpc executable directory (or ~/.fpc.cfg or other location). Modify the paths so they match your situation.
35+
36+\$FPCVERSION is used to automatically determine the version of FPC being used for the compile. Using this variable allows this single fpc.cfg to be used with multiple fpc versions that have the same path structure making it easier to maintain multiple FPC installs.
37+
38+ #
39+ # Config file generated by fpcmkcfg on 24/12/2010 - 18:17:42
40+ # Example fpc.cfg for Free Pascal Compiler
41+ #
42+
43+ # ----------------------
44+ # Defines (preprocessor)
45+ # ----------------------
46+
47+ #
48+ # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
49+ #
50+ # -d is the same as #DEFINE
51+ # -u is the same as #UNDEF
52+ #
53+
54+ #
55+ # Some examples (for switches see below, and the -? helppages)
56+ #
57+ # Try compiling with the -dRELEASE or -dDEBUG on the commandline
58+ #
59+
60+ # For a release compile with optimizes and strip debuginfo
61+ #IFDEF RELEASE
62+ -O2
63+ -Xs
64+ #WRITE Compiling Release Version
65+ #ENDIF
66+
67+ # For a debug version compile with debuginfo and all codegeneration checks on
68+ #IFDEF DEBUG
69+ -glh
70+ -Crtoi
71+ #WRITE Compiling Debug Version
72+ #ENDIF
73+
74+ # ----------------
75+ # Parsing switches
76+ # ----------------
77+
78+ # Pascal language mode
79+ # -Mfpc free pascal dialect (default)
80+ # -Mobjfpc switch some Delphi 2 extensions on
81+ # -Mdelphi tries to be Delphi compatible
82+ # -Mtp tries to be TP/BP 7.0 compatible
83+ # -Mgpc tries to be gpc compatible
84+ # -Mmacpas tries to be compatible to the macintosh pascal dialects
85+ #
86+ # Turn on Object Pascal extensions by default
87+ #-Mobjfpc
88+
89+ # Assembler reader mode
90+ # -Rdefault use default assembler
91+ # -Ratt read AT&T style assembler
92+ # -Rintel read Intel style assembler
93+ #
94+ # All assembler blocks are AT&T styled by default
95+ #-Ratt
96+
97+ # Semantic checking
98+ # -S2 same as -Mobjfpc
99+ # -Sc supports operators like C (*=,+=,/= and -=)
100+ # -Sa include assertion code.
101+ # -Sd same as -Mdelphi
102+ # -Se<x> compiler stops after the <x> errors (default is 1)
103+ # -Sg allow LABEL and GOTO
104+ # -Sh Use ansistrings
105+ # -Si support C++ styled INLINE
106+ # -SI<x> set interface style to <x>
107+ # -SIcomCOM compatible interface (default)
108+ # -SIcorbaCORBA compatible interface
109+ # -Sm support macros like C (global)
110+ # -So same as -Mtp
111+ # -Sp same as -Mgpc
112+ # -Ss constructor name must be init (destructor must be done)
113+ #
114+ # Allow goto, inline, C-operators, C-vars
115+ -Sgic
116+
117+ # ---------------
118+ # Code generation
119+ # ---------------
120+
121+ # Uncomment the next line if you always want static/dynamic units by default
122+ # (can be overruled with -CD, -CS at the commandline)
123+ #-CS
124+ #-CD
125+
126+ # Set the default heapsize to 8Mb
127+ #-Ch8000000
128+
129+ # Set default codegeneration checks (iocheck, overflow, range, stack)
130+ #-Ci
131+ #-Co
132+ #-Cr
133+ #-Ct
134+
135+ # Optimizer switches for i386 compiler
136+ # -Os generate smaller code
137+ # -O1 level 1 optimizations (quick optimizations)
138+ # -O2 level 2 optimizations (-O1 + slower optimizations)
139+ # -O3 level 3 optimizations (same as -O2u)
140+ # -Oa=N set alignment to N
141+ # -OoX switch on optimalization X.
142+ # -OoNOX switch off optimalization X.
143+ # X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
144+ # -OpCPU set target processor.
145+ # CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM
146+
147+ # -----------------------
148+ # Set Filenames and Paths
149+ # -----------------------
150+
151+ # Both slashes and backslashes are allowed in paths
152+
153+ # path to the messagefile, not necessary anymore but can be used to override
154+ # the default language
155+ #-FrC:\freepascal\fpc\$FPCVERSION/msg/errore.msg
156+ #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorn.msg
157+ #-FrC:\freepascal\fpc\$FPCVERSION/msg/errores.msg
158+ #-FrC:\freepascal\fpc\$FPCVERSION/msg/errord.msg
159+ #-FrC:\freepascal\fpc\$FPCVERSION/msg/errorr.msg
160+
161+ #IFDEF FPCAPACHE_1_13
162+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd13/
163+ #ELSE
164+ #IFDEF FPCAPACHE_2_0
165+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd20
166+ #ELSE
167+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/httpd22
168+ #ENDIF
169+ #ENDIF
170+
171+ # searchpath for units and other system dependent things
172+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/
173+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/*
174+ -FuC:\freepascal\fpc\$FPCVERSION/units/$FPCTARGET/rtl
175+
176+ # path to the gcclib
177+
178+ # searchpath for libraries
179+ #-FlC:\freepascal\fpc\$FPCVERSION/lib
180+ #-Fl/lib;/usr/lib
181+
182+ # searchpath for tools
183+ -FDC:\freepascal\fpc\$FPCVERSION/bin/$FPCTARGET
184+
185+ #IFNDEF CPUI386
186+ #IFNDEF CPUAMD64
187+ #DEFINE NEEDCROSSBINUTILS
188+ #ENDIF
189+ #ENDIF
190+
191+ #IFNDEF Win32
192+ #DEFINE NEEDCROSSBINUTILS
193+ #ENDIF
194+
195+ # binutils prefix for cross compiling
196+ #IFDEF FPC_CROSSCOMPILING
197+ #IFDEF NEEDCROSSBINUTILS
198+ -XP$FPCTARGET-
199+ #ENDIF
200+ #ENDIF
201+
202+ # -------------
203+ # Linking
204+ # -------------
205+
206+ # generate always debugging information for GDB (slows down the compiling
207+ # process)
208+ # -gc generate checks for pointers
209+ # -gd use dbx
210+ # -gg use gsym
211+ # -gh use heap trace unit (for memory leak debugging)
212+ # -gl use line info unit to show more info for backtraces
213+ # -gv generates programs tracable with valgrind
214+ # -gw generate dwarf debugging info
215+ #
216+ # Enable debuginfo and use the line info unit by default
217+ #-gl
218+
219+ # always pass an option to the linker
220+ #-k-s
221+
222+ # Always strip debuginfo from the executable
223+ -Xs
224+
225+ # -------------
226+ # Miscellaneous
227+ # -------------
228+
229+ # Write always a nice FPC logo ;)
230+ -l
231+
232+ # Verbosity
233+ # e : Show errors (default) d : Show debug info
234+ # w : Show warnings u : Show unit info
235+ # n : Show notes t : Show tried/used files
236+ # h : Show hints m : Show defined macros
237+ # i : Show general info p : Show compiled procedures
238+ # l : Show linenumbers c : Show conditionals
239+ # a : Show everything 0 : Show nothing (except errors)
240+ # b : Show all procedure r : Rhide/GCC compatibility mode
241+ # declarations if an error x : Executable info (Win32 only)
242+ # occurs
243+ #
244+ # Display Info, Warnings, Notes and Hints
245+ -viwn
246+ # If you don't want so much verbosity use
247+ #-vw
248+
249+### Testing and batch file/shortcut usage
250+
251+You can also explicitly specify a fpc.cfg to use:\<bash\>fpc -n -@/path/to/fpc.cfg\</bash\>. Handy for testing, creating shortcuts/shell scripts, having multiple FPC installations etc.
252+
253+If that does not work, you can try to create fpc.cfg manually: copy over an existing fpc.cfg from a working installation and change the paths.
254+
255+## Mixing FPC versions
256+
257+If your FPC cannot find its sources/ppu files while fpc.cfg has the right paths, another cause could be that the fpc executable is a different version than the (link to) ppc\<architecture\> compiler.
258+
259+When compiling with fpc, fpc starts e.g ppc386 to compile for x86 targets. Please make sure fpc and ppc\<architecture\> are compiled by the same version/sourced from the same package.
260+
261+## Lazarus can't find sources
262+
263+There may be a message saying Lazarus can't find the sources; if so, go to the menu at the top and select Environment -\> Environment options and insert the name of the directory where you expect to find your lazarus files (eg ~/FreePascal/lazarus), your compiler (e.g. /usr/local/bin/ppc386), the Free Pascal source directory (e.g. /usr/local/lib/fpc/\$version/fpc or a directory in your own space e.g. ~/FreePascal/fpc). Then close the dialog and start programming.
264+
265+## Paths in Lazarus options and project options
266+
267+Note that you can set paths (for compiler, FPC units etc) in the general options settings. Options you specify in Project Options can override these per project. If you experience path-related problems in a project but not in another, you might check if you mistakenly overrode some general options.
268+
269+---
270+*From the Free Pascal wiki, page "Installation Troubleshooting", as it stood on 2021-08-02 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
271+Category: Install
272+Category: Troubleshooting

Back to history