edollar-project / edollar

BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

compilation error in cryptonote_core.cpp:784:5 at master and release branches #2

Closed khunpoum closed 6 years ago

khunpoum commented 6 years ago

OS: Ubuntu 17.10 Branch: master and release-v0.1.0.0 also

apt install -y build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libminiupnpc-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev libgtest-dev doxygen graphviz

sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/

mkdir ~/edollarcash
cd ~/edollarcash
wget https://github.com/edollar-project/edollar/archive/release-v0.1.0.0.zip
unzip release-v0.1.0.0.zip
cd edollar-release-v0.1.0.0

make
...
...
[ 73%] Building CXX object src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/cryptonote_core.cpp.o
/root/edollarcash/edollar/src/cryptonote_core/cryptonote_core.cpp: In member function ‘size_t cryptonote::core::get_block_sync_size(uint64_t) const’:
/root/edollarcash/edollar/src/cryptonote_core/cryptonote_core.cpp:784:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
     if (block_sync_size > 0)
     ^~
/root/edollarcash/edollar/src/cryptonote_core/cryptonote_core.cpp:786:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
       return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT;
       ^~~~~~
cc1plus: all warnings being treated as errors
src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/build.make:86: recipe for target 'src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/cryptonote_core.cpp.o' failed
make[3]: *** [src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/cryptonote_core.cpp.o] Error 1
make[3]: Leaving directory '/root/edollarcash/edollar/build/release'
CMakeFiles/Makefile2:1167: recipe for target 'src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/all' failed
make[2]: *** [src/cryptonote_core/CMakeFiles/obj_cryptonote_core.dir/all] Error 2
make[2]: Leaving directory '/root/edollarcash/edollar/build/release'
Makefile:140: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/root/edollarcash/edollar/build/release'
Makefile:62: recipe for target 'release-all' failed
make: *** [release-all] Error 2

OS:

#uname -a
Linux srvgate 4.13.0-25-generic #29-Ubuntu SMP Mon Jan 8 21:14:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
NAME="Ubuntu"
VERSION="17.10 (Artful Aardvark)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 17.10"
VERSION_ID="17.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=artful
UBUNTU_CODENAME=artful
edollar-project commented 6 years ago

It seems that you are using GCC version >=6. A new warning -Wmisleading-indentation was added to -Wall, warning about places where the indentation of the code might mislead a human reader about the control flow, so these line of code will emit warning if (block_sync_size > 0) return block_sync_size; return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; Because all warnings being treated as errors, the compilation failed. We will fix this issue. in the meantime, could you disable the -Wmisleading-indentation flag by add the following line in CMakeLists.txt set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation)