Difference between revisions of "Compiling instructions"

From Bitmessage Wiki
Jump to navigation Jump to search
(v0.2.0)
Line 1: Line 1:
 
This page should help novice users run Bitmessage from the source code files.
 
This page should help novice users run Bitmessage from the source code files.
 
== Version 0.2.0 ==
 
Documentation not yet written. The documentation below should work as long as you also install OpenSSL (the binary is fine).
 
 
== Version 0.1.6 and lower ==
 
  
 
=== Windows ===
 
=== Windows ===
Line 17: Line 12:
 
### Try running 'python' again.
 
### Try running 'python' again.
 
##Press Ctrl-Z to exit Python.
 
##Press Ctrl-Z to exit Python.
# Bitmessage has only one dependency (PyQt) which you will need to download yourself. Download and install PyQt from [http://www.riverbankcomputing.com/software/pyqt/download here]. You will want the Binary Package since it is already compiled for you. Be sure to select the version for Python 2.7. It is labeled as Py2.7.  
+
# Bitmessage has two dependencies. The first is PyQt. Download and install PyQt from [http://www.riverbankcomputing.com/software/pyqt/download here]. You will want the Binary Package since it is already compiled for you. Be sure to select the version for Python 2.7. It is labeled as Py2.7.  
# Download the source code for PyBitmessage from GitHub. If it is in a zip file, you will need to extract it. There should be a number of files (around ten) and an rsa folder.  
+
# The second dependency is OpenSSL which you can download from [http://slproweb.com/products/Win32OpenSSL.html here]. There you will also notice the link to download the Visual C++ 2008 program in case you also find that you need that as well. (The OpenSSL installer will complain if you need to install the Visual C++ Redistributable.)
 +
# Download the source code for PyBitmessage from GitHub. If it is in a zip file, you will need to extract it. There should be a number of files (around 20) and a few folders.
 
# To run Bitmessage, double click on the bitmessagemain.py file, or in a command prompt, change directories to the directory holding bitmessagemain.py and type 'python bitmessagemain.py'.
 
# To run Bitmessage, double click on the bitmessagemain.py file, or in a command prompt, change directories to the directory holding bitmessagemain.py and type 'python bitmessagemain.py'.
  
Line 33: Line 29:
 
# Copy all of the source code files to the PyInstaller directory (which contains pyinstaller.py).  
 
# Copy all of the source code files to the PyInstaller directory (which contains pyinstaller.py).  
 
# Run 'pyinstaller.py --onefile --noconsole --icon="images\can-icon.ico" bitmessagemain.py'
 
# Run 'pyinstaller.py --onefile --noconsole --icon="images\can-icon.ico" bitmessagemain.py'
 +
This won't include the OpenSSL DLL file in the EXE; if you send it to someone who doesn't have OpenSSL installed, it will not run. To include the DLL file in the EXE, you must follow these steps:
 +
# After following the steps above, you will see that pyinstaller created a folder called bitmessagemain. In that folder is a file: bitmessagemain.spec. Open it with a text editor.
 +
# Below the line "a.datas," add this line: <code>a.binaries + [('libeay32.dll', 'c:\\windows\\system32\\libeay32.dll', 'BINARY')],</code>
 +
# Save and close
 +
# Run this command: pyinstaller.py bitmessagemain/bitmessagemain.spec

Revision as of 02:48, 28 January 2013

This page should help novice users run Bitmessage from the source code files.

Windows

  1. Download and install the latest revision of Python 2.7 (currently Python 2.7.3 from here). The Windows x86 MSI Installer is the right choice for most people. (64-bit users may want the 64-bit version).
  2. Test that it installed:
    1. Open a command prompt by going to Start > Run. Type 'cmd' then press enter.
    2. type 'python'. If python is installed, you should see the python version and the prompt: '>>>'
    3. If you see a message such as: "'Python is not recognized as an internal or external command..." then you must add the python path to your path environmental variable:
      1. Find the location where Python was installed (in particular, the location where python.exe exists). It might simply be in c:\Python2.7
      2. Follow these directions to add the Python path to your path variable.
      3. Close the command prompt window and reopen it.
      4. Try running 'python' again.
    4. Press Ctrl-Z to exit Python.
  3. Bitmessage has two dependencies. The first is PyQt. Download and install PyQt from here. You will want the Binary Package since it is already compiled for you. Be sure to select the version for Python 2.7. It is labeled as Py2.7.
  4. The second dependency is OpenSSL which you can download from here. There you will also notice the link to download the Visual C++ 2008 program in case you also find that you need that as well. (The OpenSSL installer will complain if you need to install the Visual C++ Redistributable.)
  5. Download the source code for PyBitmessage from GitHub. If it is in a zip file, you will need to extract it. There should be a number of files (around 20) and a few folders.
  6. To run Bitmessage, double click on the bitmessagemain.py file, or in a command prompt, change directories to the directory holding bitmessagemain.py and type 'python bitmessagemain.py'.

If you change user interface files

You can use Qt's Designer application to modify the user interface. After you do this, you will need to 'compile' .ui files into .py files.

  1. In a command prompt, change directories to the directory of your .ui file.
  2. Run 'pyuic4 example.ui > example.py' If you get a message similar to 'pyuic4 is not recognized as an internal or external command' then you must add the PyQt directory to your system's path variable. This directory should hold pyuic4.bat. It might be in C:\Python27\Lib\site-packages\PyQt4. Remember to close the command window and reopen it after you change your path variable.

If you add icons to bitmessage_icons.qrc, then you must run this command: pyrcc4 bitmessage_icons.qrc -o bitmessage_icons_rc.py

Optional: Compile into a stand-alone EXE

  1. Download PyInstaller.
  2. Copy all of the source code files to the PyInstaller directory (which contains pyinstaller.py).
  3. Run 'pyinstaller.py --onefile --noconsole --icon="images\can-icon.ico" bitmessagemain.py'

This won't include the OpenSSL DLL file in the EXE; if you send it to someone who doesn't have OpenSSL installed, it will not run. To include the DLL file in the EXE, you must follow these steps:

  1. After following the steps above, you will see that pyinstaller created a folder called bitmessagemain. In that folder is a file: bitmessagemain.spec. Open it with a text editor.
  2. Below the line "a.datas," add this line: a.binaries + [('libeay32.dll', 'c:\\windows\\system32\\libeay32.dll', 'BINARY')],
  3. Save and close
  4. Run this command: pyinstaller.py bitmessagemain/bitmessagemain.spec