Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924551 - app-text/doxygen-1.10.0-r1: fails to compile (LIBCXX-CLANG19): implicit instantiation of undefined template 'std::char_traits<unsigned char>'
Summary: app-text/doxygen-1.10.0-r1: fails to compile (LIBCXX-CLANG19): implicit insta...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords: PATCH
: 945813 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-02-14 12:45 UTC by hugegameartgd
Modified: 2025-04-20 13:30 UTC (History)
18 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.log,18.33 KB, text/x-log)
2024-02-14 12:45 UTC, hugegameartgd
Details
build.log (build.log.gz,6.32 KB, application/gzip)
2024-02-14 12:46 UTC, hugegameartgd
Details
proposed patch (doxygen-1.12.0-char_traits.patch,2.15 KB, patch)
2025-01-02 17:59 UTC, Bryce Copeland
Details | Diff
Proposed patch based on unreleased upstream commits (doxygen-1.12.0-llvm-19.patch,1.99 KB, patch)
2025-01-09 19:25 UTC, me@kylemanke.com
Details | Diff
doxygen-1.13.0-clang-19.patch (doxygen-1.13.0-clang-19.patch,1.69 KB, patch)
2025-01-16 20:55 UTC, Andrey Volkov
Details | Diff
Patch against the existing portage tree fixing version 1.12.0. (doxygen-1.12.0-clang-19.patch,2.12 KB, patch)
2025-01-21 02:21 UTC, Robert R. Russell
Details | Diff
/etc/portage/env/app-text/doxygen (doxygen,1.38 KB, text/plain)
2025-03-25 06:00 UTC, Sergey Kondakov
Details
doxygen-1.13.2-clang-19.patch (clang-19.patch,704 bytes, patch)
2025-04-20 13:29 UTC, hugegameartgd
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description hugegameartgd 2024-02-14 12:45:28 UTC
Created attachment 884955 [details]
emerge --info

app-text/doxygen-1.10.0-r1 fails to compile with libc++-19 (musl/clang/merged-usr)

Steps to Reproduce:
- Compile with `emerge =app-text/doxygen-1.10.0-r1::gentoo`

