In file included from /usr/include/features.h:490, from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/os_defines.h:39, from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/c++config.h:655, from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/cstdio:41, from /var/tmp/portage/media-gfx/rawtherapee-5.8-r2/work/rawtherapee-5.8/rtengine/myfile.h:21, from /var/tmp/portage/media-gfx/rawtherapee-5.8-r2/work/rawtherapee-5.8/rtengine/myfile.cc:19: /usr/include/wchar.h:582:24: error: malloc attribute argument 1 is ambiguous 582 | __attribute_malloc__ __attr_dealloc_fclose; | ^~~~~~~~~~~~~~~~~~~~~ ------------------------------------------------------------------- This is an unstable amd64 chroot image at a tinderbox (==build bot) name: 17.1_desktop_plasma_systemd_merged_usr-j4-20221213-010009 ------------------------------------------------------------------- gcc-config -l: [1] x86_64-pc-linux-gnu-11 [2] x86_64-pc-linux-gnu-12 * clang/llvm (if any): clang version 15.0.6 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/15/bin Configuration file: /etc/clang/clang.cfg /usr/lib/llvm/15 15.0.6 Python 3.10.9 Available Rust versions: [1] rust-bin-1.65.0 * The Glorious Glasgow Haskell Compilation System, version 9.0.2 php cli (if any): HEAD of ::gentoo commit 6e1009891d309b7e1232b15cc90729a24a00fd98 Author: Repository mirror & CI <repomirrorci@gentoo.org> Date: Fri Dec 16 03:47:07 2022 +0000 2022-12-16 03:47:06 UTC emerge -qpvO media-gfx/rawtherapee [ebuild N ] media-gfx/rawtherapee-5.8-r2 USE="openmp tcmalloc"
Created attachment 843039 [details] emerge-info.txt
Created attachment 843041 [details] emerge-history.txt.bz2
Created attachment 843043 [details] environment
Created attachment 843045 [details] etc.clang.tar.bz2
Created attachment 843047 [details] etc.portage.tar.bz2
Created attachment 843049 [details] logs.tar.bz2
Created attachment 843051 [details] media-gfx:rawtherapee-5.8-r2:20221216-041440.log
Created attachment 843053 [details] temp.tar.bz2
Version bump to 5.9 should fix this, I think
A fix is urgently needed: The new version of media-libs/tiff (new slot) forces a rebuild of rawtherapee, and the rebuild fails. Hence, both emerge @world and emerge @preserved-rebuild fail, and masking raw-therapee does not help.
As far as I can tell, the problem is the following: The preprocessor expands the wchar.h:582 line containing the error to extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) noexcept (true) __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (fclose, 1))); And when the compiler reads that line and processes the __attribute__, it really has *two* different, incompatible definitions of "fclose" in scope, which makes argument 1 of __malloc__ ambiguous: * The stdio.h "extern int fclose (FILE *__stream);" * And "void fclose (IMFILE* f);" from rawtherapee-5.8/rtengine/myfile.h:58 If the fclose in myfile.h is renamed to something else (e.g. xxxfclose), the open_wmemstream line above compiles without error. (but the generated code is most likely broken, because it calls the wrong fclose?). So I think the problem is not in rawtherapee, and not in gcc, but in glibc: If glibc's headers are included in C++ where function overloading is allowed, and fclose is overloaded, __attr_dealloc_fclose results in the ambiguous error (as would __attr_dealloc_free if the application declared its own free).
I found a workaround which seems to solve the problem for me: In rawtherapee-5.8/rtengine/myfile.cc, just move #include "myfile.h" down two lines (after #include "rtengine.h") to make sure that all the standard headers are included *before* rawtherapee's declaration of its own fclose. emerges for me and produces an executable which starts (I did not test if it also works correctly).
(In reply to Ben Kohler from comment #9) > Version bump to 5.9 should fix this, I think I believe so as well. This bug should be fixed upstream in this commit: https://github.com/Beep6581/RawTherapee/commit/2e0137d54243eb729d4a5f939c4320ec8f8f415d 5.9 has this, but the code from 5.8 differs too much to backport the fix as-is. Would it be possible to package 5.9?
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6177779d904507086b649e84bccfa9d90c4cec10 commit 6177779d904507086b649e84bccfa9d90c4cec10 Author: Ben Kohler <bkohler@gentoo.org> AuthorDate: 2022-12-17 22:36:02 +0000 Commit: Ben Kohler <bkohler@gentoo.org> CommitDate: 2022-12-17 22:37:03 +0000 media-gfx/rawtherapee: add 5.9 Bug: https://bugs.gentoo.org/886307 Signed-off-by: Ben Kohler <bkohler@gentoo.org> media-gfx/rawtherapee/Manifest | 1 + media-gfx/rawtherapee/rawtherapee-5.9.ebuild | 75 ++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+)
thanks iamben!