Re: Trying to use gprof profiler, but linking keeps failing

mailinglists--- via fpc-pascal <[email protected]> Sun, 22 Mar 2026 00:06:28 +0000
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
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 -
_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal