wiki:jazz/mpich2_deb

Rebuild mpich2 Debain package

There are Debian package provided by Zach Lowry for MPICH2 version 1.0.3. We want to build 1.0.7 package with 1.0.3 package rules. Here is the procedures:

Extract 1.0.3 debian package rules

  • Donwload 1.0.3 debian package source files
    root@r-mpi:~# wget http://www.cs.mtsu.edu/~zach/debian/current/mpich2_1.0.3-2.dsc
    root@r-mpi:~# wget http://www.cs.mtsu.edu/~zach/debian/current/mpich2_1.0.3-2.diff.gz
    root@r-mpi:~# wget http://www.cs.mtsu.edu/~zach/debian/current/mpich2_1.0.3.orig.tar.gz
    
  • We will need dpkg-source command, so first check if you had installed dpkg-dev
    root@r-mpi:~# apt-get install dpkg-dev
    
  • Extract 1.0.3 debian package source
    root@r-mpi:~# dpkg-source -x mpich2_1.0.3-2.dsc
    gpg: Signature made Mon 28 Nov 2005 07:49:49 PM PST using DSA key ID 1CE6894E
    gpg: Can't check signature: public key not found
    dpkg-source: extracting mpich2 in mpich2-1.0.3
    dpkg-source: unpacking mpich2_1.0.3.orig.tar.gz
    dpkg-source: applying ./mpich2_1.0.3-2.diff.gz
    

