pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
109 stars 26 forks source link

FreeBSD 13 build broken #216

Closed metacreo closed 1 year ago

metacreo commented 2 years ago
# git clone https://github.com/pocketnetteam/pocketnet.core.git pocketnet

# cd pocketnet/
# ./autogen.sh
# ./configure --disable-wallet

config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  If GNU make was not used, consider
    re-running the configure script with MAKE="gmake" (or whatever is
    necessary).  You can also try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details

# ./configure --disable-wallet MAKE="gmake"

Options used to compile and link:
  with wallet   = no
  with gui / qt = no
  with zmq      = yes
  with test     = no
  with bench    = yes
  with upnp     = yes
  use asm       = yes
  sanitizers    =
  debug enabled = no
  gprof enabled = no
  werror        = no

  target os     =
  build os      =

  CC            = gcc
  CFLAGS        = -g -O2
  CPPFLAGS      = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = g++ -std=c++17
  CXXFLAGS      = -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough -g -O2
  LDFLAGS       = -pthread  -Wl,-z,relro -Wl,-z,now -pie
  ARFLAGS       = cr

# gmake

  CXX      rpc/libpocketcoin_server_a-blockchain.o
In file included from ./wallet/walletdb.h:11,
                 from ./wallet/wallet.h:22,
                 from rpc/blockchain.cpp:23:
./wallet/db.h:23:10: fatal error: db_cxx.h: No such file or directory
   23 | #include <db_cxx.h>
      |          ^~~~~~~~~~
