shajen / rtl-sdr-scanner-cpp

GNU General Public License v3.0
603 stars 61 forks source link

Compile from Source yields cmake errors #75

Closed Zotter closed 8 months ago

Zotter commented 11 months ago

Fedora 38, up to date and pre-reqs installed

Following build instructions - all goes well until:

`[ 72%] Building CXX object CMakeFiles/auto_sdr_libs.dir/sources/ring_buffer.cpp.o [ 75%] Building CXX object CMakeFiles/auto_sdr_libs.dir/sources/utils.cpp.o /home//sdr-scanner/sources/utils.cpp:76:3: error: ‘f32’ or ‘F32’ suffix on floating constant only available with ‘-std=c++2b’ or ‘-std=gnu++2b’ [-Werror=pedantic] 76 const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); ^~~~~ /home//sdr-scanner/sources/utils.cpp: In function ‘std::vector<std::complex > getShiftData(int32_t, Frequency, uint32_t)’: /home//sdr-scanner/sources/utils.cpp:76:58: error: no match for ‘operator*’ (operand types are ‘std::complex’ and ‘_Float32’) 76 const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); ~~~~~~~~~~ ^
std::complex

In file included from /usr/include/c++/13/valarray:605, from /usr/include/nlohmann/detail/conversions/from_json.hpp:21, from /usr/include/nlohmann/adl_serializer.hpp:14, from /usr/include/nlohmann/json.hpp:35, from /home//sdr-scanner/sources/config.h:6, from /home//sdr-scanner/sources/utils.h:3, from /home//sdr-scanner/sources/utils.cpp:1: /usr/include/c++/13/bits/valarray_after.h:407:5: note: candidate: ‘template<class _Dom1, class _Dom2> std::_Expr<std::detail::_BinClos<std::multiplies, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)’ 407 | _DEFINE_EXPR_BINARY_OPERATOR(, struct std::multiplies) | ^~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: In file included from /usr/include/bits/floatn.h:119, from /usr/include/wchar.h:30, from /usr/include/c++/13/cwchar:44, from /usr/include/c++/13/bits/postypes.h:40, from /usr/include/c++/13/bits/char_traits.h:42, from /usr/include/c++/13/string:42, from /home//sdr-scanner/sources/radio/help_structures.h:4, from /home//sdr-scanner/sources/config.h:3: /home//sdr-scanner/sources/utils.cpp:76:60: note: ‘std::complex’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: candidate: ‘template std::_Expr<std::detail::_BinClos<std::__multiplies, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’ 407 | _DEFINE_EXPR_BINARY_OPERATOR(, struct std::__multiplies) | ^~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: ‘std::complex’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: candidate: ‘template std::_Expr<std::detail::_BinClos<std::__multiplies, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::fun<std::multiplies, typename _Dom1::value_type>::result_type> std::operator(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 407 | _DEFINE_EXPR_BINARY_OPERATOR(, struct std::multiplies) | ^~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘_Float32’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: candidate: ‘template std::_Expr<std::detail::_BinClos<std::multiplies, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::fun<std::multiplies, typename _Dom1::value_type>::result_type> std::operator(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray&)’ 407 | _DEFINE_EXPR_BINARY_OPERATOR(, struct std::multiplies) | ^~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: ‘std::complex’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: candidate: ‘template std::_Expr<std::__detail::_BinClos<std::multiplies, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::fun<std::multiplies, typename _Dom1::value_type>::result_type> std::operator(const valarray&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 407 | _DEFINE_EXPR_BINARY_OPERATOR(, struct std::multiplies) | ^~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘_Float32’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/valarray:1192:1: note: candidate: ‘template std::_Expr<std::__detail::_BinClos<std::multiplies, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::fun<std::multiplies, _Tp>::result_type> std::operator(const valarray<_Tp>&, const valarray<_Tp>&)’ 1192 | _DEFINE_BINARY_OPERATOR(, multiplies) | ^~~~~~~ /usr/include/c++/13/valarray:1192:1: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: ‘std::complex’ is not derived from ‘const std::valarray<_Tp>’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 * (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/valarray:1192:1: note: candidate: ‘template std::_Expr<std::detail::_BinClos<std::multiplies, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::fun<std::multiplies, _Tp>::result_type> std::operator(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)’ 1192 | _DEFINE_BINARY_OPERATOR(, multiplies) | ^~~~~~~ /usr/include/c++/13/valarray:1192:1: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: ‘std::complex’ is not derived from ‘const std::valarray<_Tp>’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/valarray:1192:1: note: candidate: ‘template std::_Expr<std::__detail::_BinClos<std::multiplies, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::fun<std::__multiplies, _Tp>::result_type> std::operator(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)’ 1192 | _DEFINE_BINARY_OPERATOR(, __multiplies) | ^~~~~~~ /usr/include/c++/13/valarray:1192:1: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: mismatched types ‘const std::valarray<_Tp>’ and ‘_Float32’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ In file included from /home//sdr-scanner/sources/utils.h:8: /usr/include/c++/13/complex:395:5: note: candidate: ‘template std::complex<_Tp> std::operator(const complex<_Tp>&, const complex<_Tp>&)’ 395 | operator(const complex<_Tp>& x, const complex<_Tp>& y) | ^~~~ /usr/include/c++/13/complex:395:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: mismatched types ‘const std::complex<_Tp>’ and ‘_Float32’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/complex:404:5: note: candidate: ‘template std::complex<_Tp> std::operator(const complex<_Tp>&, const _Tp&)’ 404 | operator*(const complex<_Tp>& x, const _Tp& y) | ^~~~ /usr/include/c++/13/complex:404:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: deduced conflicting types for parameter ‘const _Tp’ (‘float’ and ‘_Float32’) 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ /usr/include/c++/13/complex:413:5: note: candidate: ‘template std::complex<_Tp> std::operator(const _Tp&, const complex<_Tp>&)’ 413 | operator(const _Tp& __x, const complex<_Tp>& __y) | ^~~~ /usr/include/c++/13/complex:413:5: note: template argument deduction/substitution failed: /home//sdr-scanner/sources/utils.cpp:76:60: note: mismatched types ‘const std::complex<_Tp>’ and ‘_Float32’ 76 | const auto f = std::complex(0.0f, -1.0f) 2.0f M_PIf32 (static_cast(-frequencyOffset) / static_cast(sampleRate)); | ^~~ cc1plus: all warnings being treated as errors gmake[2]: [CMakeFiles/auto_sdr_libs.dir/build.make:412: CMakeFiles/auto_sdr_libs.dir/sources/utils.cpp.o] Error 1 gmake[2]: Waiting for unfinished jobs.... gmake[1]: [CMakeFiles/Makefile2:87: CMakeFiles/auto_sdr_libs.dir/all] Error 2 gmake: [Makefile:136: all] Error 2 `

aqbifzl commented 10 months ago

I had very similar issue. Try after my pull request (https://github.com/shajen/rtl-sdr-scanner-cpp/pull/77) and lmk if it also resolved your problem

Zotter commented 8 months ago

In my case, I solved things by setting up a dedicated Debian box and installed via Docker - it's now working and not on my main machine - turned out for the better after all. Thanks!