User Tools

Site Tools


programming:cross_compile_getdp

Cross compilation of getdp for Windows 32 under Debian Linux

Remark: This procedure may seem unnecessarily complicated, however, this is the only one I was able to get the result with.

Install VirtualBox

If you're working under Windows and you do not want to install Debian Linux to a separate partition, you may download and install VirtualBox and do the following steps in it.

Install Debian Linux

Get the latest testing installation CD from http://www.debian.org/devel/debian-installer/. Get the netinst image and install it to VirtualBox. There is a lot of guides for this online. I am not going to describe this in detail, since it would be needlessly redundant. Just give it about 1500 MB of memory. When asked, install just the desktop environment and standard system (defaults).

Install necessary tools for cross-compilation

Here I suppose that you have a working Debian Linux system. Now you need to install necessary tool invoking the following command (as root):

apt-get install build-essential autoconf automake fakeroot gcc-mingw32

Download, unpack and compile gsl

This is the classic procedure. In a little bit more detial, it's explained in the next sections. This is just a prerequisite for the getdp, that is built the similar, but easier way.

cd /tmp
wget http://mirrors.kernel.org/gnu/gsl/gsl-1.14.tar.gz
tar xvf gsl-1.14.tar.gz
cd gsl-1.14
./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --enable-shared
make
sudo make install

Download and unpack getdp

As a non-root user, get to the /tmp directory:

cd /tmp

Download the latest getdp source :

wget http://www.geuz.org/getdp/src/getdp-2.0.0-source.tgz

Unpack it:

tar xvf getdp-2.0.0-source.tgz

Switch to the source directory:

cd getdp-2.0.0

Cross compilation of getdp

The config file must be tweaked, else it won't compile. The following patch will do the job with getdp version 2.0.0:

getdp-2.0.0_strec.patch
diff -ru getdp-2.0.0/configure getdp-2.0.0_strec/configure
--- getdp-2.0.0/configure	2009-10-18 12:35:14.000000000 +0000
+++ getdp-2.0.0_strec/configure	2010-09-09 15:13:34.000000000 +0000
@@ -4180,15 +4180,7 @@
 if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h"; then
   eval "$as_ac_File=yes"
-else
-  eval "$as_ac_File=no"
-fi
 fi
 ac_res=`eval echo '${'$as_ac_File'}'`
 	       { echo "$as_me:$LINENO: result: $ac_res" >&5
@@ -4208,15 +4200,7 @@
 if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h"; then
   eval "$as_ac_File=yes"
-else
-  eval "$as_ac_File=no"
-fi
 fi
 ac_res=`eval echo '${'$as_ac_File'}'`
 	       { echo "$as_me:$LINENO: result: $ac_res" >&5
@@ -4251,15 +4235,7 @@
 if test "${ac_cv_file___contrib_Sparskit_Sparskit_cpp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "./contrib/Sparskit/Sparskit.cpp"; then
   ac_cv_file___contrib_Sparskit_Sparskit_cpp=yes
-else
-  ac_cv_file___contrib_Sparskit_Sparskit_cpp=no
-fi
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_file___contrib_Sparskit_Sparskit_cpp" >&5
 echo "${ECHO_T}$ac_cv_file___contrib_Sparskit_Sparskit_cpp" >&6; }
@@ -4673,15 +4649,7 @@
 if test "${ac_cv_file___contrib_Arpack_znaupd_f+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "./contrib/Arpack/znaupd.f"; then
   ac_cv_file___contrib_Arpack_znaupd_f=yes
-else
-  ac_cv_file___contrib_Arpack_znaupd_f=no
-fi
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_file___contrib_Arpack_znaupd_f" >&5
 echo "${ECHO_T}$ac_cv_file___contrib_Arpack_znaupd_f" >&6; }
@@ -4717,15 +4685,7 @@
 if test "${ac_cv_file___contrib_ZITSOL_1_zarms2_c+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "./contrib/ZITSOL_1/zarms2.c"; then
   ac_cv_file___contrib_ZITSOL_1_zarms2_c=yes
-else
-  ac_cv_file___contrib_ZITSOL_1_zarms2_c=no
-fi
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_file___contrib_ZITSOL_1_zarms2_c" >&5
 echo "${ECHO_T}$ac_cv_file___contrib_ZITSOL_1_zarms2_c" >&6; }
@@ -4975,16 +4935,8 @@
 if test "${ac_cv_file___contrib_NR_dsvdcmp_cpp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  test "$cross_compiling" = yes &&
-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "./contrib/NR/dsvdcmp.cpp"; then
-  ac_cv_file___contrib_NR_dsvdcmp_cpp=yes
-else
   ac_cv_file___contrib_NR_dsvdcmp_cpp=no
 fi
-fi
 { echo "$as_me:$LINENO: result: $ac_cv_file___contrib_NR_dsvdcmp_cpp" >&5
 echo "${ECHO_T}$ac_cv_file___contrib_NR_dsvdcmp_cpp" >&6; }
 if test $ac_cv_file___contrib_NR_dsvdcmp_cpp = yes; then
@@ -5033,7 +4985,7 @@
     ;;
 esac
 
-GETDP_LIBS="${GETDP_LIBS} -lm"
+GETDP_LIBS="${GETDP_LIBS} -lm -lws2_32"
 
 cat >>confdefs.h <<_ACEOF
 #define GETDP_CONFIG_OPTIONS "${BO}"

Download and apply the patch:

wget http://wiki.cizmar.org/filez/getdp-2.0.0_strec.patch
patch -p1 < getdp-2.0.0_strec.patch

Run the configure script with parameters:

./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --enable-sparskit --without-petsc

Compile it:

make

Rename the result:

mv bin/getdp bin/getdp.exe

Then, the resulting file is in /tmp/getdp-2.0.0/bin/getdp.exe. The gls library DLL may also be important: /usr/i586-mingw32msvc/bin/libgsl-0.dll.

programming/cross_compile_getdp.txt · Last modified: 2017/05/16 11:10 (external edit)