Bitcoin Forum
May 26, 2024, 09:16:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the best distro to compile windows binaries?  (Read 225 times)
cellard (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1252


View Profile
March 11, 2019, 04:27:41 AM
 #1

I want to compile the executable for windows on linux, it's a fork of Core of some altcoin, there's no way im installing altcoin stuff without compiling the source code. Which is the distro that will have all the libraries needed to build the binaries?

Will this work in the latest Ubuntu?

Code:
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.

then get the .git and:

Code:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
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=/
make
HeRetiK
Legendary
*
Offline Offline

Activity: 2940
Merit: 2092



View Profile
March 11, 2019, 03:40:24 PM
 #2

Why not just run it (or compile it) on a virtual Windows machine?

I've never made use of it myself, but AFAIK Microsoft overs free time-limited images for virtual machine set ups. For example here's a bunch of Windows 7 images primarily used for IE testing, but they should support other basic Windows functionalities as well:
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
seoincorporation
Legendary
*
Offline Offline

Activity: 3164
Merit: 2958


Top Crypto Casino


View Profile
March 11, 2019, 03:52:42 PM
 #3

I want to compile the executable for windows on linux, it's a fork of Core of some altcoin, there's no way im installing altcoin stuff without compiling the source code. Which is the distro that will have all the libraries needed to build the binaries?

Will this work in the latest Ubuntu?

Code:
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.

then get the .git and:

Code:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
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=/
make

The last time i did this was like 10 years ago.

I write code on C++ and then compile it as .exe, and the tool i used what the same you mention (Mingw), the code was something like:

Code:
 i586-mingw32msvc-g++ -o myApp.exe myApp.cpp

If you want to learn more about this topic you should google about cross compiling, i will leave a couple of sources for you  Wink

http://forums.codeblocks.org/index.php?topic=3343.0
https://stackoverflow.com/questions/2033997/how-to-compile-for-windows-on-linux-with-gcc-g

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


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
March 11, 2019, 04:57:26 PM
 #4

Bitcoin Core provides fairly detailed step by step instructions for cross compiling for Windows using Ubuntu: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux. It would probably be the easiest and least buggy for you to use Ubuntu and just follow those instructions.

The only dependency that is really required is MinGW. All other dependencies are built by the depends system.

cellard (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1252


View Profile
March 12, 2019, 04:12:00 AM
 #5

Why not just run it (or compile it) on a virtual Windows machine?

I've never made use of it myself, but AFAIK Microsoft overs free time-limited images for virtual machine set ups. For example here's a bunch of Windows 7 images primarily used for IE testing, but they should support other basic Windows functionalities as well:
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

I trust Linux live environment better than Windows VM. If your Windows machine was compromised, then the compiled code could be compromised. Why not minimize this risk by using a Live boot.

Bitcoin Core provides fairly detailed step by step instructions for cross compiling for Windows using Ubuntu: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux. It would probably be the easiest and least buggy for you to use Ubuntu and just follow those instructions.

The only dependency that is really required is MinGW. All other dependencies are built by the depends system.

Thanks. I will try to download later "Ubuntu Bionic 18.04" specifically, not sure if its the latest, I guess so. I will boot from a live USB. Get the exe and save it somewhere.
DaCryptoRaccoon
Hero Member
*****
Offline Offline

Activity: 1217
Merit: 607


OGRaccoon


View Profile
March 14, 2019, 02:36:20 AM
 #6

This might be what your looking  working in debian

 Wink
Code:

sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git

Then choose:

-------------------------------------------------
Option A: Cross-compile Windows wallets (64 bit)
-------------------------------------------------

sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev

# Pick posix version for the following!

sudo update-alternatives --config x86_64-w64-mingw32-gcc
sudo update-alternatives --config x86_64-w64-mingw32-g++

cd depends

make -j 24 HOST=x86_64-w64-mingw32

# *** TIME FOR A REST HERE THIS TAKES SOME TIME ***

cd ..

./autogen.sh

CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/

make -j 24

Optional: strip the binaries to reduce size at this point if you're going to share them.

-------------------------------------------------
Option B: Compile native Linux wallets
-------------------------------------------------

cd depends

make -j 24

# *** ANOTHER PLEASE WAIT MOMENT OR TWO ***

cd ..

./autogen.sh

CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure --prefix=/

make -j 24

Optional: strip the binaries to reduce size at this point if you're going to share them.

┏━━━━━━━━━━━━━━━━━┓
┃   💎 Mine Solo with CKPool 💎    ┃
┃    ➤ Hit Blocks on Your Own!      ┃
┃ ███▓▓  ███▓▓  ███▓▓  ███▓▓┃
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!