AMIDE: Amide's a Medical Imaging Data Examiner



Notes on compiling AMIDE and associated programs on Microsoft Windows

This is a long, involved process, and assumes a good command of standard GNU build environments. Be aware that these notes are fragmentary and may contain bugs and omissions.

The first step of the process involves setting up a build system to compile AMIDE for windows. There are three basic options. 1) Setup a cross-compilation setup under Linux - I've never tried this approach. 2) Use MinGW/MSYS on Windows - I've tried this approach, but have found it overly complex due to these packages being poorly maintained. 3) Use Cygwin with the MinGW libraries - this is the process I've been using. As I've essentially only been using the Cygwin + MinGW build system, the following text will be only directly relevant to this build system. Cygwin+MinGW means setting up cygwin such that compilation of applications inside of cygwin only depend on microsoft DLL's and don't depend on cygwin.dll.

Helpful Hints:

  • The following will show what DLL's a library or executeable you built depends on. If one of the DLL's is cygwin.dll or cygz.dll, you didn't setup your build environment correctly or the configuration scripts/makefiles for the package aren't setup correctly.
    	objdump -p filename.dll | grep DLL
    
  • To see what include files the compiler is dragging in, add -H to the gcc line in the Makefile
  • When stuck, suspect incorrect permissions on your DLL's. Sometimes third party DLL's get installed without correct permisions, do a "chmod a+x *.DLL" to fix that. Pop-up errors with 0x00022 (or something like that) as the error message are usually because of this.


