[fpc-pascal] Trying to use gprof profiler, but linking keeps failing
Michael Van Canneyt
michael at freepascal.org
Sun Mar 22 07:55:29 CET 2026
On Sun, 22 Mar 2026, mailinglists--- via fpc-pascal wrote:
> On 2026-03-17 13:57, Michael Van Canneyt via fpc-pascal wrote:
>>> The -pg (gprof) flag doesn't work well with Free Pascal — it tries to
>>> link against C runtime profiling infrastructure (crtbegin.o,
>>> __dso_handle) that FPC's linker setup doesn't support.
>>>
>>> Is this true?
>>
>> Yes, it is...
>
>
> I found a solution - at least on my Ubuntu 24.04 system.
>
> Add "-Fl/usr/lib/gcc/x86_64-linux-gnu/13" to the compiler options (your
> application or global). The ~/.fpc.cfg had -Fl/usr/lib but that was
> obviously not extensive enough to find the GCC libraries FPC needed.
>
> And gprof is back in action! :)
Can you please add an issue to the bugtracker:
We should probably scan /usr/lib during installation for this path and add
it to the default generated fpc.cfg
Michael.
More information about the fpc-pascal
mailing list