[fpc-devel] How to show Linker Errors when compiling embedded targets?

Michael Ring mail at michael-ring.org
Sat Apr 3 13:00:18 CEST 2021


There's a small issue when compiling code for embedded, when there is a 
linker error for unresolved externals it does not get displayed.

example:

~/fpcupdeluxe/lazarus/lazbuild -B pio_ws2812-raspi_pico.lpi

using config file /Users/ring/fpcupdeluxe/lazarus/lazarus.cfg

....

pio_ws2812.lpr(85) Error: (9013) Error while linking
pio_ws2812.lpr(85) Fatal: (10026) There were 1 errors compiling module, 
stopping
Fatal: (1018) Compilation aborted
Error: /Users/ring/fpcupdeluxe/fpc/bin/aarch64-darwin/ppcarm returned an 
error exitcode
Error: (lazarus) Compile Project, OS: embedded, CPU: arm, Target: 
bin/pio_ws2812.elf: stopped with exit code 1
Error: (lazbuild) failed compiling of project 
/Users/ring/devel/pico-fpcexamples/pio_ws2812/pio_ws2812-raspi_pico.lpi


problem seems to be that stdout is not displayed by the DoExec / 
sysutils.ExecuteProcess on my Mac so the details on linker error get lost.

To find the error the code then has to be compiled with -sh parameter 
and after running ppas.sh the error surfaces:

./ppas.sh

Assembling pico_c

...

Linking /Users/ring/devel/pico-fpcexamples/pio_ws2812/bin/pio_ws2812
/Users/ring/fpcupdeluxe/cross/bin/arm-embedded/arm-none-eabi-ld: 
/Users/ring/devel/pico-fpcexamples/units/pio.c.obj: in function 
`pio_add_program':
pio.c:(.text.pio_add_program+0xd2): undefined reference to `panic'

An error occurred while linking 
/Users/ring/devel/pico-fpcexamples/pio_ws2812/bin/pio_ws2812


I followed the code in t_embed responsible for linking and tried using 
process unit but it is not known to the compiler itself.

Is there a variant of DoExec or something else that can be used in the 
compiler to run the link command again in case of an error so that the 
linker error gets displayed?


Michael




More information about the fpc-devel mailing list