Created attachment 240904 [details] patch Patch which enables kicad-cli to work as expected. Otherwise kicad-cli won't crash, but it will return 2 (which is enum CLI::EXIT_CODES::ERR_UNKNOWN) and won't work, e.g.: % kicad-cli sch export pdf file.kicad_sch -o file.pdf zsh: exit 2 kicad-cli sch export pdf file.kicad_sch -o file.pdf % echo $? 2 After some debugging, it was found that variable aPdfJob after dynamic_cast will be NULL. After changing to static_cast variable has normal address. Tested on FreeBSD -STABLE and -CURRENT and it works - kicad-cli returns 0 and exports sch/pcb to PDF.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=12ebb5e5de4b1107fbd48dda4ae44e2afda985ba commit 12ebb5e5de4b1107fbd48dda4ae44e2afda985ba Author: Christoph Moench-Tegeder <cmt@FreeBSD.org> AuthorDate: 2023-03-24 21:24:45 +0000 Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org> CommitDate: 2023-03-24 21:24:45 +0000 cad/kicad: fix failure in certain modes (e.g. exports) The use of dynamic_case here results in failures (error exits) and seems to be actually wrong, which is exposed by our clang (mabe gcc handles this just fine? PR: 270273 Reported By: Pero Orsolic cad/kicad/Makefile | 1 + .../patch-job_use_dynamic_cast_for_updating (new) | 171 +++++++++++++++++++++ 2 files changed, 172 insertions(+)
That goes way deeper, there were quite a few more instances of problematic casting. There we go, feels fine for now.
Did this issue / patch ever make it upstream?