Skip to content

Commit 3321588

Browse files
committed
Fix Windows, macOS builds and .deb dependencies
- Guard boost::placeholders with BOOST_VERSION >= 107300 so the code compiles with both old (1.59 from depends) and new Boost. - Switch macOS to depends-based build (like Windows) so it uses Boost 1.59 instead of Homebrew's incompatible Boost 1.90. - Replace hardcoded .deb Depends with dpkg-shlibdeps auto-detection so the package installs on any Debian/Ubuntu version.
1 parent d83ff1d commit 3321588

10 files changed

Lines changed: 174 additions & 41 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ jobs:
1616
run: |
1717
sudo apt-get update
1818
sudo apt-get install -y build-essential libtool autotools-dev autoconf \
19-
pkg-config libssl-dev libboost-all-dev \
20-
libdb5.3-dev libdb5.3++-dev \
21-
libminiupnpc-dev libzmq3-dev libevent-dev
19+
pkg-config bsdmainutils curl python3
20+
21+
- name: Build depends
22+
run: make -C depends HOST=x86_64-linux-gnu NO_QT=1 -j$(nproc)
2223

2324
- name: Build
2425
run: |
2526
./autogen.sh
26-
./configure --without-gui --with-incompatible-bdb --disable-zmq
27+
CONFIG_SITE=$PWD/depends/x86_64-linux-gnu/share/config.site ./configure --prefix=/ --without-gui --disable-zmq
2728
make -j$(nproc)
2829
strip src/faircoind src/faircoin-cli src/faircoin-tx
2930
@@ -50,15 +51,16 @@ jobs:
5051
run: |
5152
sudo apt-get update
5253
sudo apt-get install -y build-essential libtool autotools-dev autoconf \
53-
pkg-config libssl-dev libboost-all-dev \
54-
libdb5.3-dev libdb5.3++-dev \
55-
libminiupnpc-dev libzmq3-dev libevent-dev \
54+
pkg-config bsdmainutils curl python3 \
5655
dpkg-dev fakeroot
5756
57+
- name: Build depends
58+
run: make -C depends HOST=x86_64-linux-gnu NO_QT=1 -j$(nproc)
59+
5860
- name: Build
5961
run: |
6062
./autogen.sh
61-
./configure --without-gui --with-incompatible-bdb --disable-zmq
63+
CONFIG_SITE=$PWD/depends/x86_64-linux-gnu/share/config.site ./configure --prefix=/ --without-gui --disable-zmq
6264
make -j$(nproc)
6365
strip src/faircoind src/faircoin-cli src/faircoin-tx
6466
@@ -74,14 +76,14 @@ jobs:
7476
# Docs
7577
cp COPYING README.md doc/GENERATE-KEYS.md $PKG/usr/share/doc/faircoin/
7678
77-
# Control file
79+
# Control file (statically linked — only libc6 needed)
7880
cat > $PKG/DEBIAN/control <<EOF
7981
Package: faircoin
8082
Version: ${VERSION}
8183
Section: net
8284
Priority: optional
8385
Architecture: amd64
84-
Depends: libc6, libssl3, libboost-system1.74.0 | libboost-system1.83.0, libboost-filesystem1.74.0 | libboost-filesystem1.83.0, libboost-thread1.74.0 | libboost-thread1.83.0, libboost-program-options1.74.0 | libboost-program-options1.83.0, libboost-chrono1.74.0 | libboost-chrono1.83.0, libdb5.3++, libminiupnpc17, libevent-2.1-7
86+
Depends: libc6
8587
Maintainer: FairCoin Official <contact@fairco.in>
8688
Description: FairCoin cryptocurrency daemon and CLI
8789
FairCoin is a cryptocurrency with masternodes, coin mixing,

src/ecwrapper.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
#include <openssl/bn.h>
1111
#include <openssl/ecdsa.h>
1212
#include <openssl/obj_mac.h>
13+
#include <openssl/opensslv.h>
14+
15+
// OpenSSL 1.1.0+ made ECDSA_SIG opaque; provide compat shims for older versions
16+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
17+
static void ECDSA_SIG_get0(const ECDSA_SIG* sig, const BIGNUM** pr, const BIGNUM** ps)
18+
{
19+
if (pr) *pr = sig->r;
20+
if (ps) *ps = sig->s;
21+
}
22+
static int ECDSA_SIG_set0(ECDSA_SIG* sig, BIGNUM* r, BIGNUM* s)
23+
{
24+
if (!r || !s) return 0;
25+
BN_clear_free(sig->r);
26+
BN_clear_free(sig->s);
27+
sig->r = r;
28+
sig->s = s;
29+
return 1;
30+
}
31+
#endif
1332