Configure 1.0.7 source tar ball

  • Download 1.0.7 source tar ball from office website
    root@r-mpi:~# wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/mpich2-1.0.7.tar.gz
    root@r-mpi:~# tar zxvf mpich2-1.0.7.tar.gz
    
  • Copy debian folder from 1.0.3
    root@r-mpi:~# cd mpich2-1.0.7
    root@r-mpi:~/mpich2-1.0.7# cp -aRp ../mpich2-1.0.3/debian/ .
    
  • We will need dch command, so first check if you had installed devscripts
    root@r-mpi:~/mpich2-1.0.7# apt-get install devscripts
    
  • modified debian/control
    root@r-mpi:~/mpich2-1.0.7# vi debian/control
    
    • debian/control

      old new  
      2424Architecture: any
      2525Section: devel
      2626Priority: extra
      27 Depends: ${shlibs:Depends}, python2.3, python2.3-xml
       27Depends: ${shlibs:Depends}, python, python-xml
      2828Conflicts: mpd
      2929Recommends: mpich2-doc (= ${Source-Version}), ssh
      3030Description: Process control for MPICH2
  • update debian/changelog
    root@r-mpi:~/mpich2-1.0.7# export DEBFULLNAME="Jazz Yao-Tsung Wang"
    root@r-mpi:~/mpich2-1.0.7# export DEBEMAIL="XXX@NCHC.ORG.TW"
    root@r-mpi:~/mpich2-1.0.7# dch -i
    
    • debian/changelog

      old new  
      11
      2 mpich2 (1.0.3-3) unstable; urgency=low
       2mpich2 (1.0.7-1) unstable; urgency=low
       3
       4  * New upstream release
       5
       6 -- Jazz Yao-Tsung Wang <XXX@NCHC.ORG.TW>  Thu, 12 Jun 2008 13:11:50 -0700
      37
      48mpich2 (1.0.3-2) unstable; urgency=low
  • remove old patches
    root@r-mpi:~/mpich2-1.0.7# rm -rf debian/patches/
    
  • use dpkg-checkbuilddeps to know which packages is not yet installed for building new packages.
    root@r-mpi:~/mpich2-1.0.7# dpkg-checkbuilddeps
    
  • If there are errors after dpkg-checkbuilddeps, you can install packages which is needed for build mpich2 packages
    root@r-mpi:~/mpich2-1.0.7# apt-get install gcc g++ debhelper cdbs libg2c0 linux-kernel-headers python g77 txt2man libxt6 libxt-dev x-dev
    
  • use cdbs-edit-patches to create new patches
    root@r-mpi:~/mpich2-1.0.7# cdbs-edit-patch 01_Makefile.in
    
  • cdbs-edit-patches will create a temperate folder for you to edit patches. You will need to patch following files.
    • Makefile.in
      root@r-mpi:/tmp/cdbs-new-patch.aj3114/mpich2-1.0.7.new# vi Makefile.in
      
      • Makefile.in

        old new  
        185185       if [ ! -d ${DESTDIR}${exec_prefix} ] ; then $(MKDIR_P) ${DESTDIR}${exec_prefix} ; fi
        186186       if [ ! -d ${DESTDIR}${libdir} ] ; then $(MKDIR_P) ${DESTDIR}${libdir} ; fi
        187187       ${MAKE} install-local
         188       ${MAKE} install-examples
        188189       $(INSTALL_DATA) src/include/mpi.h ${DESTDIR}${includedir}/mpi.h
        189190       $(INSTALL_DATA) lib/lib${MPILIBNAME}.a ${DESTDIR}${libdir}/lib${MPILIBNAME}.a
        190191       if [ ! -d ${DESTDIR}${docdir} ] ; then $(MKDIR_P) ${DESTDIR}${docdir} ; fi
         
        479480# documentation)
        480481install-examples:
        481482       if [ ! -d ${DESTDIR}${exec_prefix}/examples ] ; then \
        482            $(MKDIR_P) ${DESTDIR}${exec_prefix}/examples ; \
         483           $(MKDIR_P) ${DESTDIR}${exec_prefix}/share/mpich2/examples ; \
        483484       fi
        484        $(INSTALL_PROGRAM) examples/cpi ${DESTDIR}${exec_prefix}/examples/cpi
         485       $(INSTALL_PROGRAM) examples/cpi ${DESTDIR}${exec_prefix}/share/mpich2/examples/cpi
        485486
        486487install-devdocs:
        487488       (cd doc && $(MAKE) install-devdocs)
    • Fixed $(PREFIX) problem: replace $(PREFIX) with $(prefix)
      root@r-mpi:/tmp/cdbs-new-patch.aj3114/mpich2-1.0.7.new# for i in $(grep "(PREFIX)" `find . -name "Makefile.in"` | awk '{ print $1 }' | uniq | sed 's#:##'); do mv $i $i.org; cat $i.org | sed 's#(PREFIX)#(prefix)#g' > $i ; rm $i.org; done
      
      • ./src/mpe2/src/slog2sdk/trace_sample/Makefile.in

        old new  
        77       cd src && $(MAKE)
        88
        99install:
        10        @if [ -n "$(PREFIX)" ] ; then \
        11             ./sbin/install-package -prefix=$(PREFIX) ; \
         10       @if [ -n "$(prefix)" ] ; then \
         11            ./sbin/install-package -prefix=$(prefix) ; \
        1212        else \
        1313            ./sbin/install-package ; \
        1414        fi
      • ./src/mpe2/src/slog2sdk/trace_rlog/Makefile.in

        old new  
        77       cd src && $(MAKE)
        88
        99install:
        10        @if [ -n "$(PREFIX)" ] ; then \
        11             ./sbin/install-package -prefix=$(PREFIX) ; \
         10       @if [ -n "$(prefix)" ] ; then \
         11            ./sbin/install-package -prefix=$(prefix) ; \
        1212        else \
        1313            ./sbin/install-package ; \
        1414        fi
      • ./src/mpe2/src/slog2sdk/Makefile.in

        old new  
        1515         done
        1616
        1717install:
        18        @if [ -n "$(PREFIX)" ] ; then \
        19             ./sbin/install-package -prefix=$(PREFIX) ; \
         18       @if [ -n "$(prefix)" ] ; then \
         19            ./sbin/install-package -prefix=$(prefix) ; \
        2020        else \
        2121            ./sbin/install-package ; \
        2222        fi
      • ./src/mpe2/Makefile.in

        old new  
        7070
        7171########  Installing
        7272install: FORCE_TARGET
        73        @if [ -n "$(PREFIX)" ] ; then \
        74             ./sbin/mpeinstall -prefix=$(PREFIX) -dmode="" ; \
         73       @if [ -n "$(prefix)" ] ; then \
         74            ./sbin/mpeinstall -prefix=$(prefix) -dmode="" ; \
        7575        else \
        7676            ./sbin/mpeinstall -dmode="" ; \
        7777        fi
        7878
        7979installcheck:
        80        @if [ -n "$(PREFIX)" ] ; then \
        81             ./sbin/mpecheckinstall -prefix=$(PREFIX) ; \
         80       @if [ -n "$(prefix)" ] ; then \
         81            ./sbin/mpecheckinstall -prefix=$(prefix) ; \
        8282        else \
        8383            ./sbin/mpecheckinstall ; \
        8484        fi
        8585
        8686installcheck-all:
        87        @if [ -n "$(PREFIX)" ] ; then \
         87       @if [ -n "$(prefix)" ] ; then \
        8888            if [ -n "$(MPERUN)" ] ; then \
        89                 ./sbin/mpecheckinstall -prefix=$(PREFIX) -run="$(MPERUN)" ; \
         89                ./sbin/mpecheckinstall -prefix=$(prefix) -run="$(MPERUN)" ; \
        9090            else \
        91                 ./sbin/mpecheckinstall -prefix=$(PREFIX) -run ; \
         91                ./sbin/mpecheckinstall -prefix=$(prefix) -run ; \
        9292            fi ; \
        9393        else \
        9494            if [ -n "$(MPERUN)" ] ; then \
      • ./src/mpi/romio/Makefile.in

        old new  
        134134
        135135install:
        136136       $(MAKE) clean
        137        @./util/romioinstall -prefix=$(PREFIX)
         137       @./util/romioinstall -prefix=$(prefix)
        138138
        139139# LAM added uninstall target
        140140uninstall:
        141        @./util/romioinstall -prefix=$(PREFIX) -uninstall
         141       @./util/romioinstall -prefix=$(prefix) -uninstall
        142142
        143143# FIXME: To avoid problems with noisy make programs, these should be accessed
        144144# through entries in localdefs .
  • type exit to finish cdbs-edit-patch. You can use exit 1 to skip creating patches if there is something wrong.
    root@r-mpi:/tmp/cdbs-new-patch.aj3114/mpich2-1.0.7.new# exit
    root@r-mpi:~/mpich2-1.0.7# cat debian/patches/01_Makefile.in.patch
    

Build New debian packages

  • Use dpkg-buildpackage command to build your new packages.
    root@r-mpi:~/mpich2-1.0.7# dpkg-buildpackage
    root@r-mpi:~/mpich2-1.0.7# ls ../*.deb
    ../libmpich2-1.0_1.0.7-1_i386.deb      ../mpich2_1.0.7-1_i386.deb      ../mpich2-mpd_1.0.7-1_i386.deb
    ../libmpich2-1.0-dev_1.0.7-1_i386.deb  ../mpich2-doc_1.0.7-1_i386.deb  ../mpich2-mpe_1.0.7-1_i386.deb
    

Result Download

Reference

  • Ubuntu karmic had mpich2 packages since 19 Jun 2009
Last modified 15 years ago Last modified on Sep 10, 2009, 8:28:16 PM