bitcoinjs / fast-dat-parser

Superfast blockchain parser for stats
MIT License
74 stars 26 forks source link

Ubuntu 16.04 make error #11

Closed scriptzteam closed 5 years ago

scriptzteam commented 6 years ago
g++ -pedantic -std=c++1z -W -Wall -Wcast-qual -Wconversion -Werror -Wextra -Wwrite-strings -O3 -Iinclude -MMD -MP -c src/bestchain.cpp -o src/bestchain.o
In file included from src/bestchain.cpp:10:0:
include/serial.hpp: In function ‘auto serial::peek(const R&)’:
include/serial.hpp:17:48: error: expected ‘,’ before ‘)’ token
   static_assert(std::is_same<T, uint8_t>::value);
                                                ^
include/serial.hpp:17:48: error: expected string-literal before ‘)’ token
include/serial.hpp:18:43: error: expected ‘,’ before ‘)’ token
   static_assert(sizeof(E) % sizeof(T) == 0);
                                           ^
include/serial.hpp:18:43: error: expected string-literal before ‘)’ token
include/serial.hpp: In function ‘void serial::place(R&, E)’:
include/serial.hpp:40:48: error: expected ‘,’ before ‘)’ token
   static_assert(std::is_same<T, uint8_t>::value);
                                                ^
include/serial.hpp:40:48: error: expected string-literal before ‘)’ token
include/serial.hpp:41:43: error: expected ‘,’ before ‘)’ token
   static_assert(sizeof(E) % sizeof(T) == 0);
                                           ^
include/serial.hpp:41:43: error: expected string-literal before ‘)’ token
Makefile:27: recipe for target 'src/bestchain.o' failed
make: *** [src/bestchain.o] Error 1
dcousens commented 6 years ago

What version g++?

scriptzteam commented 6 years ago
g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

:)

dcousens commented 6 years ago
~$ g++ --version
g++ (GCC) 7.2.1 20171128
Copyright (C) 2017 Free Software Foundation, Inc.

static_assert ( bool_constexpr , message ) |   | (since C++11) static_assert ( bool_constexpr ) |   | (since C++17)

Probably a syntax error as C++17 has message optional, and your g++ version doesn't have C++17 support.

A PR is welcome to add a message in there to enable your compiler support :+1:

dcousens commented 6 years ago

Resolved in master, see https://github.com/bitcoinjs/fast-dat-parser/issues/12, and https://github.com/dcousens/ranger/commit/aa3b7712b4d080df420e342eef416a65de3d5eaf

Voelundr commented 6 years ago

g++ -pedantic -std=c++1z -W -Wall -Wcast-qual -Wconversion -Werror -Wextra -Wwrite-strings -O3 -Iinclude -MMD -MP -c src/parser.cpp -o src/parser.o In file included from include/hash.hpp:8:0, from include/bitcoin.hpp:9, from src/parser.cpp:9: include/ranger.hpp: In instantiation of ‘void ranger::Range::put(E) [with E = ranger::Range<const char>; I = unsigned char]’: include/bitcoin.hpp:251:44: required from ‘void putASM(R&, const R&) [with R = ranger::Range<unsigned char*>]’ src/statistics.hpp:110:11: required from ‘void dumpASM::operator()(const Block&) [with Block = BlockBase<ranger::Range<unsigned char> >]’ src/parser.cpp:145:1: required from here include/ranger.hpp:86:32: error: no matching function for call to ‘put(__ranger::Range<unsigned char>&, ranger::Range<const char*>&)’ void put (E e) { ranger::put(*this, e); }


