How to compile Bitcoin-Qt as an .exe on Ubuntu?

3

2

After struggeling with the dependencies for a while, I finally managed to compile Bitcoin-Qt on my Ubuntu machine. I used the following commandos for compiling:

./autogen.sh
./configure -with-gui
make
sudo make install

Now when I write bitcoin-qt in the terminal, the wallet will succesfully start. However, I am not able to locate bitcoin-qt.exe on my computer. I want to be able to get the .exe and put it on other machines without having to install all the dependencies on them as well. How would I go about creating this .exe?

user3600338

Posted 2017-06-13T10:38:11.363

Reputation: 43

3Wait a second. .exe files are used on Windows, not Linux (your executable file is simply named bitcoin-qt and is probably in /usr/local/bin). Are you wanting to compile a version for Windows computers (that's called cross-compiling), or a version to run on other Linux computers without installing other dependencies (that's called static linking)? – Nate Eldredge – 2017-06-13T13:53:23.707

Answers

6

.exe files are for windows only. Linux systems do not use the same file extension or file type as windows. I assume you just want to create a Linux binary that can be used on all systems without installing all dependencies. To do that, you can use Bitcoin Core's depends system. Instructions are here: https://github.com/bitcoin/bitcoin/tree/master/depends.

Basically, all you need to do is (starting from the source root directory):

cd depends
make
cd ..
./configure --prefix=`pwd`/depends/x86_64-linux-gnu # Actually check what folder is created in depends after you built the dependencies and use that instead
make

Once you do that, the binaries that are produced can be moved to and used on any linux system. The binaries are located at (from the source root dir) src/bitcoind, src/qt/bitcoin-qt, src/bitcoin-cli, and src/bitcoin-tx

Andrew Chow

Posted 2017-06-13T10:38:11.363

Reputation: 50 267

Thank you, that explains a lot :) I am completely new to linux, hence my confusion. So if I want to use this on another computer, I just move the binaries to the other computer? Will I have to install them in some way? In addition to the ones you mentioned, it seems as if I also have bench_bitcoin, test_litecoin and test_litecoin-qt. Should I move those over to the other computer as well? – user3600338 – 2017-06-13T19:45:31.380

Yes, just move the binaries to another computer that is also running linux. Each binary is standalone, so you don't actually need anything else if you don't want to use them. You will need to "install" the binaries if you want to use them from anywhere on your computer. This just means putting them in a folder that is on your system's PATH. Otherwise you will need to give a path to the binary every time you want to run it. – Andrew Chow – 2017-06-13T19:51:28.833

Then how to make windows runnable build file from ubuntu? – creator – 2018-02-08T11:26:28.937

@leegod The instructions are linked in my answer. – Andrew Chow – 2018-02-08T15:27:32.290

@AndrewChow I want more direct and specific answer. so, result is, like this? [./configure --prefix=pwd/depends/x86_64-w64-mingw32] ? – creator – 2018-02-08T15:53:50.747

and after do those lines, windows exe file generated? For lite normal users who want to just wallet of my own alt-coin. – creator – 2018-02-08T15:55:11.470

1cd into depends and do make HOST=x86_64-w64-mingw32 -j4. cd back out and do ./configure --prefix=\pwd`/depends/x86_64-w64-mingw32. Then when you domakeyou will produce.exe` files which only work on windows. – Andrew Chow – 2018-02-08T16:03:54.777

4

Since this is the first result that pops up on google when searching "bitcoin windows depends build" and the user asked how to build the .exe (but was actually looking for static build instructions on ubuntu) the correct instructions would be to use cross compilation with the depends system as specified in the documentation here: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md . The important part is that it will probably only run on Ubuntu 14.04. Install the dependencies as listed in the build-windows readme then build using:

cd depends
make HOST=x86_64-w64-mingw32
cd ..
./configure --prefix=`pwd`/depends/x86_64-w64-mingw32
make

TheCharlatan

Posted 2017-06-13T10:38:11.363

Reputation: 155

I followed your steps but I still don't have an exe file. I'm trying to build on ubuntu to make an exe that will run on windows 10. I can get it to build for ubuntu but not for windows. – Patrick W. McMahon – 2019-08-04T17:35:20.177

2

An alternative solution would be to build a tarball archive like the one you can download from the Bitcoin Core website.

To do that you have to follow the release process, as explained in: https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md The process actually consists in creating a Gitian build: https://github.com/bitcoin-core/docs/blob/master/gitian-building.md

Since, the instructions on the website can be kind of confusing, I wrote a small guide based on my personal experience: https://gist.github.com/frz-dev/3e3e906fa06294e61930e81b473e1e5b#file-bitcoin-core-gitian-build-guide_debian-script-txt

This process allows to create the Bitcoin binaries for all platforms (Linux, Windows, Mac OSX)

FedFranz

Posted 2017-06-13T10:38:11.363

Reputation: 570