Instructions

  1. Install cygwin. In addition to the default packages, you'll definitely need:
         autoconf
         automake
         gcc-mingw-core
         gcc-mingw-g++
    
    
         patch
    
    
    
    You'll probably also want:
         diffutils
         gdb
         ncftp
         openssh
         unzip
         zip
    
    
    
    
    
    

    And you'll need to add the following to .bash_profile
    
    
    	export CC='gcc -mno-cygwin -mms-bitfields'
    	export CXX='g++ -mno-cygwin -mms-bitfields'
    	export CPPFLAGS='-I/usr/local/include'
    	export LDFLAGS='-L/usr/local/lib'
            export PKG_CONFIG_PATH=C:/cygwin/usr/local/lib/pkgconfig
    
    The "mms-bitfields" is essential for making your gcc compiled executable be compatible with previously compiled DLL's as they are generally compiled with Visual C. The "mno-cygwin" tells gcc to not link to any of cygwin's DLL's. This means what will get produced will be a pure Windows application not dependent on anything from cygwin.

  2. You'll need an editor. You're welcome to use notepad if you want, but I like emacs. If you want to use emacs, you can install it as one of the cygwin packages, or install a windows version of emacs and make it so that you can run it from within cygwin. To do the later:
            goto http://ftp.gnu.org/pub/gnu/emacs/windows/ and download emacs
            unpack into c:/
            run bin/addpm.exe
            add "export PATH=$PATH:/cygdrive/c/emacs-21.3/bin" to the end of your .bash_profile
    

  3. You'll need a small application called png2ico for compiling amide. Place the executable in /usr/local/bin.
  4. From the gnome ftp site (or mirror) download the following win32 builds and install in /usr/local/
     dependencies/cairo-1.4.10.zip
     dependencies/cairo-dev-1.4.10.zip
     dependencies/expat-2.0.0.zip
     dependencies/fontconfig-2.4.2-tml-20071015.zip
     dependencies/fontconfig-dev-2.4.2-tml-20071015.zip
     dependencies/freetype-2.3.5.zip
     dependencies/freetype-dev-2.3.5.zip
     dependencies/gettext-0.14.5.zip
     dependencies/gettext-dev-0.14.5.zip
     dependencies/libxml2-2.6.27.zip
     dependencies/libxml2-dev-2.6.27.zip
     dependencies/pkg-config-0.20.zip
     atk/atk-1.20.0.zip
     atk/atk-dev-1.20.0.zip
     gail/1.20/gail-1.20.1.zip
     gail/1.20/gail-dev-1.20.1.zip
     glib/2.14/glib-2.14.4.zip
     glib/2.14/glib-dev-2.14.4.zip
     gtk+/2.12/gtk+-2.12.1.zip 
     gtk+/2.12/gtk+-dev-2.12.1.zip
     libart_lgpl/2.3/libart_lgpl-2.3.19.zip
     libart_lgpl/2.3/libart_lgpl-dev-2.3.19.zip
     libgnomecanvas/2.20/libgnomecanvas-2.20.1.zip
     libgnomecanvas/2.20/libgnomecanvas-dev-2.20.1.zip
     pango/1.18/pango-1.18.3.zip
     pango/1.18/pango-dev-1.18.3.zip
    
    

  5. From GnuWin32, download the following packages. You'll want the complete packages (binary and developer) if possible, and install them in C:\cygwin\usr\local\
         gsl (1.8) [use .exe]
         libjpeg (6b) [use .exe]
         libpng (1.2.8) [use .exe]
         libtiff (3.8.2) [use .exe]
    
         zlib (1.2.3) [only .zip available, also see notes below]
    
    To finish the install of zlib:
        cd /usr/local/
        mv zlib1.dll /bin/
        dlltool --dllname bin/zlib1.dll --input-def lib/zlib.def --output-lib lib/libz.dll.a
    
    The gsl win32 packages dont' include gsl-config. We'll need this for autodetecting gsl later. So download the gsl sources zip from gnuwin32, unpack, and then:
       ./configure --build=mingw32
       chmod a+x gsl-config
       cp gsl-config /usr/local/bin
    

  6. After completing the above two steps, you'll need to modify the permissions of the DLL's along with some of the EXE's to get things to work. To modify these permissions:
          cd /usr/local
          chmod a+x `find ./ -name "*.dll"` `find ./ -name "*.exe"`
    

  7. You'll need a version of make that works. The version that is currently shipped with cygwin (3.81) has issues with it (manifested as "multiple target patterns" error messages). We'll be using version 3.80. It's available here. Install it in the root directory of cygwin.

  8. From the AMIDE download page, get volpack.
          ./configure --enable-static=no --build=mingw32
          make
          make install
    

  9. Get xmedcon. You'll need version >= 0.10.0
    
    
          ./configure --build=mingw32 --enable-static=no --prefix=/usr/local
    
          make
    
          make install
    
    You'll want to edit /usr/local/bin/xmedcon-config, and make sure there's no "^M". There may be one on line 64, and line 72.

  10. Get libfame along with the patches here. Note, the windows libraries on the web site will not work! You'll need at least version 0.9.1. To recompile:
          patch -p1 < libfame-0.9.1_conf_updates1.patch
          patch -p1 < libfame-0.9.1_conf_updates2.patch
    
          ./configure --enable-mmx=no --enable-static=no --build=mingw32
          make
    
          make install
          chmod a+x libfame-config
          cp libfame-config /usr/local/bin
    

  11. Get the DCMTK library. You'll want the "Unix" package (.tar.gz). Version 3.5.4 is known to work. I've been unable to figure out any reasonable way of building this package as DLL's under cygwin/mingw, so we'll just have to build static libraries and live with it. To compile:
         ./configure --disable-threads --build=mingw32
         make
         cd dcmdata/libsrc
         [edit mkdictbi.cc - change "LPTSTR" to "WCHAR *" on line 161]
         [edit Makefile - add -lnetapi32 to LOCALLIBS]
         make mkdictbi
         ./mkdictbi.exe ./dicom.dic ./private.dic > dcdictbi.cc
         make
         cd ../..
         make install  [this will error out, ignore this]
    
         make install-lib
    

  12. Finally, get AMIDE.
    
         ./configure --build=mingw32 --enable-amide-debug=no \\
                     --enable-gtk-doc=no --disable-doc
         make
         make install    
    

  13. Now for generating amide_setup.exe. In the amide's sources win32 directory, there's a file amide-VERSION.iss. This file is used by Inno Setup, a neat little program for generating windows application install programs. We first need to setup the directory for Inno Setup to use. We need to create an amide folder, several subdirectories inside of it, and copy several files into the folders. Do the following (where Desktop is the path to your Desktop directory):
         mkdir Desktop/amide-VERSION/bin
         mkdir Desktop/amide-VERSION/lib
         mkdir Desktop/amide-VERSION/share
         mkdir Desktop/amide-VERSION/share/pixmaps
    
    
    
    
    Copy the following from /usr/local/bin to Desktop/amide-VERSION
      amide.exe
    
    Copy the following from /usr/local/bin to Desktop/amide-VERSION/bin
         xmedcon.exe
         medcon.exe
         iconv.dll
         intl.dll
         jpeg62.dll
         libart_lgpl_2-2.dll
         libatk-1.0-0.dll
         libcairo-2.dll
         libfame-0.dll
         libgailutil-18.dll
         libgdk_pixbuf-2.0-0.dll
         libgdk-win32-2.0-0.dll
         libglib-2.0-0.dll
         libgmodule-2.0-0.dll
         libgnomecanvas-2-0.dll
         libgobject-2.0-0.dll
         libgsl.dll
         libgslcblas.dll
         libgthread-2.0-0.dll
         libgtk-win32-2.0-0.dll
         libpango-1.0-0.dll
         libpangocairo-1.0-0.dll
         libpangoft2-1.0-0.dll
         libpangowin32-1.0-0.dll
         libpng13.dll
         libtiff3.dll
         zlib1.dll
         freetype6.dll
         libfontconfig-1.dll
         libexpat.dll
         libmdc-2.dll
         libvolpack-1.dll
         libxml2.dll
    
    To setup things in the amide-VERSION/lib directory
         cp -a /usr/local/lib/locale Desktop/amide-VERSION/lib
    
    From the amide source directory, do:
      cp COPYING 
      cp pixmaps/amide_logo.png amide-VERSION/share/pixmaps
      cp pixmaps/amide_file_logo.png amide-VERSION/share/pixmaps
    
    And to create .html files for the windows help browser, on a box with xsltproc installed (like a linux box), run the following and copy the resulting help directory into Desktop/amide-VERSION/share/gnome/help
    mkdir amide amide/C amide/es
    cd help/C
    xsltproc /usr/share/sgml/docbook/xsl-stylesheets/xhtml/chunk.xsl \
             /usr/share/gnome/help/amide/C/amide.xml
    cp index.html amide.html
    cp -a /usr/share/gnome/help/amide/C/figures ./
    cd ../es
    xsltproc /usr/share/sgml/docbook/xsl-stylesheets/xhtml/chunk.xsl \
             /usr/share/gnome/help/amide/es/amide.xml
    cp index.html amide.html
    cp -a /usr/share/gnome/help/amide/C/figures ./
    

  14. Now just compile using Inno Setup, and that should be it.....




last modified AML 2007-12-17 Validate: CSS & HTML Project hosted by: SourceForge.net Logo