Building Davinci for Windows

From DavinciWiki

Jump to: navigation, search


Contents

Procedure for building davinci under windows (MINGW/MSYS) (based on Monopoly windows machine at Mars Space Flight Facility)

Subversion locations

  • davinci
svn checkout http://oss.mars.asu.edu/svn/davinci/trunk davinci
  • iomedley
svn checkout http://oss.mars.asu.edu/svn/davinci/iomedley/trunk  davinci/iomedley
  • MINGW Build util
svn checkout http://oss.mars.asu.edu/svn/davinci/davinci_build/trunk/windows davinci/build_utils

Compiling and Building under MINGW/MSYS environment

Mingw and MSYS are installed in "monopoly" windows machine To start MSYS run D:\mingw_msys\msys\msys.bat where the msys window opens. From there you can run configure scripts.

All davinci necessary applications are located under D:\mingw_msys\msys\apps\ and they are installed under directory "/mingw" using configure flag "--prefix=/mingw Dependencies such as zlib, readline, regex, hdf5 are already installed under /mingw so there is no need to re-install them.


To build davinci copy davinci and iomedley in monopoly as follows

D:\mingw_msys\msys\davinci 
D:\mingw_msys\msys\davinci\iomedley


Building Davinci

Run msys.bat. And then get into the davinci directory

cd /d/mingw_msys/msys/davinci

Build libltdl

cd libltdl
./configure
make
cd ../


Build iomedley

cd iomedley
./configure
make
cd ../

Build davinci

./configure
make


Building Davinci and its shared modules

(This step Assumes that Davinci has already been built in a normal way. This just makes a proper linking)

If you want to make davinci support loadable modules, you must create a dll file that contains everything except main.o. And then link main.o against davinci.dll. Also modules need to be linked against davinci.dll for undefined references to be resolved. This was necessary since MINGW has problems building shared libraries if the references are not resolved. If you can build shared modules, this section is not necessary.


Create davinci.dll, davinci.exe and modules

cd build_utils
./makewin.sh

After the build copy the files to the project directory

cp davinci.exe /d/mingw_msys/davinci_win/project/
cp davinci.dll /d/mingw_msys/davinci_win/project/
cp modules/* /d/mingw_msys/davinci_win/project/modules


Generation of Windows Installation file

  1. Open InstallJammer
    1. Start the installjammer under D:\mingw_msys\davinci_win\installjammer\installjammer.exe (Note the version of installjammer you are running)
    2. Open D:\mingw_msys\davinci_win\davinci_installer.mpi
  2. Verify the files you want to include in the Setup File under the Components and Files/Groups and Files.
  3. Click on the "Build Install" icon.
  4. The setup file is generated at D:\mingw_msys\davinci_win\output\


Install Davinci

Simply double click in Davinci-<version>-Setup.exe and follow the instructions. By default Davinci is installed at C:\Program Files\Davinci

Run Davinci

To run Davinci, click on Start->Program Files->Davinci->Davinci.bat

Please not that Davinci.bat sets necessary environment variables, so always run davinci.bat instead of directly davinci.exe

Davinci v1.63 and iomedley MinGW Porting Procedure (February 2007)

The following steps were performed to build davinci under windows Machine: monopoly Location: D:\mingw_msys\msys\apps\

CFITSIO v3.040

tar -zxvf cfitsio3040.tar.gz
cd cfitsio
./configure --prefix=/mingw
make
make install
mkdir /mingw/include/cfitsio
cp /mingw/include/fitsio* /mingw/include/cfitsio/

ZLIB

tar zxvf zlib-1.2.3.tar.gz
tar xvf zlib-1.2.3-mingwPORT-1.tar
cd zlib-1.2.3/mingwPORT
./mingwPORT.sh

readline

tar zxvf readline-5.0 
tar xvf readline-5.0-mingwPORT.tar  
cd readline-5.0/mingwPORT
./mingwPORT.sh

regex-0.1.2

(since it is missing in mingw - not full POSIX implementation)

tar zxvf regex-0.12.tar.gz
cd regex-0.12
env CC=mingw32-gcc ./configure --prefix=/mingw i686-pc-mingw32
make subdirs=
ar ru libregex.a regex.o
cp regex.h /mingw/include
cp libregex.a /mingw/lib

hdf5-1.6.5

tar zxvf hdf5-1.6.5.tar.gz 
cd hdf5-1.6.5
./configure --prefix=/mingw
make
make install (after the changes)
  • change 1

In the file File: src/H5FDstream.c Replace the lines:

#include <netdb.h>                    /* gethostbyname                       */
#include <netinet/in.h>

