Bitcoin Forum
May 28, 2024, 10:21:17 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Windows Cross-Compiling of a Bitcoin 0.21 Fork  (Read 127 times)
DiLuvio (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
February 25, 2021, 09:26:38 AM
 #1

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?
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
February 26, 2021, 12:14:19 PM
Last edit: November 15, 2023, 12:08:35 AM by HCP
Merited by ABCbits (1), Heisenberg_Hunter (1)
 #2

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__
};

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DiLuvio (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
February 28, 2021, 03:21:46 PM
 #3

Huh, I did not actually user the posix compiler but the default win 32 one, I'll try it now, thank you very much
DiLuvio (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
February 28, 2021, 06:41:30 PM
 #4

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
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6823


bitcoincleanup.com / bitmixlist.org


View Profile WWW
February 28, 2021, 07:35:26 PM
 #5

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
February 28, 2021, 11:39:58 PM
 #6

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


█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DiLuvio (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
March 01, 2021, 09:37:39 AM
 #7

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
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6823


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 01, 2021, 09:51:15 AM
 #8

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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
March 01, 2021, 09:22:05 PM
 #9

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://bitcointalk.org/index.php?topic=5309100.msg56085433#msg56085433

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

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DiLuvio (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
March 02, 2021, 08:08:19 AM
 #10

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://bitcointalk.org/index.php?topic=5309100.msg56085433#msg56085433

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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!