cryptonotefoundation / cryptonote

CryptoNote protocol implementation. This is the reference repository for starting a new CryptoNote currency. See /src/cryptonote_config.h
https://cryptonote.org/
991 stars 6.1k forks source link

Mac OS Compile error #318

Open iamjustaJohn opened 5 years ago

iamjustaJohn commented 5 years ago

Just forked this project and managed to compile for Windows and Linux. I'm trying on Mac OS and even added the changes this pull request says.

I am getting this error: [ 30%] Building CXX object src/CMakeFiles/Logging.dir/Logging/LoggerManager.cpp.o In file included from /Users/jj/Desktop/crypto/src/Logging/LoggerManager.cpp:5: In file included from /Users/jj/Desktop/crypto/src/Logging/LoggerManager.h:7: In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/list:178: /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2335:5: error: delete called on non-final 'Logging::CommonLogger' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor] delete __ptr; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2648:7: note: in instantiation of member function 'std::__1::default_delete<Logging::CommonLogger>::operator()' requested here __ptr_.second()(__tmp); ^ /Users/jj/Desktop/crypto/src/Logging/LoggerManager.cpp:73:18: note: in instantiation of member function 'std::__1::unique_ptr<Logging::CommonLogger, std::__1::default_delete<Logging::CommonLogger> >::reset' requested here logger.reset(new ConsoleLogger(level)); ^ 1 error generated. make[3]: *** [src/CMakeFiles/Logging.dir/Logging/LoggerManager.cpp.o] Error 1 make[2]: *** [src/CMakeFiles/Logging.dir/all] Error 2 make[1]: *** [all] Error 2 make: *** [build-release] Error 2

I believe the GCC version is ok:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

But if it's not I also tried with gcc@8

Using built-in specs. COLLECT_GCC=/usr/local/bin/gcc-8 COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@8/8.3.0/libexec/gcc/x86_64-apple-darwin18/8.3.0/lto-wrapper Target: x86_64-apple-darwin18 Configured with: ../configure --build=x86_64-apple-darwin18 --prefix=/usr/local/Cellar/gcc@8/8.3.0 --libdir=/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 8.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk Thread model: posix gcc version 8.3.0 (Homebrew GCC 8.3.0)

And I'm totally getting another error:

[  2%] Building C object external/miniupnpc/CMakeFiles/upnpc-static.dir/upnpc.c.o
In file included from /usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:425,
                 from /Users/jj/Desktop/crypto/external/miniupnpc/upnpc.c:8:
/Users/jj/Desktop/crypto/external/miniupnpc/upnpc.c: In function 'main':
/Users/jj/Desktop/crypto/external/miniupnpc/upnpc.c:130:22: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Werror=format-truncation=]
   snprintf(index, 6, "%d", i);
                      ^~~~
/Users/jj/Desktop/crypto/external/miniupnpc/upnpc.c:130:22: note: directive argument in the range [0, 2147483647]
/Users/jj/Desktop/crypto/external/miniupnpc/upnpc.c:130:3: note: '__builtin_snprintf' output between 2 and 11 bytes into a destination of size 6
   snprintf(index, 6, "%d", i);
   ^~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [external/miniupnpc/CMakeFiles/upnpc-static.dir/upnpc.c.o] Error 1
make[2]: *** [external/miniupnpc/CMakeFiles/upnpc-static.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [build-release] Error 2
iamjustaJohn commented 4 years ago

@iamjustaJohn I'm getting the same error. Have you found a solution?

You can fork Turtlecoin to solve the problem. It's a compatibility error so needs to be reprogrammed with latest libraries. If I remember well, I reinstalled my macos and forced it to use clang. I am sorry as I don't remember personally what I did to fix it. I'll try to search for it and come with an update if I find it.