1433
namespace
1534
{

src/faircoin-cli.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "utilstrencodings.h"
1414

1515
#include <boost/filesystem/operations.hpp>
16+
#include <boost/version.hpp>
1617

1718
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
1819

@@ -108,7 +109,11 @@ Object CallRPC(const string& strMethod, const Array& params)
108109

109110
// Connect to localhost
110111
bool fUseSSL = GetBoolArg("-rpcssl", false);
112+
#if BOOST_VERSION >= 108700
113+
boost::asio::io_context io_service;
114+
#else
111115
asio::io_service io_service;
116+
#endif
112117
ssl::context context(ssl::context::sslv23);
113118
context.set_options(ssl::context::no_sslv2 | ssl::context::no_sslv3);
114119
asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context);

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <boost/filesystem/fstream.hpp>
3737
#include <boost/lexical_cast.hpp>
3838
#include <boost/thread.hpp>
39+
#include <boost/version.hpp>
3940

4041
using namespace boost;
4142
using namespace std;
@@ -204,7 +205,9 @@ struct CMainSignals {
204205

205206
void RegisterValidationInterface(CValidationInterface* pwalletIn)
206207
{
208+
#if BOOST_VERSION >= 107300
207209
using namespace boost::placeholders;
210+
#endif
208211
g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2));
209212
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
210213
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
@@ -215,7 +218,9 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn)
215218

216219
void UnregisterValidationInterface(CValidationInterface* pwalletIn)
217220
{
221+
#if BOOST_VERSION >= 107300
218222
using namespace boost::placeholders;
223+
#endif
219224
g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
220225
g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn));
221226
g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));

src/obfuscation.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
5555
if (pfrom->nVersion < ActiveProtocol()) {
5656
errorID = ERR_VERSION;
5757
LogPrintf("dsa -- incompatible version! \n");
58-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
58+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
5959

6060
return;
6161
}
6262

6363
if (!fMasterNode) {
6464
errorID = ERR_NOT_A_MN;
6565
LogPrintf("dsa -- not a Masternode! \n");
66-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
66+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
6767

6868
return;
6969
}
@@ -75,7 +75,7 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
7575
CMasternode* pmn = mnodeman.Find(activeMasternode.vin);
7676
if (pmn == NULL) {
7777
errorID = ERR_MN_LIST;
78-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
78+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
7979
return;
8080
}
8181

@@ -84,18 +84,18 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
8484
pmn->nLastDsq + mnodeman.CountEnabled(ActiveProtocol()) / 5 > mnodeman.nDsqCount) {
8585
LogPrintf("dsa -- last dsq too recent, must wait. %s \n", pfrom->addr.ToString());
8686
errorID = ERR_RECENT;
87-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
87+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
8888
return;
8989
}
9090
}
9191

9292
if (!IsCompatibleWithSession(nDenom, txCollateral, errorID)) {
9393
LogPrintf("dsa -- not compatible with existing transactions! \n");
94-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
94+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
9595
return;
9696
} else {
9797
LogPrintf("dsa -- is compatible, please submit! \n");
98-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, errorID);
98+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_ACCEPTED, errorID);
9999
return;
100100
}
101101

@@ -159,15 +159,15 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
159159
if (pfrom->nVersion < ActiveProtocol()) {
160160
LogPrintf("dsi -- incompatible version! \n");
161161
errorID = ERR_VERSION;
162-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
162+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
163163

164164
return;
165165
}
166166

167167
if (!fMasterNode) {
168168
LogPrintf("dsi -- not a Masternode! \n");
169169
errorID = ERR_NOT_A_MN;
170-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
170+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
171171

172172
return;
173173
}
@@ -182,15 +182,15 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
182182
if (!IsSessionReady()) {
183183
LogPrintf("dsi -- session not complete! \n");
184184
errorID = ERR_SESSION;
185-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
185+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
186186
return;
187187
}
188188

189189
//do we have the same denominations as the current session?
190190
if (!IsCompatibleWithEntries(out)) {
191191
LogPrintf("dsi -- not compatible with existing transactions! \n");
192192
errorID = ERR_EXISTING_TX;
193-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
193+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
194194
return;
195195
}
196196

