Bug 293944 - cad/kicad: fix build with libc++ 21
Summary: cad/kicad: fix build with libc++ 21
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Christoph Moench-Tegeder
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-03-20 21:03 UTC by Dimitry Andric
Modified: 2026-03-20 21:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cmt)


Attachments
cad/kicad: fix build with libc++ 21 (1.81 KB, patch)
2026-03-20 21:04 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2026-03-20 21:03:53 UTC
With libc++ 21 cad/kicad fails to build, with errors similar to:

    /wrkdirs/usr/ports/cad/kicad/work/kicad-9.0.8/thirdparty/fmt/include/fmt/format.h:750:35: error: use of undeclared identifier 'free'
      750 |   void deallocate(T* p, size_t) { free(p); }
          |                                   ^~~~
    /wrkdirs/usr/ports/cad/kicad/work/kicad-9.0.8/thirdparty/fmt/include/fmt/format.h:810:46: note: in instantiation of member function 'fmt::detail::allocator<int>::deallocate' requested here
      810 |     if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
          |                                              ^

This is because malloc and free are defined in <cstdlib>, and format.h
does not explicitly include it. (Before libc++ 21, the fmt library was
"lucky" that <cstdlib> was included transitively, but this is no longer
the case.)
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-03-20 21:04:48 UTC
Created attachment 268961 [details]
cad/kicad: fix build with libc++ 21
Comment 2 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2026-03-20 21:28:07 UTC
I just updated kicad to version 10 a few hours ago (ports 04b7169b76dde7540b07ba13089bf3f7608e6581), and that comes with fmt 12.1.0 which looks like it doesn't need this anymore https://gitlab.com/kicad/code/kicad/-/blob/10.0/thirdparty/fmt/include/fmt/format.h?ref_type=heads#L50
That leaves quarterly - how urgent is this? The quarter is almost over...
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2026-03-20 21:48:08 UTC
Oh it's not terribly urgent, I had all the patches for the llvm-21-update branch marked with MFH: 2026Q1 out of habit.

I think I updated my ports tree today, and it still had kicad-9.0.8_1,2, but I will probably just have missed your commit. :)