sneumann / Rdisop

This is the git repository matching the Bioconductor package Rdisop: Decomposition of Isotopic Patterns
4 stars 9 forks source link

Compile error with C++17 on BioC pre-3.20, Apple clang 16 and LLVM clang/libc++ 19 #28

Open sneumann opened 1 week ago

sneumann commented 1 week ago

Prof Ripley reported:

On 28/01/2023 13:05, Prof Brian Ripley wrote:
> These do not install on fedora-clang and macOS with Apple clang 14 (at
> least) with R's new default of C++17. Log extracts below.

And this is still true of Rdisop in BioC pre-3.20, Apple clang 16 and
LLVM clang/libc++ 19.  For example with Apple clang

In file included from imslib/src/ims/alphabet.cpp:7:
./imslib/src/ims/utils/compose_f_gx_t.h:66:16: error: no template named
'unary_function' in namespace 'std'; did you mean '__unary_function'?
    66 |  : public std::unary_function<typename OP2::argument_type,
       |           ~~~~~^~~~~~~~~~~~~~
       |                __unary_function
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1:
note: '__unary_function' declared here
    46 | using __unary_function =
__unary_function_keep_layout_base<_Arg, _Result>;
       | ^
In file included from imslib/src/ims/alphabet.cpp:8:
./imslib/src/ims/utils/compose_f_gx_hy_t.h:57:16: error: no template
named 'binary_function' in namespace 'std'; did you mean
'__binary_function'?
    57 |  : public std::binary_function<typename OP2::argument_type,
       |           ~~~~~^~~~~~~~~~~~~~~
       |                __binary_function
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/binary_function.h:49:1:
note: '__binary_function' declared here
    49 | using __binary_function =
__binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
       | ^
2 errors generated.

unary_function and binary_function were removed in C++17.  To make this
install we have to declare

SystemRequirements: C++14

But C++17 has been the default in R since R 4.3.0 and the removal of
these functions is even documented in 'Writing R Extensions'.
sneumann commented 1 week ago

Maybe among @vjcitn, @yufree or @rickhelmus there is an expert in C++ ? Thanks in advance, yours, Steffen

yufree commented 1 week ago

Hi, I am not sure if this will trigger a version change and I just removed those functions with modern C++ usage in this PR #29 I tested on my Macbook with c++ and clang compliers.