Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MASSIVE-CVL Launcher Linux build instructions Automatic build instructions See the github wiki page: https://github.com/CVL-dev/cvl-fabric-launcher/wiki/Linux-build-instructions Also see the internal wiki for instructions for automated building on Centos/Debian/Ubuntu on our Linux VM hosts: Automated Linux build instructions More detailed information about using the automatic installation and build scripts: 32-bit Debian (DEB) build 64-bit Debian (DEB) build 32-bit CentOS (RPM) build 64-bit CentOS (RPM) build Manual build instructions These instructions were written when building the Launcher's Linux binary tarball as a 32-bit binary but from a 64-bit CentOS 6 virtual machine. Now we build 32-binaries on 32-bit virtual machines. Overview Source code for the MASSIVE wxPython launcher can be found here: https://github.com/CVL-dev/cvl-fabric-launcher After bundling with pyinstaller, and creating a tarball (.tar.gz), we end up with a downloadable file, MassiveLauncher_v1.2.3.tar.gz, which can be extracted and run or installed, using the instructions in the README_LINUX file. Below, I will document the steps required to install appropriate versions of Python and wxPython on CentOS 6.2, so that the MASSIVE Launcher can be built into a distributable bundle, using PyInstaller. Required Python modules See the DEPENDENCIES file distributed with the source code. Quick Build Instructions If you have already installed an appropriate version of Python and an appropriate version of wxPython, then you can proceed to the section "Building a MASSIVE Launcher distributable bundle using PyInstaller". Installing Python Currently, I am using 32-bit versions of Python to build the MASSIVE Launcher. The Python source (version 2.7.3) tarball can be downloaded from: http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz and can be unzipped into: /usr/local/src/PYTHON/2.7.3/Python-2.7.3/ To build a 32-bit version of Python on a 64-bit CentOS machine, you will need to install some 32-bit software for compilation and linking: yum yum yum yum install install install install gcc glibc.i686 glibc-devel.i686 libgcc.i686 To build a fully functional Python, some additional packages should be installed, as listed below. To determine whether you are missing something, look towards the end of the output from running "make" for something like this: "Python build finished, but the necessary bits to build these modules were not found:" If the only modules missing dependencies are "bsddb185" and "sunaudiodev", don't worry - these are old modules which can be safely ignored. yum yum yum yum yum yum yum yum yum yum install install install install install install install install install install ncurses-libs.i686 ncurses-devel.i686 readline.i686 readline-devel.i686 zlib.i686 zlib-devel.i686 bzip2-libs.i686 bzip2-devel.i686 gdbm.i686 gdbm-devel.i686 sqlite.i686 sqlite-devel.i686 db4.i686 db4-devel.i686 openssl.i686 openssl-devel.i686 libX11.i686 libX11-devel.i686 tk.i686 tk-devel.i686 The 32-bit Python can be installed in: /usr/local/python/2.7.3-i686/ A 32-bit version of Pythoncan be built using: CFLAGS=-m32 LDFLAGS=-m32 ./configure --prefix=/usr/local/python/2.7.3-i686/ --enable-shared make make install Installing Modules The Modules environment will allow us to easily switch between our 32-bit Python version and the pre-installed Python in /usr/bin/, which is used by yum. The Modules source tarball can be downloaded from: http://downloads.sourceforge.net/project/modules/Modules/modules-3.2.9/modules -3.2.9c.tar.gz and can be unzipped into: /usr/local/src/MODULES/modules-3.2.9/ and can be installed into /usr/local/Modules/ using: tar zxvf modules-3.2.9c.tar.gz cd modules-3.2.9 yum install tcl tcl-devel ./configure make make install ln -s /usr/local/Modules/3.2.9 /usr/local/Modules/default mkdir /usr/local/Modules/modulefiles env HOME=/etc/skel /usr/local/Modules/default/bin/add.modules su - wettenhj -c "yes | /usr/local/Modules/default/bin/add.modules" su - -c "yes | /usr/local/Modules/default/bin/add.modules" echo "export MODULE_VERSION=3.2.9" >> /etc/profile echo "export MODULEPATH=/usr/local/Modules/versions:/usr/local/Modules/\ $MODULE_VERSION/modulefiles:/usr/local/Modules/modulefiles" >> /etc/profile source /etc/profile module avail Note: if building Modules-3.2.9c on 64bit Centos 6.3 and the configure script fails with an error about TCL_LIB_SPEC, use these flags: ./configure --prefix=... --with-tcl-lib=/usr/lib64 --with-tcl-inc=/usr/include Note: on Debian Squeeze 64bit, configure using the following options: ./configure --prefix=... --with-tcl-ver=8.5 --with-tcl-lib=/usr/lib --with-tcl-inc=/usr/include/tcl8.5 Adding our Python installation to the Modules Environment mkdir /usr/local/Modules/modulefiles/python cd /usr/local/Modules/modulefiles/python/ scp -r [email protected]:/usr/local/Modules/modulefiles/python/. . rm 3.*-gcc mv 2.7.1-gcc 2.7.3-i686 # i686 means 32-bit version of Python vi 2.7.3-i686 # Comment out "module load gcc" module avail module load python which python Installing wxPython The wxPython source tarball can be downloaded from: http://downloads.sourceforge.net/wxpython/wxPython-src-2.8.12.1.tar.bz2 and can be unzipped into: /usr/local/src/WXPYTHON/2.8.12.1/wxPython-src-2.8.12.1/ There are two steps required to build wxPython: 1. Build the wxWidgets (C++) library 2. Build wxPython wxPython needs to be built against the correct version of Python(the 32-bit version we just installed). This Python version can be selected using the Modules framework. The following packages should be installed before attempting to build wxWidgets / wxPython. Some of the dependencies of gtk2-devel.i686 (e.g. atk-devel.i686 and cairo-devel.i686) should automatically be installed by running "yum install gtk2-devel.i686". However, the officially registered dependencies of gtk2-devel.i686 seem to be broken, in that it incorrectly installs 64-bit versions of some of the dependencies, instead of 32-bit versions. yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum install install install install install install install install install install install install install install install install install gcc-c++ gtk2-devel.i686 gtk2-engines.i686 glib2-devel.i686 mesa-libGL.i686 mesa-libGL-devel.i686 mesa-libGLU.i686 mesa-libGLU-devel.i686 mesa-libGLw.i686 mesa-libGLw-devel.i686 gtkglext-libs.i686 gtkglext-devel.i686 gimp-libs.i686 gimp-devel.i686 gvfs.i686 atk-devel.i686 pango-devel.i686 cairo-devel.i686 freetype-devel.i686 fontconfig-devel.i686 libcanberra-gtk2.i686 PackageKit-gtk-module.i686 The procedure for building wxWidgets and wxPython is described here: /usr/local/src/WXPYTHON/2.8.12.1/wxPython-src-2.8.12.1/wxPython/docs/BUILD.txt Below are the steps I used to build wxWidgets on CentOS 6.2 : PKG_CONFIG_PATH=/usr/lib/pkgconfig/ export PKG_CONFIG_PATH pkg-config gtk+-2.0 --libs mkdir /usr/local/wxpython mkdir /usr/local/wxpython/2.8.12.1-i686 WXDIR=/usr/local/src/WXPYTHON/2.8.12.1/wxPython-src-2.8.12.1 cd $WXDIR mkdir bld cd bld CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ../configure --prefix=/usr/local/wxpython/2.8.12.1-i686 \ --with-gtk \ --with-gnomeprint \ --with-opengl \ --enable-debug \ --enable-debug_gdb \ --enable-geometry \ --enable-graphics_ctx \ --enable-sound --with-sdl \ --enable-mediactrl \ --enable-display \ --enable-unicode make make -C contrib/src/gizmos make -C contrib/src/stc make install # # # # "On certain platforms (e.g. Linux) you'll now have to run ldconfig if you installed a shared library and also modify the LD_LIBRARY_PATH (or equivalent) environment variable." # We'll do this manually for now, but when we configure wxPython # as a module within the Modules environment, it can have its # own script in /usr/local/Modules/modulefiles/wxpython/2.8.12.1-i686 # which will set up the shared library path etc. LD_LIBRARY_PATH=/usr/local/wxpython/2.8.12.1-i686/lib/:$LD_LIBRA RY_PATH ldconfig make -C contrib/src/gizmos install make -C contrib/src/stc install # Add wxWidgets to PATH, so that wxPython build can find wx-config: echo "export PATH=\$PATH:/usr/local/wxpython/2.8.12.1-i686/bin/" >> /etc/profile source /etc/profile wx-config --libs It's not over yet! We have only built the wxWidgets C++ library. We still need to build the wxPython Python-interface to wxWidgets. cd $WXDIR/wxPython # Ensure that our 32-bit Python version is first in the PATH: module load python/2.7.3-i686 which python CFLAGS=-m32 python setup.py build_ext --inplace --debug python setup.py install If everything has been installed correctly, there should be no error when importing the wx module into Python: [root@centos6 wxPython]# python Python 2.7.3 (default, Jun 26 2012, 12:41:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import wx >>> Here is a wxPython "Hello World" script: # hello.py import wx app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window. frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window. frame.Show(True) # Show the frame. app.MainLoop() The script can be run with: module load python/2.7.3-i686 python hello.py We should revert to the default Python in /usr/bin/ for yum etc. : module unload python/2.7.3-i686 Required Python modules See the DEPENDENCIES file distributed with the source code. Building a MASSIVE Launcher distributable bundle using PyInstaller This assumes that you can already run the launcher using "python launcher.py", i.e. You have already installed all of the dependent Pythonmodules. See the DEPENDENCIES file in the MASSIVE Launcher source distribution. The wxPythonshared libraries can be found: If necessary, run: LD_LIBRARY_PATH=/usr/local/wxpython/2.8.12.1-i686/lib/ :$LD_LIBRARY_PATH ldconfig Download PyInstaller from here: https://github.com/downloads/pyinstaller/pyinstaller/pyinstaller-1.5.1.tar.bz2 and extract it in ~wettenhj/Desktop/pyinstaller-1.5.1/ From the MASSIVE Launchersource directory, run the following: $ cd ~/Desktop/cvl_svn/launcher/trunk $ svn update $ rm -fr build/ $ rm -fr dist/ $ module avail $ module load python/2.7.3-i686 $ which python # Run python and "import wx" to check that wxPython is installed correctly. # The "import wx" statement could give errors if LD_LIBRARY_PATH is not set or if required shared libraries are not installed. $ python Python 2.7.3 (default, Jun 27 2012, 02:03:39) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import wx >>> quit() $ python ~/Desktop/pyinstaller-1.5.1/Configure.py $ rm -f launcher.spec $ python ~/Desktop/pyinstaller-1.5.1/Makespec.py launcher.py $ python ~/Desktop/pyinstaller-1.5.1/Build.py launcher.spec $ cd dist/launcher/ $ ./launcher If Python was built from source, as described above, it must be built with --enable-shared, because the Python shared library libpython2.7.so.1.0 needs to be included in the distribution. A "launcher" sub-directory will be created automatically by PyInstaller, based on the name of the main Python script, "launcher.py". PyInstalleris conservative, i.e. it includes shared libraries which may not be necessary. The ~/Desktop/pyinstaller-1.5.1/massive/dist/massive/ directory contained 281 MB of files the first time I ran PyInstaller o n the MASSIVE Launcher! Run ls -ltrh to see which files are taking up the most space. The dist/massive/ folder can be zipped up which cuts its size down to 107 MB (using gz) or 105 MB (using bzip2). We need to be careful about removing shared libraries which may not be needed, because even running a simple "Hello, World" wxPython application (as described above) will complain if you don't have some (seemingly irrelevant shared libraries installed). Now we can create a MASSIVE\ Launcher.desktop launcher to be included in the Linux Desktop menu, (by copying to /usr/share/applications/ or wherever) and either: 1. Build an RPM package and a .deb package using checkinstall, or 2. Simply distribute the launcher as a binary .tar.gz bundle, as Firefox does, but include the MASSIVE\ Launcher.desktop launcher within the .tar.gz bundle. A MASSIVE\ Launcher.desktop launcher is available in the MASSIVE Launcher source code repository. [wettenhj@centos6 trunk]$ cd ~/Desktop/cvl_svn/launcher/trunk [wettenhj@centos6 trunk]$ rm -fr dist/MassiveLauncher* [wettenhj@centos6 trunk]$ mv dist/launcher dist/MassiveLauncher [wettenhj@centos6 trunk]$ cp MASSIVE\ Launcher.desktop dist/MassiveLauncher/ [wettenhj@centos6 trunk]$ cp massiveLauncher.sh dist/MassiveLauncher/ [wettenhj@centos6 trunk]$ mkdir dist/MassiveLauncher/icons [wettenhj@centos6 trunk]$ cp IconPngs/* dist/MassiveLauncher/icons/ [wettenhj@centos6 trunk]$ cp README_LINUX dist/MassiveLauncher/ [wettenhj@centos6 trunk]$ cd dist/ [wettenhj@centos6 dist]$ tar cvf MassiveLauncher_v1.2.3.tar MassiveLauncher/ [wettenhj@centos6 dist]$ gzip MassiveLauncher_v1.2.3.tar [wettenhj@centos6 dist]$ ls -lh MassiveLauncher_v1.2.3.tar.gz In the final step before uploading the bundle, we check the size of the gzipped tarball (using ls -lh) to ensure that it is roughly the same as the size as the previous version's gzipped tarball. If it is significantly smaller, than it's possible that some dependencies were not found and were accidentally omitted from the build.