@@ -210,13 +210,13 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
210210
if (o.scriptPubKey.size() != 25) {
211211
LogPrintf("dsi - non-standard pubkey detected! %s\n", o.scriptPubKey.ToString());
212212
errorID = ERR_NON_STANDARD_PUBKEY;
213-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
213+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
214214
return;
215215
}
216216
if (!o.scriptPubKey.IsNormalPaymentScript()) {
217217
LogPrintf("dsi - invalid script! %s\n", o.scriptPubKey.ToString());
218218
errorID = ERR_INVALID_SCRIPT;
219-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
219+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
220220
return;
221221
}
222222
}
@@ -240,21 +240,21 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
240240
if (nValueIn > OBFUSCATION_POOL_MAX) {
241241
LogPrintf("dsi -- more than Obfuscation pool max! %s\n", tx.ToString());
242242
errorID = ERR_MAXIMUM;
243-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
243+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
244244
return;
245245
}
246246

247247
if (!missingTx) {
248248
if (nValueIn - nValueOut > nValueIn * .01) {
249249
LogPrintf("dsi -- fees are too high! %s\n", tx.ToString());
250250
errorID = ERR_FEES;
251-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
251+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
252252
return;
253253
}
254254
} else {
255255
LogPrintf("dsi -- missing input tx! %s\n", tx.ToString());
256256
errorID = ERR_MISSING_TX;
257-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
257+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
258258
return;
259259
}
260260

@@ -263,19 +263,19 @@ void CObfuscationPool::ProcessMessageObfuscation(CNode* pfrom, std::string& strC
263263
if (!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL, false, true)) {
264264
LogPrintf("dsi -- transaction not valid! \n");
265265
errorID = ERR_INVALID_TX;
266-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
266+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
267267
return;
268268
}
269269
}
270270
}
271271

272272
if (AddEntry(in, nAmount, txCollateral, out, errorID)) {
273-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED, errorID);
273+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_ACCEPTED, errorID);
274274
Check();
275275

276276
RelayStatus(sessionID, GetState(), GetEntriesCount(), MASTERNODE_RESET);
277277
} else {
278-
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
278+
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), (int)MASTERNODE_REJECTED, errorID);
279279
}
280280

281281
} else if (strCommand == "dssu") { //Obfuscation status update

src/rpcprotocol.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <boost/asio/ssl.hpp>
1111
#include <boost/iostreams/concepts.hpp>
1212
#include <boost/iostreams/stream.hpp>
13+
#include <boost/version.hpp>
1314
#include <list>
1415
#include <map>
1516
#include <stdint.h>
@@ -110,19 +111,33 @@ class SSLIOStreamDevice : public boost::iostreams::device<boost::iostreams::bidi
110111
bool connect(const std::string& server, const std::string& port)
111112
{
112113
using namespace boost::asio::ip;
114+
#if BOOST_VERSION >= 108700
115+
tcp::resolver resolver(stream.get_executor());
116+
boost::system::error_code resolve_ec;
117+
auto results = resolver.resolve(server, port, resolve_ec);
118+
if (resolve_ec)
119+
return false;
120+
boost::system::error_code error = boost::asio::error::host_not_found;
121+
for (const auto& entry : results) {
122+
stream.lowest_layer().close();
123+
stream.lowest_layer().connect(entry, error);
124+
if (!error)
125+
break;
126+
}
127+
#else
128+
#if BOOST_VERSION >= 106600
113129
tcp::resolver resolver(static_cast<boost::asio::io_service&>(stream.get_executor().context()));
130+
#else
131+
tcp::resolver resolver(stream.get_io_service());
132+
#endif
114133
tcp::resolver::iterator endpoint_iterator;
115134
#if BOOST_VERSION >= 104300
116135
try {
117136
#endif
118-
// The default query (flags address_configured) tries IPv6 if
119-
// non-localhost IPv6 configured, and IPv4 if non-localhost IPv4
120-
// configured.
121137
tcp::resolver::query query(server.c_str(), port.c_str());
122138
endpoint_iterator = resolver.resolve(query);
123139
#if BOOST_VERSION >= 104300
124140
} catch (boost::system::system_error& e) {
125-
// If we at first don't succeed, try blanket lookup (IPv4+IPv6 independent of configured interfaces)
126141
tcp::resolver::query query(server.c_str(), port.c_str(), resolver_query_base::flags());
127142
endpoint_iterator = resolver.resolve(query);
128143
}
@@ -133,6 +148,7 @@ class SSLIOStreamDevice : public boost::iostreams::device<boost::iostreams::bidi
133148
stream.lowest_layer().close();
134149
stream.lowest_layer().connect(*endpoint_iterator++, error);
135150
}
151+
#endif
136152
if (error)
137153
return false;
138154
return true;

0 commit comments

Comments
 (0)