Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 16.04 make error #11

Closed
scriptzteam opened this issue Dec 23, 2017 · 12 comments
Closed

Ubuntu 16.04 make error #11

scriptzteam opened this issue Dec 23, 2017 · 12 comments
Assignees
Labels

Comments

@scriptzteam
Copy link

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
Copy link
Contributor

What version g++?

@scriptzteam
Copy link
Author

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

:)

@dcousens
Copy link
Contributor

dcousens commented Dec 28, 2017

~$ 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 👍

@dcousens dcousens closed this as completed Feb 1, 2018
@dcousens dcousens reopened this Feb 1, 2018
@dcousens dcousens added bug and removed question labels Feb 1, 2018
@dcousens
Copy link
Contributor

dcousens commented May 22, 2018

Resolved in master, see #12, and dcousens/ranger@aa3b771

@dcousens dcousens self-assigned this May 22, 2018
@Voelundr
Copy link

Voelundr commented Jul 5, 2018

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
Copy link

Voelundr commented Jul 5, 2018

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
Copy link

369pie commented Jul 11, 2018

i got the error, too . gcc 7.3

@dcousens dcousens reopened this Jul 24, 2018
@dcousens
Copy link
Contributor

@efvhi you are building from master?

@dcousens
Copy link
Contributor

Can reproduce... will fix

@scriptzteam
Copy link
Author

Great cant wait for it :)

@noolua
Copy link

noolua commented Aug 27, 2018

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
Copy link
Contributor

Duplicate of #15 - which is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants