Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 886307 - media-gfx/rawtherapee-5.8-r2 - /.../wchar.h: error: malloc attribute argument 1 is ambiguous
Summary: media-gfx/rawtherapee-5.8-r2 - /.../wchar.h: error: malloc attribute argument...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Francesco Riosa
URL:
Whiteboard:
Keywords:
Depends on: 883731
Blocks:
  Show dependency tree
 
Reported: 2022-12-16 10:03 UTC by Toralf Förster
Modified: 2023-01-28 18:26 UTC (History)
10 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,19.74 KB, text/plain)
2022-12-16 10:03 UTC, Toralf Förster
Details
emerge-history.txt.bz2 (emerge-history.txt.bz2,66.40 KB, application/x-bzip)
2022-12-16 10:03 UTC, Toralf Förster
Details
environment (environment,99.28 KB, text/plain)
2022-12-16 10:03 UTC, Toralf Förster
Details
etc.clang.tar.bz2 (etc.clang.tar.bz2,705 bytes, application/x-bzip)
2022-12-16 10:03 UTC, Toralf Förster
Details
etc.portage.tar.bz2 (etc.portage.tar.bz2,16.82 KB, application/x-bzip)
2022-12-16 10:03 UTC, Toralf Förster
Details
logs.tar.bz2 (logs.tar.bz2,7.03 KB, application/x-bzip)
2022-12-16 10:03 UTC, Toralf Förster
Details
media-gfx:rawtherapee-5.8-r2:20221216-041440.log (media-gfx:rawtherapee-5.8-r2:20221216-041440.log,175.41 KB, text/plain)
2022-12-16 10:03 UTC, Toralf Förster
Details
temp.tar.bz2 (temp.tar.bz2,30.40 KB, application/x-bzip)
2022-12-16 10:03 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2022-12-16 10:03:35 UTC
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"
Comment 1 Toralf Förster gentoo-dev 2022-12-16 10:03:35 UTC
Created attachment 843039 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-12-16 10:03:37 UTC
Created attachment 843041 [details]
emerge-history.txt.bz2
Comment 3 Toralf Förster gentoo-dev 2022-12-16 10:03:38 UTC
Created attachment 843043 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2022-12-16 10:03:39 UTC
Created attachment 843045 [details]
etc.clang.tar.bz2
Comment 5 Toralf Förster gentoo-dev 2022-12-16 10:03:40 UTC
Created attachment 843047 [details]
etc.portage.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2022-12-16 10:03:41 UTC
Created attachment 843049 [details]
logs.tar.bz2
Comment 7 Toralf Förster gentoo-dev 2022-12-16 10:03:42 UTC
Created attachment 843051 [details]
media-gfx:rawtherapee-5.8-r2:20221216-041440.log
Comment 8 Toralf Förster gentoo-dev 2022-12-16 10:03:43 UTC
Created attachment 843053 [details]
temp.tar.bz2
Comment 9 Ben Kohler gentoo-dev 2022-12-16 15:46:08 UTC
Version bump to 5.9 should fix this, I think
Comment 10 Klaus Kusche 2022-12-17 12:56:41 UTC
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.
Comment 11 Klaus Kusche 2022-12-17 14:06:36 UTC
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).
Comment 12 Klaus Kusche 2022-12-17 14:42:23 UTC
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).
Comment 13 Guillermo D. H. 2022-12-17 16:51:42 UTC
(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?
Comment 14 Larry the Git Cow gentoo-dev 2022-12-17 22:37:08 UTC
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(+)
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-18 01:40:44 UTC
thanks iamben!