Title: Building headless Crypto and Crypto-qt on Windows(MSYS2) Post by: DigitalCoinBRL on October 26, 2020, 09:02:08 PM This tutorial is based on the topic of our friend nitrogenetics (https://bitcointalk.org/index.php?action=profile;u=79058), which is found at the link (https://bitcointalk.org/index.php?topic=149479.1140).
System used in the tutorial: Windows 10 x64 / build 19042.746 / version 20H2 System Preparation 01 - Install Msys2 Shell: Download: https://www.msys2.org/ 02 - Update Msys2 After downloading and installing the program, run the msys2.exe application and run the following commands: Code: pacman -Syu As soon as the first update is performed, close and reopen msys2.exe. Run the commands: Code: pacman -Su Add the MinGW path to the system variables, being added to the PATH option of the operating system. In Windows 10 the path should look like the example below: 32BITS Code: C:\msys64\mingw32\bin 64BITS Code: C:\msys64\mingw64\bin Download, extract and build the dependencies: Create two dependency folders called deps_x86 and deps_x64 on disk C :. All dependencies will be installed inside these folders. 01 - Download and installation - OPENSSL 1.1.1h: Download the file below in the dependencies folder and open Msys2 MinGW 64-bit or Msys2 MinGW 32-bit according to the system choice for compilation https://www.openssl.org/source/openssl-1.1.1h.tar.gz Then enter the codes below in the command window that will open. 32BITS Code: cd /c/deps_x86/ 64BITS Code: cd /c/deps_x64/ 02 - Download and installation - Berkeley DB: Download the file below in the dependencies folder and open Msys2 MinGW 64-bit or Msys2 MinGW 32-bit according to the system choice for compilation http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz Then enter the codes below in the command window that will open. 32BITS Code: cd /c/deps_x86/ 64BITS Code: cd /c/deps_x64/ 03 - Download and install - 7-zip: Download: https://www.7-zip.org/download.html 04 - Download and install - Boost 1.65: Download and extract the folder in the dependencies directory. https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.zip Then open the Windows command prompt and enter the codes below. 32BITS Code: cd C:\deps_x86\boost_1_65_1\ 64BITS Code: cd C:\deps_x64\boost_1_65_1\ 05 - Download and installation - Miniupnpc: Download and extract the folder in the dependencies directory. http://miniupnp.free.fr/files/download.php?file=miniupnpc-2.1.tar.gz After extracting the files, rename the miniupnpc-2.1 folder to miniupnpc. Then open the Windows command prompt and enter the codes below. 32BITS Code: cd C:\deps_x86\miniupnpc 64BITS Code: cd C:\deps_x64\miniupnpc 06 - Download and installation - Protoc and Libprotobuf: Download and extract the folder in the dependencies directory. https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protobuf-all-3.7.0.zip Extract the files using 7-zip. Open Msys2 MinGW 64-bit. Then enter the codes below in the command window that will open. 32BITS Code: cd /c/deps_x86/ 64BITS Code: cd /c/deps_x64/ 07 - Download and install - Qrencode: Download the file below in the dependencies folder and open Msys2 MinGW 64-bit or Msys2 MinGW 32-bit according to the system choice for compilation http://download.sourceforge.net/libpng/libpng-1.6.36.tar.gz Then enter the codes below in the command window that will open. 32BITS Code: cd /c/deps_x86/ 64BITS Code: cd /c/deps_x64/ Download the file below in the dependencies folder and open Msys2 MinGW 64-bit or Msys2 MinGW 32-bit according to the system choice for compilation http://fukuchi.org/works/qrencode/qrencode-4.0.2.tar.gz Then enter the codes below in the command window that will open. 32BITS Code: cd /c/deps_x86/ 64BITS Code: cd /c/deps_x64/ 08 - Download and installation - Qt 5: Download QT OpenSource. https://download.qt.io/official_releases/qt/5.12/5.12.10/single/qt-everywhere-src-5.12.10.zip Extract the file using 7-zip. Rename the qt-everywhere-src-5.12.10 folder to 5.12.10. Create two folders called QT_x86 and QT_x64 on disk C :, copy folder 5.12.10 to the folders created earlier. Then open the Windows command prompt and enter the codes below. 32BITS Code: cd C:\Qt_x86\5.12.10 64BITS Code: cd C:\Qt_x64\5.12.10 Note¹: Consider using -j with mingw32-make to speed up compilation. QuadCore -j4 or -j5 processors have had good results. Note²: Dependency versions may vary depending on the currency being used. Title: Re: Building headless Crypto and Crypto-qt on Windows(MSYS2) Post by: DigitalCoinBRL on January 14, 2021, 05:24:42 PM Updated tutorial!
Title: Re: Building headless Crypto and Crypto-qt on Windows(MSYS2) Post by: NotATether on January 16, 2021, 09:53:51 AM I see that having download links to all the dependencies is useful in particular when trying to build the Berkeley DB part of Bitcoin Core yourself, because it's so ancient that newer versions of BDB are incompatible with anything bitcoin-related, at least from the projects I try odd to compile, and will generate linking errors during compilation.
So I thought it would be useful to have separate instructions for building BDB by itself on Linux. Code: pushd /tmp [1] Yes, you absolutely have to build Berkeley DB in this folder, otherwise it will spit out an error like this: Code: checking if building in the top-level or dist directories... yes [2] It installs it to /usr/local so that it does not conflict with any system-wise installation of Berkeley DB. Now to compile stuff with it just pass -I/usr/local/include -L/usr/local/lib -ldb to gcc. And then you run your program like this: Code: LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH program-name Or Code: export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH The latter is useful to put in your .bash_profile or .bashrc so that it's automatically set for you at login. Failing to set LD_LIBRARY_PATH will give you the following error when you start your program: Code: error while loading shared libraries: libdb-4.8.so: cannot open shared object file: No such file or directory Title: Re: Building headless Crypto and Crypto-qt on Windows(MSYS2) Post by: DigitalCoinBRL on January 16, 2021, 07:17:31 PM I see that having download links to all the dependencies is useful in particular when trying to build the Berkeley DB part of Bitcoin Core yourself, because it's so ancient that newer versions of BDB are incompatible with anything bitcoin-related, at least from the projects I try odd to compile, and will generate linking errors during compilation. So I thought it would be useful to have separate instructions for building BDB by itself on Linux. Code: pushd /tmp [1] Yes, you absolutely have to build Berkeley DB in this folder, otherwise it will spit out an error like this: Code: checking if building in the top-level or dist directories... yes [2] It installs it to /usr/local so that it does not conflict with any system-wise installation of Berkeley DB. Now to compile stuff with it just pass -I/usr/local/include -L/usr/local/lib -ldb to gcc. And then you run your program like this: Code: LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH program-name Or Code: export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH The latter is useful to put in your .bash_profile or .bashrc so that it's automatically set for you at login. Failing to set LD_LIBRARY_PATH will give you the following error when you start your program: Code: error while loading shared libraries: libdb-4.8.so: cannot open shared object file: No such file or directory Thank you very much for the feedback! As you can see in the title, I tried to specify that it is for Windows systems and not separately for Bitcoin, but any other type of currency that follows the same compilation line of the tutorial provided by our friend nitrogenetics (https://bitcointalk.org/index.php?action=profile;u=79058). Note that I also informed that the dependencies can be different depending on the project you are looking to work on, a lot can change in different versions of projects. In any case, the dependencies and versions must be the same as those described in the project documentation you are looking to use. |