include/ranger.hpp:23:6: note: candidate: void __ranger::put(R&, typename R::value_type) [with R = __ranger::Range<unsigned char*>; typename R::value_type = unsigned char]
void put (R& r, typename R::value_type e) {
^~~
include/ranger.hpp:23:6: note:   no known conversion for argument 2 from ‘__ranger::Range<const char*>’ to ‘__ranger::Range<unsigned char*>::value_type {aka unsigned char}’
include/ranger.hpp:36:6: note: candidate: template<class R, class E, class V> void __ranger::put(R&, E)
void put (R& r, E e) {
^~~
include/ranger.hpp:36:6: note:   template argument deduction/substitution failed:
include/ranger.hpp:31:2: error: no type named ‘type’ in ‘struct std::enable_if<false, __ranger::Range<const char*> >’
typename V = typename std::enable_if<
^~~~~~~~
In file included from include/bitcoin.hpp:9:0,
from src/parser.cpp:9:
include/hash.hpp:58:7: error: ‘auto {anonymous}::toHexBE(const uint256_t&)’ defined but not used [-Werror=unused-function]
auto toHexBE (const uint256_t& hash) {
^~~~~~~
cc1plus: all warnings being treated as errors
Makefile:28: recipe for target 'src/parser.o' failed
make: *** [src/parser.o] Error 1
Voelundr commented 6 years ago

Update from g++ 7.2.0 to g++ 7.3.0 Now the Errors are:

g++ -pedantic -std=c++1z -W -Wall -Wcast-qual -Wconversion -Werror -Wextra -Wwrite-strings -O3 -Iinclude -MMD -MP -c src/parser.cpp -o src/parser.o In file included from include/hash.hpp:8:0, from include/bitcoin.hpp:9, from src/parser.cpp:9: include/ranger.hpp: In instantiation of ‘void ranger::Range::put(E) [with E = ranger::Range<const char>; I = unsigned char]’: include/bitcoin.hpp:251:44: required from ‘void putASM(R&, const R&) [with R = ranger::Range<unsigned char*>]’ src/statistics.hpp:110:11: required from ‘void dumpASM::operator()(const Block&) [with Block = BlockBase<ranger::Range<unsigned char> >]’ src/parser.cpp:145:1: required from here include/ranger.hpp:86:32: error: no matching function for call to ‘put(__ranger::Range<unsigned char>&, ranger::Range<const char*>&)’ void put (E e) { ranger::put(*this, e); }


include/ranger.hpp:23:6: note: candidate: void __ranger::put(R&, typename R::value_type) [with R = __ranger::Range<unsigned char*>; typename R::value_type = unsigned char]
void put (R& r, typename R::value_type e) {
^~~
include/ranger.hpp:23:6: note:   no known conversion for argument 2 from ‘__ranger::Range<const char*>’ to ‘__ranger::Range<unsigned char*>::value_type {aka unsigned char}’
include/ranger.hpp:36:6: note: candidate: template<class R, class E, class V> void __ranger::put(R&, E)
void put (R& r, E e) {
^~~
include/ranger.hpp:36:6: note:   template argument deduction/substitution failed:
include/ranger.hpp:31:2: error: no type named ‘type’ in ‘struct std::enable_if<false, __ranger::Range<const char*> >’
typename V = typename std::enable_if<
^~~~~~~~
In file included from include/bitcoin.hpp:9:0,
from src/parser.cpp:9:
include/hash.hpp:58:7: error: ‘auto {anonymous}::toHexBE(const uint256_t&)’ defined but not used [-Werror=unused-function]
auto toHexBE (const uint256_t& hash) {
^~~~~~~
cc1plus: all warnings being treated as errors
Makefile:28: recipe for target 'src/parser.o' failed
make: *** [src/parser.o] Error 1
369pie commented 6 years ago

i got the error, too . gcc 7.3

dcousens commented 6 years ago

@efvhi you are building from master?

dcousens commented 6 years ago

Can reproduce... will fix

scriptzteam commented 6 years ago

Great cant wait for it :)

noolua commented 5 years ago

On ubuntu 16.04 with g++ 5.4.0, try this

diff --git a/Makefile b/Makefile
index ebe06fe..3e5f32a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CXX=g++
-CFLAGS=-pedantic -std=c++1z -W -Wall -Wcast-qual -Wconversion -Werror -Wextra -Wwrite-strings
+CFLAGS=-pedantic -std=c++1z -W -Wall -Wcast-qual -Wconversion -Wextra -Wwrite-strings
 #OFLAGS=-O3 -ggdb3
 OFLAGS=-O3
 LFLAGS=-lcrypto
diff --git a/include/ranger.hpp b/include/ranger.hpp
index fceceb8..f71df28 100644
--- a/include/ranger.hpp
+++ b/include/ranger.hpp
@@ -149,7 +149,8 @@ auto ptr_range (R& r) {
        return __ranger::Range<pointer>(r.data(), r.data() + r.size());
 }

-inline auto zstr_range (const char* z) {
+inline auto zstr_range (const char* z_) {
+       auto z = reinterpret_cast<const unsigned char*>(z_);
        using pointer = decltype(z);

        auto r = z;
diff --git a/src/parser.cpp b/src/parser.cpp
index 48af06b..dbe4c7c 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -15,6 +15,11 @@
 #include "statistics.hpp"
 // #include "leveldb.hpp"

+#ifndef __cpp_if_constexpr
+template <typename Block>
+constexpr decltype(dumpUnspents<Block>::BLANK_TXIN) dumpUnspents<Block>::BLANK_TXIN;
+#endif
+
 using backing_vector_t = std::vector<uint8_t>;
 using block_t = decltype(Block(ptr_range(backing_vector_t()), ptr_range(backing_vector_t())));
 using thread_function_t = std::function<void(void)>;
dcousens commented 5 years ago