[42/257] /usr/lib/ccache/bin/clang++-19  -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/src -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0_build/generated_src  -O2 -pipe -march=native -mtune=native -D_FORTIFY_SOURCE=3 -g0 -stdlib=libc++       -DJAVACC_CHAR_TYPE="unsigned char" -std=gnu++17 -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o -MF vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o.d -o vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o -c /var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/CharStream.cc
FAILED: vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o 
/usr/lib/ccache/bin/clang++-19  -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/src -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser -I/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0_build/generated_src  -O2 -pipe -march=native -mtune=native -D_FORTIFY_SOURCE=3 -g0 -stdlib=libc++       -DJAVACC_CHAR_TYPE="unsigned char" -std=gnu++17 -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o -MF vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o.d -o vhdlparser/CMakeFiles/vhdlparser.dir/CharStream.cc.o -c /var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/CharStream.cc
In file included from /var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/CharStream.cc:3:
In file included from /var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/CharStream.h:6:
In file included from /var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/JavaCC.h:6:
/usr/include/c++/v1/string:746:43: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
  746 |   static_assert((is_same<_CharT, typename traits_type::char_type>::value),
      |                                           ^
/var/tmp/portage/app-text/doxygen-1.10.0-r1/work/doxygen-1.10.0/vhdlparser/CharStream.h:129:20: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
  129 |   virtual JJString GetImage() {
      |                    ^
/usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
   23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
      |                             ^
Comment 1 hugegameartgd 2024-02-14 12:46:07 UTC
Created attachment 884956 [details]
build.log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-03 12:02:41 UTC
*** Bug 945813 has been marked as a duplicate of this bug. ***
Comment 3 Matt Jolly gentoo-dev 2024-12-13 21:36:57 UTC
It looks like this template was deprecated for llvm-18 (actually 17 but the message was not visible), it is likely that it was actually removed for 19.

https://github.com/llvm/llvm-project/pull/72694

I'm pretty sure I built with 19 so perhaps this code is conditional?
Comment 4 Alfred Wingate 2024-12-13 21:40:00 UTC
It's specific to libcxx (LLVM's C++ library alternative). This affects the llvm profile which enables default-libcxx and cannot reproduced by simply building with clang.
Comment 5 Bryce Copeland 2025-01-02 17:59:24 UTC
Created attachment 915744 [details, diff]
proposed patch

Having the same issue too, I'm on LLVM-19 and musl.
I tried version bumping and applying the proposed patch from the last comment in the upstream issue:
https://github.com/doxygen/doxygen/issues/10928#issuecomment-2566016620

it seemed to solve the char_traits issue, however it changes it from c++17 to c++20, which introduces a whole bunch of unrelated issues with consteval functions.

I made a variation of the patch that uses the 'char' type instead of 'unsigned char', which *seems* to work. I know the correct type to substitute would by char8_t, but c++17 doesn't have it :(

I'm not the best with c++, so I'm not sure if this solution is technically correct.
It does compile though, and doxygen *seems* to work for a few packages I've tested with

I don't think it's a good solution, but if it works it might be alright in the mean time
Comment 6 me@kylemanke.com 2025-01-09 19:25:09 UTC
Created attachment 916196 [details, diff]
Proposed patch based on unreleased upstream commits

I have compiled successfully by applying a patch based on some (as yet unreleased) upstream changes which does the following:

1) Change the char type to char8_t
2) Change the compiler standard to c++20 (needed to use char8_t)
3) Fix errors in trace.h resulting from the change to c++20
Comment 7 Andrey Volkov 2025-01-10 11:24:19 UTC
(In reply to me@kylemanke.com from comment #6)
> Created attachment 916196 [details, diff] [details, diff]
> Proposed patch based on unreleased upstream commits

This patch works for me. (clang-19, libcxx-19, ld.lld)
Thank you!
Comment 8 me@kylemanke.com 2025-01-10 19:25:09 UTC
Forgot to mention in my previous comment that the patch is against the current stable version 1.12.0. Just for clarity. I do not know if the patch works for 1.10.0-r1.
Comment 9 Andrey Volkov 2025-01-16 20:55:25 UTC
Created attachment 916752 [details, diff]
doxygen-1.13.0-clang-19.patch

porting the patch for doxygen-1.13.0
Comment 10 Robert R. Russell 2025-01-21 02:21:10 UTC
Created attachment 917194 [details, diff]
Patch against the existing portage tree fixing version 1.12.0.

Head is baf70f47b9901a89aff7b12697272f5cac6ad022 for this patch.

Apply it to the existing app-text/doxygen/files/doxygen-1.12.0-clang-19.patch file.

Compile doxygen with llvm-19

Use doxygen.

No working patch for 1.13 is in the tree currently.
Comment 11 Neko-san 2025-03-16 20:10:16 UTC
This issue seems to have resurfaced with 1.13.2 (the 1.13.0 patch no longer succeeds in applying either)
Comment 12 Sergey Kondakov 2025-03-25 06:00:22 UTC
Created attachment 922567 [details]
/etc/portage/env/app-text/doxygen

Seems like upstream has applied half of the patch and we need to put in the other half. In addition, Gentoo-nannies from #822615 have hardcoded `libc++=off` (not sure how well of an idea it is for clang/libc++ builds). With this workarounds it builds but I can't say anything about functionality. I'm still just trying to produce a full system from barebone stage3.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-25 06:05:30 UTC
(In reply to Sergey Kondakov from comment #12)
> Created attachment 922567 [details]
> /etc/portage/env/app-text/doxygen
> 
> Seems like upstream has applied half of the patch and we need to put in the
> other half. In addition, Gentoo-nannies from #822615 have hardcoded

Please don't say things like that.

> `libc++=off` (not sure how well of an idea it is for clang/libc++ builds).

... because you can add it manually / clang-common[default-libcxx] does it for you. Doing =OFF does not mean it then forces using libstdc++. It means it doesn't try to "helpfully" add libc++ for you (which would break people using Clang but wanting ABI compatibility).

See https://github.com/doxygen/doxygen/blob/894735c235c59d2ed089a6bd678a4795efa80ffb/src/CMakeLists.txt#L369.
Comment 14 Sergey Kondakov 2025-03-25 13:34:04 UTC Comment hidden (offtopic)
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-25 13:37:07 UTC
(In reply to Sergey Kondakov from comment #14)
> > Please don't say things like that.

Your comment was based on a mistake (disabling the option has nothing to do with forbidding libc++ or breaking the profiles).

> I've taken most "irresponsible" stage3 (llvm+openrc) with most "irresponsible" make.conf configuration I could muster, yet only got 1 annoying issue due to that (famous Qt/kde shenanigans with clang and/or lto).

Isn't that to our credit then?

> > ... because you can add it manually / clang-common[default-libcxx] does it for you. Doing =OFF does not mean it then forces using libstdc++. It means it doesn't try to "helpfully" add libc++ for you (which would break people using Clang but wanting ABI compatibility).
> 
> Admittedly, if emerging as-is on llvm-stage3 somehow sets default-libcxx in
> doxygen to override that switch, then it's not a problem.

default-libcxx is obviously forced on for the LLVM profiles, whose whole purpose is a pure LLVM toolchain. That's why I said it.
Comment 16 hugegameartgd 2025-04-20 13:29:52 UTC
Created attachment 925457 [details, diff]
doxygen-1.13.2-clang-19.patch

(In reply to Andrey Volkov from comment #9)
> Created attachment 916752 [details, diff] [details, diff]
> doxygen-1.13.0-clang-19.patch
patch rebased for doxygen-1.13.2