Author

Topic: Windows Cross-Compiling of a Bitcoin 0.21 Fork (Read 138 times)

newbie
Activity: 9
Merit: 0
Unless you have some way of bundling a bitcoin.conf file with your installer... then it is something that needs to be manually created. Bitcoin Core doesn't create a bitcoin.conf when it is installed.

I created my own "altcoin" (basically Bitcoin code with some minor edits) a while back when I was trying to help BlackHatCoiner when they were attempting to do the same... Now it seems that BlackHatCoiner has created a nice little tutorial with the basics covered: https://bitcointalksearch.org/topic/m.56085433

As you can see, he mentions the fixed IP addresses in chainparams.cpp and the vSeeds/vFixedSeeds etc... So, modification of those in chainparams.cpp and replacing the values in chainparamsseed.cpp should allow you to create your own "fixed" seeds without requiring addnode entries in bitcoin.conf file.

Note: that if you simply delete the lines and use vFixedSeeds.clear() as per his tutorial, you won't have any seeds and will need to use addnode


I did follow that guide, and also 4 different ones, it makes sense now i will give it a try, thank you very much
HCP
legendary
Activity: 2086
Merit: 4361
Unless you have some way of bundling a bitcoin.conf file with your installer... then it is something that needs to be manually created. Bitcoin Core doesn't create a bitcoin.conf when it is installed.

I created my own "altcoin" (basically Bitcoin code with some minor edits) a while back when I was trying to help BlackHatCoiner when they were attempting to do the same... Now it seems that BlackHatCoiner has created a nice little tutorial with the basics covered: https://bitcointalksearch.org/topic/m.56085433

As you can see, he mentions the fixed IP addresses in chainparams.cpp and the vSeeds/vFixedSeeds etc... So, modification of those in chainparams.cpp and replacing the values in chainparamsseed.cpp should allow you to create your own "fixed" seeds without requiring addnode entries in bitcoin.conf file.

Note: that if you simply delete the lines and use vFixedSeeds.clear() as per his tutorial, you won't have any seeds and will need to use addnode
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Another thing:
do you have any idea on how to preset the bitcoin.conf node before compiling the QT? both on windows and linux, cuz i have to set them manually, or is enough to add in chainparamsseed.cpp the DNS of the node in HEX and than add  them also on vSeeds in the chain I'm using in chainparams.cpp

As far as I know, that is not possible without going inside AppInitMain() in init.cpp and injecting arguments into node.args directly.
newbie
Activity: 9
Merit: 0
The instructions in build-windows.md seem to work OK... I didn't need to do any "scouring" Tongue it was basically as simple as setup WSL, install Ubuntu 18.04 in WSL, copy/paste the commands from the readme to the terminal.

Additionally, there are notes on how to build using Visual Studio here: https://github.com/bitcoin/bitcoin/blob/master/build_msvc/README.md

I just didn't do it that way because I don't have VS installed Tongue



As you said, was pretty simple to build it, i just missed the part in which i had to choose the posix compiler on Mingw64, i achieved also to compile it throught VS so is not a big deal, i don't think asweel any "scouring" is needed, just follow the docs step by step and will be fine.

Another thing:
do you have any idea on how to preset the bitcoin.conf node before compiling the QT? both on windows and linux, cuz i have to set them manually, or is enough to add in chainparamsseed.cpp the DNS of the node in HEX and than add  them also on vSeeds in the chain I'm using in chainparams.cpp
HCP
legendary
Activity: 2086
Merit: 4361
The instructions in build-windows.md seem to work OK... I didn't need to do any "scouring" Tongue it was basically as simple as setup WSL, install Ubuntu 18.04 in WSL, copy/paste the commands from the readme to the terminal.

Additionally, there are notes on how to build using Visual Studio here: https://github.com/bitcoin/bitcoin/blob/master/build_msvc/README.md

I just didn't do it that way because I don't have VS installed Tongue

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Given that Bitcoin Core compilation on Windows has to be done using a posix compiler and not visual studio, does anyone else think that making some kind of bootstrap script that downloads and installs MinGW libraries and maybe even MinGW & MSYS2 themselves would be merged into Github? This is so that you don't have to go scouring for Windows-specific dependencies just to build Bitcoin Core.
newbie
Activity: 9
Merit: 0
Quote
When you say "fork"... did you actually make any edits at all to the source code? or did you simply clone the github repo and then attempt to compile it? Huh

i actually tried to rebrand the bitcoin core node, i re-mined the genesis block for main/test/regtest block chain, i achieved to compile everything on linux, creating a new blockchain, i would like to build my own altcoin, that's why i started with the basics reading the documentation, but i got stuck there and you helped me a lot, now i'm running 2 full nodes, i just need to learn how to configure the bitcoin.conf before the compile, and to create a modded cpuminer that allows to mine it based on a yimpp pool
newbie
Activity: 9
Merit: 0
Huh, I did not actually user the posix compiler but the default win 32 one, I'll try it now, thank you very much
HCP
legendary
Activity: 2086
Merit: 4361
i tried to fork the bitcoin 0.21 and to compile it throught WSL and Ubuntu 18.04TLS.
When you say "fork"... did you actually make any edits at all to the source code? or did you simply clone the github repo and then attempt to compile it? Huh


EDIT:

I actually just now installed WSL(2)... Ubuntu 18.04... cloned the bitcoin repo then followed the steps here: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md

It compiled without issue...



When you did this part:
Quote
Ubuntu Bionic 18.041:
Code:
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.

Did you actually select the option that says "posix"? Huh



I ask because the footnote attached to that command mentions issues with std::mutex... which is also on line 57 in threadsafety.h:
1: Starting from Ubuntu Xenial 16.04, both the 32 and 64 bit Mingw-w64 packages install two different compiler options to allow a choice between either posix or win32 threads. The default option is win32 threads which is the more efficient since it will result in binary code that links directly with the Windows kernel32.lib. Unfortunately, the headers required to support win32 threads conflict with some of the classes in the C++11 standard library, in particular std::mutex. It's not possible to build the Bitcoin Core code using the win32 version of the Mingw-w64 cross compilers (at least not without modifying headers in the Bitcoin Core source code).

and:
Code: (https://github.com/bitcoin/bitcoin/blob/master/src/threadsafety.h#L55-L66)
// StdMutex provides an annotated version of std::mutex for us,
// and should only be used when sync.h Mutex/LOCK/etc are not usable.
class LOCKABLE StdMutex : public std::mutex
{
public:
#ifdef __clang__
    //! For negative capabilities in the Clang Thread Safety Analysis.
    //! A negative requirement uses the EXCLUSIVE_LOCKS_REQUIRED attribute, in conjunction
    //! with the ! operator, to indicate that a mutex should not be held.
    const StdMutex& operator!() const { return *this; }
#endif // __clang__
};
newbie
Activity: 9
Merit: 0
Hello CryptoWorld,
i tried to fork the bitcoin 0.21 and to compile it throught WSL and Ubuntu 18.04TLS.
i followed the full doc/build.windows but when i run
Code:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status" # Disable WSL support for Win32 applications.
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=$PWD/depends/x86_64-w64-mingw32/
make
sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status"

it just trow me an error compiling the bitcoind on line 21:
Code:
In file included from ./logging.h:11:0,
                 from ./util/system.h:21,
                 from bitcoind.cpp:21:
./threadsafety.h:58:1: error: expected class-name before ‘{’ token
 {

and as you know in the threadsecurity.h on line 57 the class is well definited.

Is in here someone able to give me a good advice?
Jump to: