Bug 293197 - graphics/khronos-texture: fix build with libc++ 21
Summary: graphics/khronos-texture: fix build with libc++ 21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-02-15 22:20 UTC by Evgenii Khramtsov
Modified: 2026-02-16 11:49 UTC (History)
1 user (show)

See Also:
vvd: maintainer-feedback+
2khramtsov: merge-quarterly?


Attachments
v1 ("git am") (1.90 KB, patch)
2026-02-15 22:20 UTC, Evgenii Khramtsov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evgenii Khramtsov 2026-02-15 22:20:54 UTC
Created attachment 268083 [details]
v1 ("git am")
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2026-02-15 23:01:42 UTC
Is it possible to reproduce the issue on 14.x?
Tried USES+=llvm:21 - build without errors without patch.
Comment 2 Evgenii Khramtsov 2026-02-15 23:12:36 UTC
(In reply to Vladimir Druzenko from comment #1)

> Is it possible to reproduce the issue on 14.x?

I use the following on -CURRENT:

git remote add -t llvm-21-update -f dim "https://github.com/DimitryAndric/freebsd-src.git"
git rebase --rebase-merges dim/llvm-21-update
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2026-02-15 23:15:21 UTC
(In reply to Vladimir Druzenko from comment #1)
With USES+=llvm:21 it indeed uses clang21 to compile, but the system C++ library will still be libc++ 19, at least on 14.x. (The devel/llvm ports do not include the accompanying libc++ versions.)
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2026-02-16 00:46:52 UTC
(In reply to Dimitry Andric from comment #3)
That's what I thought… Thanks for the clarification.
Build fine on 14.x and 13.x amd64 with patch.

(In reply to Evgenii Khramtsov from comment #2)
Can you report this to the upstream?
Or can you write a description and I'll create the issue myself?
https://github.com/KhronosGroup/KTX-Software/issues
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-02-16 00:55:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=438a70797fc27940aa3276972591444707792551

commit 438a70797fc27940aa3276972591444707792551
Author:     Evgenii Khramtsov <2khramtsov@gmail.com>
AuthorDate: 2026-02-16 00:49:49 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-02-16 00:49:49 +0000

    graphics/khronos-texture: Fix build with libc++ 21

    [...]
    In file included from /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/src/os.cc:13:
    In file included from /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/os.h:11:
    /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/format.h:747:28: error: use of undeclared identifier 'malloc'
      747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
          |                            ^~~~~~
    /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/format.h:752:35: error: use of undeclared identifier 'free'
      752 |   void deallocate(T* p, size_t) { free(p); }
          |                                   ^~~~
    [...]

    While here udpate to USES+=compiler:c++14-lang - port uses -std=c++14.

    PR:     293197
    MFH:    2026Q1

 graphics/khronos-texture/Makefile                              |  2 +-
 .../files/patch-external_fmt_include_fmt_format.h (new)        | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-02-16 00:59:50 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cf42a29ebaba583b31de306fb77d5db6c13e100e

commit cf42a29ebaba583b31de306fb77d5db6c13e100e
Author:     Evgenii Khramtsov <2khramtsov@gmail.com>
AuthorDate: 2026-02-16 00:49:49 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-02-16 00:59:15 +0000

    graphics/khronos-texture: Fix build with libc++ 21

    [...]
    In file included from /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/src/os.cc:13:
    In file included from /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/os.h:11:
    /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/format.h:747:28: error: use of undeclared identifier 'malloc'
      747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
          |                            ^~~~~~
    /wrkdirs/usr/ports/graphics/khronos-texture/work/KTX-Software-4.4.2/external/fmt/include/fmt/format.h:752:35: error: use of undeclared identifier 'free'
      752 |   void deallocate(T* p, size_t) { free(p); }
          |                                   ^~~~
    [...]

    While here udpate to USES+=compiler:c++14-lang - port uses -std=c++14.

    PR:     293197
    MFH:    2026Q1
    (cherry picked from commit 438a70797fc27940aa3276972591444707792551)

 graphics/khronos-texture/Makefile                              |  2 +-
 .../files/patch-external_fmt_include_fmt_format.h (new)        | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2026-02-16 01:09:39 UTC
Thanks.
Comment 8 Evgenii Khramtsov 2026-02-16 02:05:26 UTC
(In reply to Vladimir Druzenko from comment #4)

Upstream should be fmt which khronos-texture bundles (external/). I won't be available for at least two days for FOSS stuff, so if you are in hurry you know it's fmt.
Comment 9 Evgenii Khramtsov 2026-02-16 10:22:59 UTC
fmt has https://github.com/fmtlib/fmt/commit/b77a7516251d upstream
Comment 10 Dimitry Andric freebsd_committer freebsd_triage 2026-02-16 11:49:35 UTC
(In reply to Evgenii Khramtsov from comment #9)
The upstream fix for the original issue not only added a #include <cstdlib>, but also changed 'plain' malloc/free calls to std::malloc and std::free, which makes putting in alternate allocators difficult.

But if you only add #include <cstdlib> (or #include <stdlib.h>, in this case it doesn't matter much), you won't have that problem.