With:

#if __MINGW32__
#define EWOULDBLOCK	WSAEWOULDBLOCK
#else
#include <netdb.h>                    /* gethostbyname                       */
#include <netinet/in.h>               /* socket stuff                        */
#endif
  • change 2
In the  MINGW file mingw/objidl.h (this might be dangerous)
changed STORAGELAYOUT to STORAGELAYOUT2 
After the compilation, changed it back to STORAGELAYOUT
  • changes 3
In the file
src/Makefile
Added lib -lwsock32
  • change 4
In the file tools/misc/h5repart.c Int he line
#if defined(WIN32) && ! defined (__MWERKS__) && ! defined (__MINGW32__)
added MINGW32
  • change 5
In the file perform/zip_perf.c
ignored the line #include <sys/uio.h> if compiling ander MINGW32

These changes were performed at iomedley to work with MinGW

  • 1.File: configure and 2. configure.ac

changed giflib-4.1.4 to libgif

  • 3. File: mungelibs modified
  • 4. File: Makefile.in

LIBTIFF = libtiff.a LIBTIFFDIR = tiff-3.8.2

LIBGIF = libgif.a LIBGIFDIR = libgif

CPPFLAGS=-I. -I$(LIBTIFFDIR)/libtiff -I$(LIBJPEGDIR) -I$(LIBGIFDIR) @CPPFLAGS@


Made the section $(LIBTIFF) to $(LIBTIFF): cd $(LIBTIFFDIR) && $(MAKE)


  • 5. File: io_tiff.c

changed "ushort" to "unsigned short"

  • 6.

Removed the old libtiff directory. Added new dir tiff-3.8.2

  • 7.

giflib-4.1.4 is not used anymore but libgiff instead

  • 8. io_lablib3.c

added

#ifdef _WIN32
#define mkstemp(p) open(_mktemp(p), _O_CREAT | _O_SHORT_LIVED | _O_EXCL)
#endif


These changes were performed at Davinci to work with MinGW

  • 1. configure
  • 2. configure.ac

Added -lwsock32 at HDF5 link flags

Makefile

LIBS = -lreadline -lhdf5 -lz -lm     -lregex -lwsock32 -lltdlc
  • 3. parser.h
  • 3.1#commented out the include dos.h and relevant things
  • 3.2 removed the definitions for w_readline
  • 4. ff_modules.c
  • 4.1added
  1. ifdef __MINGW32__
  2. include <dirent.h>
  3. endif
  • 4.2 removed ifdefs around find_next_file_with_prefixl


  • 5. dvio_themis.c
  1. if defined(___CYGWIN__) || defined(__MINGW32__)
  • 6. Added file win_mmap.h under win32
  • 7. File: ff.c Line: 1750

added some ifdefs

  • 8. ff_loadvan.c

changed uint to unsigned int

  • 9. ff_struct.c
  1. if !( defined( __CYGWIN__) || defined(__MINGW32__))
  • 10. ff_bin5.c

included win_mmap

  • 11. header.c

changed ushort to unsigned short

  • 12 main.c

fixed SIGUSR1 defined ctime_r as ctime changed drand48 to rand

  • 13. util.c

commented out dos.h

  • 14. dvio_tdb.c

changed ushort to unsigned short

  • 15.

Makefile.in Makefile added flags

  • 16. io_loadmod.c

defined strok_r as strok

  • 17. system.c

Did a workaround for mkstemp

  • 18. ff_display.c

Added system support for mingw when displaying image