teamswipp / swippcore

The Swipp core includes the QT wallet and the console daemon for the currency.
Other
9 stars 7 forks source link

QT build fails under OSX #11

Closed bumbacoin closed 5 years ago

bumbacoin commented 5 years ago

resulting error is

`In file included from ../src/net.cpp:7: In file included from ../src/init.h:10: In file included from ../src/wallet.h:10: In file included from ../src/walletdb.h:11: In file included from ../src/db.h:10: In file included from ../src/serialize.h:11: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:702:71: error: invalid operands to binary expression ('const ComparableVersion' and 'const ComparableVersion') bool operator()(const _T1& __x, const _T1& y) const {return x < __y;}


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/list:2210:13: note: in instantiation of member function 'std::__1::__less<ComparableVersion, ComparableVersion>::operator()' requested here
        if (__comp(*--__e2, *__f1))
            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/list:2196:5: note: in instantiation of function template specialization 'std::__1::list<ComparableVersion, std::__1::allocator<ComparableVersion> >::__sort<std::__1::__less<ComparableVersion, ComparableVersion> >' requested here
    __sort(begin(), end(), base::__sz(), __comp);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/list:2187:5: note: in instantiation of function template specialization 'std::__1::list<ComparableVersion, std::__1::allocator<ComparableVersion> >::sort<std::__1::__less<ComparableVersion, ComparableVersion> >' requested here
    sort(__less<value_type>());
    ^
../src/net.cpp:2111:14: note: in instantiation of member function 'std::__1::list<ComparableVersion, std::__1::allocator<ComparableVersion> >::sort' requested here
    versions.sort();
             ^
../src/version.h:81:10: note: candidate function not viable: 'this' argument has type 'const ComparableVersion', but method is not marked const
    bool operator < (const ComparableVersion& other)
         ^
../src/uint256.h:482:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const base_uint160' (aka 'const base_uint<160>') for 1st argument
inline bool operator<(const base_uint160& a, const uint160& b)          { return (base_uint160)a <  (base_uint160)b; }
            ^
../src/uint256.h:494:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint160' for 1st argument
inline bool operator<(const uint160& a, const base_uint160& b)          { return (base_uint160)a <  (base_uint160)b; }
            ^
../src/uint256.h:506:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint160' for 1st argument
inline bool operator<(const uint160& a, const uint160& b)               { return (base_uint160)a <  (base_uint160)b; }
            ^
../src/uint256.h:597:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const base_uint256' (aka 'const base_uint<256>') for 1st argument
inline bool operator<(const base_uint256& a, const uint256& b)          { return (base_uint256)a <  (base_uint256)b; }
            ^
../src/uint256.h:609:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint256' for 1st argument
inline bool operator<(const uint256& a, const base_uint256& b)          { return (base_uint256)a <  (base_uint256)b; }
            ^
../src/uint256.h:621:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint256' for 1st argument
inline bool operator<(const uint256& a, const uint256& b)               { return (base_uint256)a <  (base_uint256)b; }
            ^
../src/uint256.h:722:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const base_uint512' (aka 'const base_uint<512>') for 1st argument
inline bool operator<(const base_uint512& a, const uint512& b)          { return (base_uint512)a <  (base_uint512)b; }
            ^
../src/uint256.h:734:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint512' for 1st argument
inline bool operator<(const uint512& a, const base_uint512& b)          { return (base_uint512)a <  (base_uint512)b; }
            ^
../src/uint256.h:746:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const uint512' for 1st argument
inline bool operator<(const uint512& a, const uint512& b)               { return (base_uint512)a <  (base_uint512)b; }
            ^
../src/bignum.h:778:13: note: candidate function not viable: no known conversion from 'const ComparableVersion' to 'const CBigNum' for 1st argument
inline bool operator<(const CBigNum& a, const CBigNum& b)  { return (BN_cmp(&a, &b) < 0); }
            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:424:1: note: candidate template ignored: could not match 'pair<type-parameter-0-0, type-parameter-0-1>' against 'const ComparableVersion'
operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:592:1: note: candidate template ignored: could not match 'reverse_iterator<type-parameter-0-0>' against 'const ComparableVersion'
operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:996:1: note: candidate template ignored: could not match 'move_iterator<type-parameter-0-0>' against 'const ComparableVersion'
operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1312:1: note: candidate template ignored: could not match '__wrap_iter<type-parameter-0-0>' against 'const ComparableVersion'
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:953:1: note: candidate template ignored: could not match 'tuple<type-parameter-0-0...>' against 'const ComparableVersion'
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2917:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'const ComparableVersion'
operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2975:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'const ComparableVersion'
operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2984:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'const ComparableVersion'
operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4774:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const ComparableVersion'
operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4839:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const ComparableVersion'
operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4847:1: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const ComparableVersion'
operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
1 error generated.
make: *** [build/net.o] Error 1`
teamswipp commented 5 years ago

@bumbacoin The Swipp code base requires a C++11 compatible compiler. I think the error you are getting is caused by either the compiler not supporting C++11 or -std=c++11 missing as a compiler flag.

Try adding -std=c++11 to macx:QMAKE_CXXFLAGS and see if that makes any difference.

bumbacoin commented 5 years ago

it's already set in the .pro https://github.com/teamswipp/swippcore/blob/master/swipp.pro#L16

commenting this line allows it to be built https://github.com/teamswipp/swippcore/blob/0b64c6f9491ea16914c43186ba0c1aa8ef391955/src/net.cpp#L2021

static std::list<ComparableVersion> parse_releases(std::string result)
{
    std::regex version_regex("<title>[-A-Za-z ]*([0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+)?)[-A-Za-z)( ]*</title>");
    std::sregex_iterator iter(result.begin(), result.end(), version_regex);
    std::sregex_iterator end;
    std::list<ComparableVersion> versions;

    while(iter != end)
    {
        versions.push_back(ComparableVersion((*iter)[1]));
        ++iter;
    }

//    versions.sort();
    return versions;
}
teamswipp commented 5 years ago

@bumbacoin It also completely breaks the behavior of this function.

I can see the compiler is completely confused. Which compiler and version is this ?

bumbacoin commented 5 years ago
$ clang -v

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
teamswipp commented 5 years ago

Thank you @bumbacoin. I will look into this. One more question though, which SDK version are you running ?

teamswipp commented 5 years ago

The commits outlined in https://github.com/teamswipp/swippcore/compare/ae92590d8...master should now have fixed this particular issue. The source code now fully compiles with Clang.

Furthermore, we have a new build system under development that will allow you to cross compile all Swipp binaries on a Linux distribution, see https://github.com/teamswipp/swippcore-buildsystem for further details.

Closing.