Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909094 - media-gfx/inkscape: fails to compile with clang-16 due to {u,bi}nary_function usage
Summary: media-gfx/inkscape: fails to compile with clang-16 due to {u,bi}nary_function...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas K. Hüttel
URL: https://gitlab.com/inkscape/inkscape/...
Whiteboard:
Keywords: PATCH
Depends on: 923255
Blocks: systemwide-libcxx
  Show dependency tree
 
Reported: 2023-06-24 20:49 UTC by Vic Kerr (wikky)
Modified: 2024-03-12 22:02 UTC (History)
2 users (show)

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


Attachments
Prepends __ to allow successful build. (ubinary_function.patch,3.48 KB, patch)
2023-06-24 20:49 UTC, Vic Kerr (wikky)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vic Kerr (wikky) 2023-06-24 20:49:28 UTC
Created attachment 864586 [details, diff]
Prepends __ to allow successful build.

Building inkscape (1.2.2 and -r4) with clang-16 fails with errors about usage of std::{u,bi}nary_function:

/var/tmp/portage/media-gfx/inkscape-1.2.2/work/inkscape-1.2.2/src/util/units.h:29:42: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
struct hash<Glib::ustring> : public std::unary_function<Glib::ustring, std::size_t> {
                                    ~~~~~^~~~~~~~~~~~~~
                                         __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;

See url for a commit that removes 'almost all' usages of std::unary_function.

The attached patch is just a cheeky sed that replaces these with the double-underscored names. This is obviously not a long-term solution but it enables a successful, working build. The proper fix would be to complete the work started in the linked commit.
Comment 1 unhappy-ending 2023-07-01 09:14:18 UTC
I don't see a build log with your flags. I've also run into this issue. I'm guessing you're either passing -stdlib=libc++ or you have clang-common[default-libcxx] set. A dead giveaway is that the files failing to compile are .cpp files. Seems to be a problem with Inkscape and libc++. Adding -stdlib=libstc++ to my flags allows Inkscape to compile, but the final link fails from undefined symbols.
Comment 2 Markus Peloquin 2023-08-30 23:15:07 UTC
inkscape compiles with -std=c++17 and unary_function was removed in c++17. This is an inkscape and gcc bug, thanks
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-30 23:29:38 UTC
(In reply to Markus Peloquin from comment #2)
> inkscape compiles with -std=c++17 and unary_function was removed in c++17.
> This is an inkscape and gcc bug, thanks

It's not necessarily a GCC bug if they want to keep it as an extension for now in gnu++17. But in any case, I'm not sure what your comment is adding here.

(In reply to unhappy-ending from comment #1)
> I don't see a build log with your flags. I've also run into this issue. I'm
> guessing you're either passing -stdlib=libc++ or you have
> clang-common[default-libcxx] set. A dead giveaway is that the files failing
> to compile are .cpp files. Seems to be a problem with Inkscape and libc++.
> Adding -stdlib=libstc++ to my flags allows Inkscape to compile, but the
> final link fails from undefined symbols.

Yes, you can't mix libstdc++ and libc++ (as you know well). It's clear frmo the log that the report is using libc++, but it's not blocking the bug 836220 tracker (added now).
Comment 4 Vic Kerr (wikky) 2024-02-21 12:31:52 UTC
The commit that fixes this properly has been merged upstream as of inkscape 1.3. I just confirmed media-gfx/inkscape-1.3.2 builds fine for me (still on default-libcxx), so this bug is obsolete pending stabilisation of inkscape-1.3*.