kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.64k stars 252 forks source link

Build a test program with GCC9 #151

Closed xkzl closed 1 year ago

xkzl commented 2 years ago

Hello,

I have successfully built KFR (incl. C api) with shared library option enabled. Right now, I am trying to compile a class using GCC9 (std=c++17) including some basic call to dft.

univector<complex<double>, 256> data = cexp(linspace(0, c_pi<double, 2>, 256) * make_complex(0, 1));
univector<complex<double>, 256> freq;

freq = dft(data);

I am getting some issue like :

      ^
In file included from input_line_9:5:
In file included from /home/marcomeyer/Software/escalade/src/lib/UMO/include/UMO/TSignal.h:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/dft.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/base.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/math.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd.hpp:25:

In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/comparison.hpp:28:

In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/constants.hpp:28:
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/types.hpp:404:75: error: reference to 'is_same' is ambiguous
    is_same<T, float> || is_same<T, double> || is_same<T, signed char> || is_same<T, unsigned char> ||
                                                                          ^
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/../cometa.hpp:181:23: note: candidate found by name lookup is 'cometa::is_same'
constexpr inline bool is_same = std::is_same<T1, T2>::value;
                      ^
/usr/include/c++/9/type_traits:1285:12: note: candidate found by name lookup is 'std::is_same'
    struct is_same

I thought about some conflict with "using namespace std;" so II removed these lines. but the problem still persist. Additionally I have noticed these error message as well:

In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/dft.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/base.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/math.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/comparison.hpp:29:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/function.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/../../base/expression.hpp:29:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/../../base/../simd/shuffle.hpp:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/mask.hpp:28:
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/vec.hpp:231:41: error: reference to 'is_convertible' is ambiguous
    template <typename U, KFR_ENABLE_IF(is_convertible<U, value_type>&& compound_type_traits<T>::is_scalar)>
                                        ^
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/intrinsics.h:50:23: note: expanded from macro 'KFR_ENABLE_IF'
#define KFR_ENABLE_IF CMT_ENABLE_IF
                      ^
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/../cometa.hpp:187:23: note: candidate found by name lookup is 'cometa::is_convertible'
constexpr inline bool is_convertible = std::is_convertible<Tfrom, Tto>::value;
                      ^
/usr/include/c++/9/type_traits:1328:12: note: candidate found by name lookup is 'std::is_convertible'
    struct is_convertible
           ^
In file included from input_line_9:5:
In file included from /home/marcomeyer/Software/escalade/src/lib/UMO/include/UMO/TSignal.h:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/dft.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/base.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/math.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/comparison.hpp:29:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/function.hpp:25:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/../../base/expression.hpp:29:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/../../base/../simd/shuffle.hpp:28:
In file included from /home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/mask.hpp:28:
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/vec.hpp:231:27: error: parameter declarator cannot be qualified
    template <typename U, KFR_ENABLE_IF(is_convertible<U, value_type>&& compound_type_traits<T>::is_scalar)>
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/impl/intrinsics.h:50:23: note: expanded from macro 'KFR_ENABLE_IF'
#define KFR_ENABLE_IF CMT_ENABLE_IF
                      ^
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/../cometa.hpp:874:28: note: expanded from macro 'CMT_ENABLE_IF'
#define CMT_ENABLE_IF(...) CMT_ENABLE_IF_IMPL(__LINE__, __VA_ARGS__)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/marcomeyer/Software/kfr/4.2.1/include/kfr/simd/../cometa.hpp:870:95: note: expanded from macro 'CMT_ENABLE_IF_IMPL'
    typename ::std::enable_if<(__VA_ARGS__), typename ::cometa::details::unique_enum_impl<N>::type>::type =  \
                                                                                            ~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Anybody might help me to understand or fix that issue ?

dancazarin commented 1 year ago

Upcoming KFR 5.x will fix it by completely omitting std duplicates. Now c++17 standard features have been implemented in standard libraries much better and KFR no longer needs these aliases.

dancazarin commented 1 year ago

KFR 5 has been released with fixes for this issue. A dedicated test added to check compatibility with the discussed behavior. Could you test it to ensure that KFR 5 works in your environment?