{"action":"created","issue":{"url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/303","labels_url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/303/comments","events_url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/303/events","html_url":"https://github.com/etotheipi/BitcoinArmory/pull/303","id":89163956,"number":303,"title":"Mingw Build","user":{"login":"josephbisch","id":665854,"avatar_url":"https://avatars.githubusercontent.com/u/665854?v=3","gravatar_id":"","url":"https://api.github.com/users/josephbisch","html_url":"https://github.com/josephbisch","followers_url":"https://api.github.com/users/josephbisch/followers","following_url":"https://api.github.com/users/josephbisch/following{/other_user}","gists_url":"https://api.github.com/users/josephbisch/gists{/gist_id}","starred_url":"https://api.github.com/users/josephbisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephbisch/subscriptions","organizations_url":"https://api.github.com/users/josephbisch/orgs","repos_url":"https://api.github.com/users/josephbisch/repos","events_url":"https://api.github.com/users/josephbisch/events{/privacy}","received_events_url":"https://api.github.com/users/josephbisch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-18T00:40:39Z","updated_at":"2015-06-18T01:22:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/etotheipi/BitcoinArmory/pulls/303","html_url":"https://github.com/etotheipi/BitcoinArmory/pull/303","diff_url":"https://github.com/etotheipi/BitcoinArmory/pull/303.diff","patch_url":"https://github.com/etotheipi/BitcoinArmory/pull/303.patch"},"body":"@droark \r\n\r\nIt is probably easiest to just click on the \"Mingwbuild: Initial commit\" commit to see my actual changes rather than look at this whole PR, since it also merges ffreeze.\r\n\r\nAll my changes are in the mingwbuild directory. This PR is currently a way to build Armory as a standalone exe for Windows from a Linux computer. It is also a step towards a fully automatic build. Right now the process is not fully automatic. Once this is fully automated, it can work with Gitian to produce a reproducible Windows build.\r\n\r\nI will try my best to give complete step-by-step directions to building the exe. Note that I haven't done an independent, entire build all the way start to finish while following these exact directions, so there may be a mistake along the way. Rather, I am coming up with streamlined directions based on my experience building the exe.\r\n\r\nNote that there is currently an issue with ssl somewhere along the way (whether that be with the Python build itself or the freezing process I don't know) that should prevent Armory from connecting to Bitcoin Core. So as it stands, this build is probably useless on an online computer. Before performing the build you will need to comment out smtplib, bitcoinrpc, and urllib stuff (including imports) from the Python files to be able to run the resulting exe.\r\n\r\nNote that for this to run, you will need to merge in the python3 branch.\r\n\r\nNote that it is easiest to test on Linux using Wine, because of the built in debugger (winedbg).\r\n\r\n# Instructions\r\n\r\n1. Download the sources and uncompress them into `mingwbuild/src`. Refer to the filenames in the appropriate scripts for the names of the directories and version numbers for Python, Qt, and PyQt. Also download openssl (I used 1.0.1m), psutil (used 2.2.1), sip (4.16.7), Twisted (15.2.1), zlib (1.2.8), zope.interface (4.1.2).\r\n2. Make sure you have mingw-w64 install. It is the `mingw-w64` package in Debian-based distros.\r\n3. I don't remember exactly what needs openssl and zlib, so just get those over with. Make sure you set any static flags available to the configure scripts and specify x86_64-w64-mingw32 as the host or export `x86_64-w64-mingw32-gcc` as CC, `x86_64-w64-mingw32-g++` as CXX, etc. Ask me if you need help. In the future there should be a script that handles this.\r\n4. Follow the instructions in `build_py3_instructions.txt` to build Python 3.\r\n5. Run `./build_qt5.sh`.\r\n6. Build sip. Ask me if you need help. In the future there should be a script that handles this.\r\n7. Run `./build_pyqt5.sh`.\r\n8. Build psutil, sip, zope.interface, and Twisted with the Python we build for Windows. Ask me if you need help. In the future there should be a script that handles this.\r\n9. Install pyqtdeploy. Run `pyqtdeploy Armory.pdy` in the mingwbuild directory. In the GUI replace all paths that begin with `/home/joseph` with the appropriate path for your system. In the future there should be a variable used, so that this works just by setting an environment variable.\r\n10. Go to the build tab in pyqtdeploy. Modify the resource file number so it is higher than one. I use fifteen. If the number is too low, it uses too much memory and mingw-w64 chokes. Unfortunately the resource file number is not saved when you save the `Armory.pdy` file, so this has to be set every time you redo this. Click the build button. You should end up with green text reading \"Code generation succeeded\".\r\n11. Exit pyqtdeploy. Create CppBlockUtils.py. We don't need _CppBlockUtils.pyd, because we built the _CppBlockUtils module into Python. But if it is easier, just run the Makefile to go through the entire build process for Armory.\r\n12. Go the mingwbuild/build. Modify Armory.pro so that win32 has INCLUDEPATH as `/path/to/armory/mingwbuild/src/Python-3.4.3/Modules/_ctypes/libffi` instead of `/path/to/armory/mingwbuild/src/Python-3.4.3/Modules/_ctypes/libffi_msvc`. Delete the SOURCES line with ffi.c that is also under win32.\r\n13. Go to the next win32 section and find the DEFINES. Make it so it is `DEFINES += MS_WINDOWS _WIN32_WINNT=0x0600 NTDDI_VERSION=0x060000 WINVER=0x0600`. `0x0600` represents Windows Vista as the minimum version. I don't know what Armory really supports, but `0x0600` has worked for me.\r\n14. Search for mmap. There should be a single line found. Delete the entire line.\r\n15. Close the file after saving. Run `../qt-5.4.1/bin/qmake Armory.pro`. Edit Makefile.Release.\r\n16. Add `-I'../include'` to INCPATH. Add `-static -static-libgcc -static-libstdc++` to LFLAGS. Add `-L/path/to/armory/mingwbuild/src/Python-3.4.3/Modules/_ctypes/libffi/x86_64-w64-mingw32/.libs/ -lffi` to LIBS. Close the file after saving.\r\n17. Go into the resources directory. Run `find . -name \"pyqtdeploy*.qrc\" -print | xargs sed -i 's/BitcoinArmory\\///g'` Where `BitcoinArmory` is the name of your Armory source directory (just the directory itself, not the full path). Run `mv BitcoinArmory/* .`. Run `rm -r BitcoinArmory`. Again `BitcoinArmory` is the name of your Armory source directory. This step allows the imports to work correctly. In the future it should be scripted.\r\n18. Move up a directory, back to build. Run `make` and be patient.\r\n19. The result is in release. It is named `Armory.exe`. You need to take `libpython3.4.dll` from `mingwbuild/bin` and put it next to `Armory.exe` otherwise `Armory.exe` won't run."},"comment":{"url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/comments/113001779","html_url":"https://github.com/etotheipi/BitcoinArmory/pull/303#issuecomment-113001779","issue_url":"https://api.github.com/repos/etotheipi/BitcoinArmory/issues/303","id":113001779,"user":{"login":"droark","id":5931802,"avatar_url":"https://avatars.githubusercontent.com/u/5931802?v=3","gravatar_id":"","url":"https://api.github.com/users/droark","html_url":"https://github.com/droark","followers_url":"https://api.github.com/users/droark/followers","following_url":"https://api.github.com/users/droark/following{/other_user}","gists_url":"https://api.github.com/users/droark/gists{/gist_id}","starred_url":"https://api.github.com/users/droark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droark/subscriptions","organizations_url":"https://api.github.com/users/droark/orgs","repos_url":"https://api.github.com/users/droark/repos","events_url":"https://api.github.com/users/droark/events{/privacy}","received_events_url":"https://api.github.com/users/droark/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T01:22:28Z","updated_at":"2015-06-18T01:22:28Z","body":"Oops. I meant to have my comments stick to the code in this PR. Sorry. :) Anyway, it's a bummer that Armory.pdy is so large. A 26 MB file in the codebase isn't the most ideal option. I'm guessing there's no reasonable alternative, unfortunately."}}