compilation terminated.
gmake[2]: *** [Makefile:7090: rpc/libpocketcoin_server_a-blockchain.o] Error 1
gmake[2]: Leaving directory '/opt/TMP/pocketnet/src'
gmake[1]: *** [Makefile:11234: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/TMP/pocketnet/src'
gmake: *** [Makefile:778: all-recursive] Error 1
#

FreeBSD 13.0-RELEASE-p4 #0: Tue Aug 24 07:33:27 UTC 2021 

# ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include -I/usr/local/include/db5" MAKE="gmake"

libtool: link: ar cru .libs/libsqlite3.a  libsqlite3_la-sqlite3.o
libtool: link: ranlib .libs/libsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libsqlite3.la" && ln -s "../libsqlite3.la" "libsqlite3.la" )
gmake[3]: Leaving directory '/opt/TMP/pocketnet/src/sqlite'
  CXXLD    pocketcoind
/usr/local/bin/ld: cannot find -ldb_cxx-4.8
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:4805: pocketcoind] Error 1
gmake[2]: Leaving directory '/opt/TMP/pocketnet/src'
gmake[1]: *** [Makefile:11234: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/TMP/pocketnet/src'
gmake: *** [Makefile:778: all-recursive] Error 1

DB5 Installed

andyoknen commented 2 years ago

@metacreo Try configure with --with-incompatible-bdb

metacreo commented 2 years ago
# gmake clean
# ./autogen.sh
# ./configure --with-incompatible-bdb --with-gui=no --disable-tests --disable-wallet MAKE=gmake
# gmake -j4
In file included from pocketcoind.cpp:15:
In file included from httpserver.cpp:5:
In file included from ./httpserver.h:20:
In file included from ./init.h:15:
...
In file included from init.cpp:12:
In file included from ./init.h:15:
./statistic.hpp:180:23: error: call to member function 'pushKV' is ambiguous
                value.pushKV("TimestampProcess", sample.TimestampEnd.count() - sample.TimestampBegin.count());
38 warnings and 5 errors generated.
gmake[2]: *** [Makefile:7095: libpocketcoin_server_a-init.o] Error 1
gmake[2]: Leaving directory '/opt/TMP/pocketnet/src'
gmake[1]: *** [Makefile:11720: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/TMP/pocketnet/src'
gmake: *** [Makefile:778: all-recursive] Error 1
andyoknen commented 2 years ago

Oh, apparently the compiler features, maybe try without MAKE="gmake" but with --disable-dependency-tracking?

metacreo commented 2 years ago
# gmake clean
# setenv BDB_PREFIX '/opt/TMP/pocketnet/db4'
# ./autogen.sh
# ./configure --with-incompatible-bdb --with-gui=no --disable-tests --disable-wallet --disable-dependency-tracking
Options used to compile and link:
  with wallet   = no
  with gui / qt = no
  with zmq      = yes
  with test     = no
  with bench    = yes
  with upnp     = yes
  use asm       = yes
  sanitizers    =
  debug enabled = no
  gprof enabled = no
  werror        = no

  target os     =
  build os      =

  CC            = gcc
  CFLAGS        = -g -O2
  CPPFLAGS      =   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = g++ -std=c++17
  CXXFLAGS      =   -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough   -g -O2
  LDFLAGS       = -pthread  -Wl,-z,relro -Wl,-z,now -pie
  ARFLAGS       = cr
# gmake -j4
Making all in src
gmake[1]: Entering directory '/opt/TMP/pocketnet/src'
gmake[2]: Entering directory '/opt/TMP/pocketnet/src'
  CXX      pocketcoind-pocketcoind.o
  CXX      libpocketcoin_server_a-addrdb.o
  CXX      libpocketcoin_server_a-addrman.o
  CXX      libpocketcoin_server_a-bloom.o
  CXX      libpocketcoin_server_a-blockencodings.o
  CXX      libpocketcoin_server_a-blockfilter.o
  CXX      libpocketcoin_server_a-chain.o
  CXX      libpocketcoin_server_a-checkpoints.o
  CXX      consensus/libpocketcoin_server_a-tx_verify.o
consensus/tx_verify.cpp: In function 'bool Consensus::CheckTxInputs(const CTransaction&, CValidationState&, const CCoinsViewCache&, int, CAmount&, const CChainParams&)':
consensus/tx_verify.cpp:224:26: warning: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Wsign-compare]
  224 |         if (nSpendHeight > chainparams.GetConsensus().nHeight_version_1_0_0 && coin.IsPocketTX() && nSpendHeight - coin.nHeight < POCKETNET_MATURITY) {
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CXX      libpocketcoin_server_a-httprpc.o
  CXX      libpocketcoin_server_a-httpserver.o
  CXX      index/libpocketcoin_server_a-base.o
  CXX      index/libpocketcoin_server_a-txindex.o
In file included from httpserver.cpp:5:
./httpserver.h: In constructor 'HTTPSocket::HTTPSocket(event_base*, int, int, bool)':
./httpserver.h:288:58: warning: 'HTTPSocket::m_workQueue' will be initialized after [-Wreorder]
  288 |     std::shared_ptr<Queue<std::unique_ptr<HTTPClosure>>> m_workQueue;
      |                                                          ^~~~~~~~~~~
./httpserver.h:284:10: warning:   'bool HTTPSocket::m_publicAccess' [-Wreorder]
  284 |     bool m_publicAccess;
      |          ^~~~~~~~~~~~~~
httpserver.cpp:540:1: warning:   when initialized here [-Wreorder]
  540 | HTTPSocket::HTTPSocket(struct event_base *base, int timeout, int queueDepth, bool publicAccess):
      | ^~~~~~~~~~
  CXX      interfaces/libpocketcoin_server_a-handler.o
  CXX      interfaces/libpocketcoin_server_a-node.o
  CXX      libpocketcoin_server_a-init.o
  CXX      ldb/libpocketcoin_server_a-ldb.o
  CXX      libpocketcoin_server_a-dbwrapper.o
  CXX      libpocketcoin_server_a-merkleblock.o
  CXX      libpocketcoin_server_a-miner.o
  CXX      libpocketcoin_server_a-net.o
  CXX      libpocketcoin_server_a-net_processing.o
  CXX      libpocketcoin_server_a-noui.o
  CXX      libpocketcoin_server_a-outputtype.o
  CXX      policy/libpocketcoin_server_a-fees.o
  CXX      policy/libpocketcoin_server_a-policy.o
  CXX      policy/libpocketcoin_server_a-rbf.o
  CXX      libpocketcoin_server_a-pos.o
  CXX      libpocketcoin_server_a-pow.o
  CXX      libpocketcoin_server_a-rest.o
  CXX      rpc/libpocketcoin_server_a-blockchain.o
In file included from ./wallet/walletdb.h:11,
                 from ./wallet/wallet.h:22,
                 from rpc/blockchain.cpp:23:
./wallet/db.h:23:10: fatal error: db_cxx.h: No such file or directory
   23 | #include <db_cxx.h>
      |          ^~~~~~~~~~
compilation terminated.
gmake[2]: *** [Makefile:7309: rpc/libpocketcoin_server_a-blockchain.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from rest.cpp:13:
./pos.h:34:20: warning: 'bool GetLastStakeModifier(const CBlockIndex*, uint64_t&, int64_t&)' declared 'static' but never defined [-Wunused-function]
   34 | inline static bool GetLastStakeModifier(const CBlockIndex* pindex, uint64_t& nStakeModifier, int64_t& nModifierTime);
      |                    ^~~~~~~~~~~~~~~~~~~~
./pos.h:44:23: warning: 'int64_t GetStakeModifierSelectionIntervalSection(int)' declared 'static' but never defined [-Wunused-function]
   44 | inline static int64_t GetStakeModifierSelectionIntervalSection(int nSection);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pos.h:46:23: warning: 'int64_t GetStakeModifierSelectionInterval()' declared 'static' but never defined [-Wunused-function]
   46 | inline static int64_t GetStakeModifierSelectionInterval();
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./pos.h:48:20: warning: 'bool SelectBlockFromCandidates(std::vector<std::pair<long int, uint256> >&, std::map<uint256, const CBlockIndex*>&, int64_t, uint64_t, const CBlockIndex**)' declared 'static' but never defined [-Wunused-function]
   48 | inline static bool SelectBlockFromCandidates(std::vector<std::pair<int64_t, uint256> >& vSortedByTimestamp, std::map<uint256, const CBlockIndex*>& mapSelectedBlocks,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
rest.cpp:126:38: warning: 'std::tuple<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > TryGetParamStr(std::vector<std::__cxx11::basic_string<char> >&, int)' defined but not used [-Wunused-function]
  126 | static std::tuple<bool, std::string> TryGetParamStr(std::vector <std::string>& uriParts, int index)
      |                                      ^~~~~~~~~~~~~~
gmake[2]: Leaving directory '/opt/TMP/pocketnet/src'
gmake[1]: *** [Makefile:11720: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/TMP/pocketnet/src'
gmake: *** [Makefile:778: all-recursive] Error 1
metacreo commented 2 years ago
# gmake clean
# chmod +x ./contrib/install_db4.sh
# ./contrib/install_db4.sh `pwd`
# setenv BDB_PREFIX '/opt/TMP/pocketnet/db4'
# ./autogen.sh
# ./configure --with-gui=no --disable-tests --disable-dependency-tracking BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
Options used to compile and link:
  with wallet   = yes
  with gui / qt = no
  with zmq      = yes
  with test     = no
  with bench    = yes
  with upnp     = yes
  use asm       = yes
  sanitizers    =
  debug enabled = no
  gprof enabled = no
  werror        = no

  target os     =
  build os      =

  CC            = gcc
  CFLAGS        = -g -O2
  CPPFLAGS      =   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = g++ -std=c++17
  CXXFLAGS      =   -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough   -g -O2
  LDFLAGS       = -pthread  -Wl,-z,relro -Wl,-z,now -pie
  ARFLAGS       = cr
  CXX      bench/bench_pocketcoin-rollingbloom.o
  CXX      bench/bench_pocketcoin-verify_script.o
  CXX      bench/bench_pocketcoin-nanobench.o
  CXX      crypto/libpocketcoinconsensus_la-aes.lo
  CXX      crypto/libpocketcoinconsensus_la-chacha20.lo
  CXX      crypto/libpocketcoinconsensus_la-hmac_sha256.lo
  CXX      crypto/libpocketcoinconsensus_la-hmac_sha512.lo
  CXX      crypto/libpocketcoinconsensus_la-ripemd160.lo
  CXX      crypto/libpocketcoinconsensus_la-sha1.lo
  CXX      crypto/libpocketcoinconsensus_la-sha256.lo
  CXX      crypto/libpocketcoinconsensus_la-sha512.lo
  CXX      crypto/libpocketcoinconsensus_la-sha256_sse4.lo
  CXX      libpocketcoinconsensus_la-arith_uint256.lo
  CXX      consensus/libpocketcoinconsensus_la-merkle.lo
  CXX      libpocketcoinconsensus_la-hash.lo
  CXX      primitives/libpocketcoinconsensus_la-block.lo
  CXX      primitives/libpocketcoinconsensus_la-transaction.lo
  CXX      libpocketcoinconsensus_la-pubkey.lo
  CXX      script/libpocketcoinconsensus_la-pocketcoinconsensus.lo
  CXX      script/libpocketcoinconsensus_la-interpreter.lo
  CXX      script/libpocketcoinconsensus_la-script.lo
  CXX      script/libpocketcoinconsensus_la-script_error.lo
  CXX      libpocketcoinconsensus_la-uint256.lo
  CXX      libpocketcoinconsensus_la-utilstrencodings.lo
  AR       libpocketcoin_server.a
  AR       libpocketcoin_wallet.a
  AR       libpocketcoin_common.a
  CXX      libpocketcoin_util_a-clientversion.o
  AR       libpocketcoin_zmq.a
  AR       libpocketcoin_consensus.a
  AR       crypto/libpocketcoin_crypto_base.a
  AR       crypto/libpocketcoin_crypto_sse41.a
  AR       crypto/libpocketcoin_crypto_avx2.a
  AR       crypto/libpocketcoin_crypto_shani.a
  AR       leveldb/libleveldb.a
  AR       leveldb/libleveldb_sse42.a
  AR       leveldb/libmemenv.a
  AR       libpocketcoin_cli.a
  CXX      bench/bench_pocketcoin-checkblock.o
  CXXLD    libpocketcoinconsensus.la
  AR       libpocketcoin_util.a
  CXXLD    pocketcoin-cli
  CXXLD    pocketcoin-tx
/usr/local/bin/ld: /usr/local/bin/ld: libpocketcoin_util.a(libpocketcoin_util_a-util.o): in function `SetupEnvironment()':
/opt/TMP/pocketnet/src/util.cpp:1211: undefined reference to `boost::filesystem::path::imbue(std::locale const&)'
/usr/local/bin/ld: /opt/TMP/pocketnet/src/util.cpp:1212: undefined reference to `boost::filesystem::path::imbue(std::locale const&)'
libpocketcoin_util.a(libpocketcoin_util_a-util.o): in function `SetupEnvironment()':
/opt/TMP/pocketnet/src/util.cpp:1211: undefined reference to `boost::filesystem::path::imbue(std::locale const&)'
/usr/local/bin/ld: /opt/TMP/pocketnet/src/util.cpp:1212: undefined reference to `boost::filesystem::path::imbue(std::locale const&)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:4996: pocketcoin-tx] Error 1
gmake[2]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:4992: pocketcoin-cli] Error 1
gmake[2]: Leaving directory '/opt/TMP/pocketnet/src'
gmake[1]: *** [Makefile:11720: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/TMP/pocketnet/src'
gmake: *** [Makefile:778: all-recursive] Error 1
metacreo commented 2 years ago

# pkg info | grep boost boost-docs-1.72.0 Documentation for libraries from boost.org boost-jam-1.72.0 Build tool from the boost.org boost-libs-1.72.0_6 Free portable C++ libraries (without Boost.Python) boost_build-4.3.0.20201229 Extensible cross-platform build tool suite

andyoknen commented 2 years ago

I have no way to test freebsd - maybe it will help? https://stackoverflow.com/questions/35007134/c-boost-undefined-reference-to-boostfilesystemdetailcopy-file

metacreo commented 2 years ago

So ... build success with no errors but small src modification needed. I just compared bitcoind and pocketnet sources and found solution. src/util.cpp SetupEnvironment lines 1212, 1213 commented

# ./pocketcoind --help
Segmentation fault (core dumped)
# ldd pocketcoind
pocketcoind:
        libz.so.6 => /lib/libz.so.6 (0x801dea000)
        libthr.so.3 => /lib/libthr.so.3 (0x801e06000)
        libboost_system.so.1.72.0 => /usr/local/lib/libboost_system.so.1.72.0 (0x801e33000)
        libboost_filesystem.so.1.72.0 => /usr/local/lib/libboost_filesystem.so.1.72.0 (0x801e37000)
        libboost_thread.so.1.72.0 => /usr/local/lib/libboost_thread.so.1.72.0 (0x801e54000)
        libboost_chrono.so.1.72.0 => /usr/local/lib/libboost_chrono.so.1.72.0 (0x801e6e000)
        libcrypto.so.11 => /usr/local/lib/libcrypto.so.11 (0x801e79000)
        libminiupnpc.so.17 => /usr/local/lib/libminiupnpc.so.17 (0x80216f000)
        libevent_pthreads-2.1.so.7 => /usr/local/lib/libevent_pthreads-2.1.so.7 (0x80217f000)
        libevent-2.1.so.7 => /usr/local/lib/libevent-2.1.so.7 (0x802184000)
        libzmq.so.5 => /usr/local/lib/libzmq.so.5 (0x8021da000)
        libstdc++.so.6 => /usr/local/lib/gcc10/libstdc++.so.6 (0x80228c000)
        libm.so.5 => /lib/libm.so.5 (0x802673000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8026a6000)
        libc.so.7 => /lib/libc.so.7 (0x8026bf000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x802ad0000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x802ba2000)
        librt.so.1 => /usr/lib/librt.so.1 (0x802bc5000)
        libpgm-5.2.so.0 => /usr/local/lib/libpgm-5.2.so.0 (0x802bce000)
        libnorm.so.1 => /usr/local/lib/libnorm.so.1 (0x802c1e000)
andyoknen commented 2 years ago

We are preparing a big update - version 0.21.0 - at the moment, the main innovation is the synchronization of the code with the current versions of bitcoin. Maybe it will be more compliant with FreeBSD?

lostystyg commented 2 years ago

@metacreo you can try to launch with gdb: gdb ./pocketcoind and then start. When you catch segfault, call frame to get the place and bt to get the call stack

andyoknen commented 1 year ago

@metacreo Is the issue still relevant?