[fpc-pascal] Trying to use gprof profiler, but linking keeps failing

mailinglists at geldenhuys.co.uk mailinglists at geldenhuys.co.uk
Sun Mar 22 01:06:28 CET 2026


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! :)


Regards,
   - Graeme -


More information about the fpc-pascal mailing list