View Issue Details

IDProjectCategoryView StatusLast Update
0016967ScribusBuild Systempublic2023-09-11 20:34
Reporterryandesign Assigned Tojghali  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.8 
Fixed in Version1.6.0.svn 
Summary0016967: Build error caused by removed 'std::unary_function' template in C++17 mode
DescriptionI want to build Scribus 1.5.8 in C++17 mode (by using ''-DWANT_CPP17=YES'' when running cmake), which is required because I am using poppler 23.06.0. I have also backported all the patches needed to build with this poppler version (r24884, r24982, r24985, r24989, r25074, r25140).

The build succeeds with Apple Clang 13 but fails with llvm.org Clang 16:

    scribus/desaxe/digester.cpp:451:37: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
    struct CreateDFAState : public std::unary_function <std::set<nfa_state_t>, dfa_state_t> {
                                   ~~~~~^~~~~~~~~~~~~~
                                        __unary_function
    /opt/local/libexec/llvm-16/bin/../include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
    using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
    ^

My understanding is that ''unary_function'' was removed from the standard as of C++17.

I see that the use of ''unary_function'' was removed from Scribus after the release of 1.5.8 in r24834 but that revision includes many other changes related to removing Qt5 support, which is not something I want at this time.

Is it safe to apply just the removal of ''unary_function'' from digester.cpp without applying the rest of the changes in r24834?
Steps To ReproduceBuild Scribus 1.5.8 with ''-DWANT_CPP17=YES'' when running cmake and using llvm.org Clang 16
TagsNo tags attached.
PatchNo

Activities

jghali

2023-06-30 19:45

administrator   ~0050251

>> Is it safe to apply just the removal of ''unary_function'' from digester.cpp without applying the rest of the changes in r24834?

Yep, it is. I have backported that change from trunk to 1.5.x branch.

jghali

2023-06-30 19:47

administrator   ~0050252

Fixed. It's weird we did not hit that error with gcc.

ryandesign

2023-07-01 02:39

reporter   ~0050253

Thanks, that fixed it.

> It's weird we did not hit that error with gcc.

Looks like the gcc developers chose not to remove unary_function yet, even in C++17, while the clang developers did.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91260

Issue History

Date Modified Username Field Change
2023-06-30 12:27 ryandesign New Issue
2023-06-30 19:45 jghali Note Added: 0050251
2023-06-30 19:46 jghali Summary error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'? => error: no template named 'unary_function' in namespace 'std' when building in C++17 mode
2023-06-30 19:47 jghali Assigned To => jghali
2023-06-30 19:47 jghali Status new => resolved
2023-06-30 19:47 jghali Resolution open => fixed
2023-06-30 19:47 jghali Fixed in Version => 1.6.0.svn
2023-06-30 19:47 jghali Note Added: 0050252
2023-06-30 21:56 jghali Summary error: no template named 'unary_function' in namespace 'std' when building in C++17 mode => Build error caused by removed 'std::unary_function' template in C++17 mode
2023-07-01 02:39 ryandesign Note Added: 0050253
2023-09-11 20:34 cbradney Status resolved => closed