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

1.6 doesn't build on Ubuntu 22.04 #23

Open
isenberg opened this issue Dec 22, 2022 · 1 comment
Open

1.6 doesn't build on Ubuntu 22.04 #23

isenberg opened this issue Dec 22, 2022 · 1 comment

Comments

@isenberg
Copy link

Directly from source current release 1.6 fails to build on Ubuntu 22.04 LTS. But with some small changes, see git diff below, it works fine now.

apt install libboost-system-dev libboost-program-options-dev libboost-thread-dev libboost-tools-dev libboost-filesystem-dev libboost-test-dev libminiupnpc-dev libcrypto++-utils libssl-dev
./configure LDFLAGS=-L/home/marscoin/bdb/lib CPPFLAGS='-I/home/marscoin/bdb/include -Wno-deprecated-declarations' --prefix=/home/marscoin/marscoin
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 5b70b0fc..37f20c81 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -28,7 +28,7 @@ struct SeedSpec6 {
  */
 
 //! Convert the pnSeeds6 array into usable address objects.
-static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count)
+static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *_data, unsigned int count)
 {
     // It'll only connect to one or two seed nodes because once it connects,
     // it'll get a pile of addresses with newer timestamps.
@@ -38,8 +38,8 @@ static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data
     for (unsigned int i = 0; i < count; i++)
     {
         struct in6_addr ip;
-        memcpy(&ip, data[i].addr, sizeof(ip));
-        CAddress addr(CService(ip, data[i].port));
+        memcpy(&ip, _data[i].addr, sizeof(ip));
+        CAddress addr(CService(ip, _data[i].port));
         addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
         vSeedsOut.push_back(addr);
     }
@@ -85,7 +85,7 @@ static Checkpoints::MapCheckpoints mapCheckpoints =
         (   1441300, uint256("0x4bc8927cd924346ac2e93110ad5d1df74a2ef490988882adfea2e6adb05c041d"))
         (   1441951, uint256("0x664a617ee047402b8066c7da73b25884297f00a71d44445b7acbfb6681272885"))
         ;
-static const Checkpoints::CCheckpointData data = {
+static const Checkpoints::CCheckpointData Data = {
         &mapCheckpoints,
         1626561170, // * UNIX timestamp of last checkpoint block
         1653867,   // * total number of transactions between genesis and last checkpoint
@@ -195,7 +195,7 @@ public:
 
     const Checkpoints::CCheckpointData& Checkpoints() const 
     {
-        return data;
+        return Data;
     }
 };
 static CMainParams mainParams;
@@ -333,7 +333,7 @@ public:
     const Checkpoints::CCheckpointData& Checkpoints() const 
     {
         // UnitTest share the same checkpoints as MAIN
-        return data;
+        return Data;
     }
 
     //! Published setters to allow changing values in unit test cases
diff --git a/src/db.cpp b/src/db.cpp
index 12650e45..053e87b6 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -73,9 +73,9 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
     boost::this_thread::interruption_point();
 
     path = pathIn;
-    filesystem::path pathLogDir = path / "database";
+    boost::filesystem::path pathLogDir = path / "database";
     TryCreateDirectory(pathLogDir);
-    filesystem::path pathErrorFile = path / "db.log";
+    boost::filesystem::path pathErrorFile = path / "db.log";
     LogPrintf("CDBEnv::Open : LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
 
     unsigned int nEnvFlags = 0;
diff --git a/src/ecwrapper.cpp b/src/ecwrapper.cpp
index 1f776cc2..24e91dc2 100644
--- a/src/ecwrapper.cpp
+++ b/src/ecwrapper.cpp
@@ -67,7 +67,7 @@ int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned ch
     if (!BN_bin2bn(msg, msglen, e)) { ret=-1; goto err; }
     if (8*msglen > n) BN_rshift(e, e, 8-(n & 7));
     zero = BN_CTX_get(ctx);
-    if (!BN_zero(zero)) { ret=-1; goto err; }
+    BN_zero(zero);
     if (!BN_mod_sub(e, zero, e, order, ctx)) { ret=-1; goto err; }
     rr = BN_CTX_get(ctx);
      ECDSA_SIG_get0(ecsig, (const BIGNUM **)&s, 0);
diff --git a/src/init.cpp b/src/init.cpp
index 64d342a6..b16bb23a 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -458,12 +458,12 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
     }
 
     // hardcoded $DATADIR/bootstrap.dat
-    filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
-    if (filesystem::exists(pathBootstrap)) {
+    boost::filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat";
+    if (boost::filesystem::exists(pathBootstrap)) {
         FILE *file = fopen(pathBootstrap.string().c_str(), "rb");
         if (file) {
             CImportingNow imp;
-            filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
+	    boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
             LogPrintf("Importing bootstrap.dat...\n");
             LoadExternalBlockFile(file);
             RenameOver(pathBootstrap, pathBootstrapOld);
@@ -854,7 +854,7 @@ bool AppInit2(boost::thread_group& threadGroup)
                 return false;
         }
 
-        if (filesystem::exists(GetDataDir() / strWalletFile))
+        if (boost::filesystem::exists(GetDataDir() / strWalletFile))
         {
             CDBEnv::VerifyResult r = bitdb.Verify(strWalletFile, CWalletDB::Recover);
             if (r == CDBEnv::RECOVER_OK)
@@ -975,20 +975,20 @@ bool AppInit2(boost::thread_group& threadGroup)
     fReindex = GetBoolArg("-reindex", false);
 
     // Upgrading to 0.8; hard-link the old blknnnn.dat files into /blocks/
-    filesystem::path blocksDir = GetDataDir() / "blocks";
-    if (!filesystem::exists(blocksDir))
+    boost::filesystem::path blocksDir = GetDataDir() / "blocks";
+    if (!boost::filesystem::exists(blocksDir))
     {
-        filesystem::create_directories(blocksDir);
+	boost::filesystem::create_directories(blocksDir);
         bool linked = false;
         for (unsigned int i = 1; i < 10000; i++) {
-            filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
-            if (!filesystem::exists(source)) break;
-            filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
+            boost::filesystem::path source = GetDataDir() / strprintf("blk%04u.dat", i);
+            if (!boost::filesystem::exists(source)) break;
+	    boost::filesystem::path dest = blocksDir / strprintf("blk%05u.dat", i-1);
             try {
-                filesystem::create_hard_link(source, dest);
+		boost::filesystem::create_hard_link(source, dest);
                 LogPrintf("Hardlinked %s -> %s\n", source.string(), dest.string());
                 linked = true;
-            } catch (filesystem::filesystem_error & e) {
+            } catch (boost::filesystem::filesystem_error & e) {
                 // Note: hardlink creation failing is not a disaster, it just means
                 // blocks will get re-downloaded from peers.
                 LogPrintf("Error hardlinking blk%04u.dat : %s\n", i, e.what());
diff --git a/src/main.cpp b/src/main.cpp
index cba8c2f7..1a367d75 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2890,7 +2890,7 @@ bool AbortNode(const std::string &strMessage, const std::string &userMessage) {
 
 bool CheckDiskSpace(uint64_t nAdditionalBytes)
 {
-    uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
+    uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
 
     // Check for nMinDiskSpace bytes (currently 50MB)
     if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index b06ec123..68bb8578 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -600,14 +600,14 @@ void StartRPCThreads()
     {
         rpc_ssl_context->set_options(ssl::context::no_sslv2 | ssl::context::no_sslv3);
 
-        filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
-        if (!pathCertFile.is_complete()) pathCertFile = filesystem::path(GetDataDir()) / pathCertFile;
-        if (filesystem::exists(pathCertFile)) rpc_ssl_context->use_certificate_chain_file(pathCertFile.string());
+	boost::filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
+        if (!pathCertFile.is_complete()) pathCertFile = boost::filesystem::path(GetDataDir()) / pathCertFile;
+        if (boost::filesystem::exists(pathCertFile)) rpc_ssl_context->use_certificate_chain_file(pathCertFile.string());
         else LogPrintf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string());
 
-        filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
-        if (!pathPKFile.is_complete()) pathPKFile = filesystem::path(GetDataDir()) / pathPKFile;
-        if (filesystem::exists(pathPKFile)) rpc_ssl_context->use_private_key_file(pathPKFile.string(), ssl::context::pem);
+	boost::filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
+        if (!pathPKFile.is_complete()) pathPKFile = boost::filesystem::path(GetDataDir()) / pathPKFile;
+        if (boost::filesystem::exists(pathPKFile)) rpc_ssl_context->use_private_key_file(pathPKFile.string(), ssl::context::pem);
         else LogPrintf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string());
 
         string strCiphers = GetArg("-rpcsslciphers", "TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH");
diff --git a/src/walletdb.cpp b/src/walletdb.cpp
index 1c1cd3e6..38c02e89 100644
--- a/src/walletdb.cpp
+++ b/src/walletdb.cpp
@@ -865,20 +865,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
                 bitdb.mapFileUseCount.erase(wallet.strWalletFile);
 
                 // Copy wallet.dat
-                filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
-                filesystem::path pathDest(strDest);
-                if (filesystem::is_directory(pathDest))
+		boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
+		boost::filesystem::path pathDest(strDest);
+                if (boost::filesystem::is_directory(pathDest))
                     pathDest /= wallet.strWalletFile;
 
                 try {
 #if BOOST_VERSION >= 104000
-                    filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
+		    boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists);
 #else
-                    filesystem::copy_file(pathSrc, pathDest);
+		    boost::filesystem::copy_file(pathSrc, pathDest);
 #endif
                     LogPrintf("copied wallet.dat to %s\n", pathDest.string());
                     return true;
-                } catch(const filesystem::filesystem_error &e) {
+                } catch(const boost::filesystem::filesystem_error &e) {
                     LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what());
                     return false;
                 }
@novalis78
Copy link
Contributor

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

No branches or pull requests

2 participants