1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
|
########################################################################
# HOW TO INSTALL A CROSS-COMPILING (LINUX -> MS) G++ COMPILER
########################################################################
This file is supposed to live in
sanity@lamarc.gs.washington.edu:cross-tools/cross-notes.txt
#########################################
# Where to put it
I installed stuff in the "sanity" user account on lamarc. You should be
able to read and use stuff there just by following the path
/net/gs/vol1/home/sanity
If you want to make changes, you'll need the IT folks to give you sudo
access. Once that is done, you can log in this way:
sudo -H -s -u sanity
#########################################
# Getting the packages
I used the link below as my starting point, though I've also built
cross-compilers before, and can tell you that the correct thing to do
will likely change by the time you next wish to update the compilers
http://www.blogcompiler.com/2010/07/11/compile-for-windows-on-linux/
I went to the mingw-64 sourceforge page here:
http://sourceforge.net/projects/mingw-w64/files/
and from there followed each of
* Toolchains targeting Win64 > Personal Builds
* Toolchains targeting Win32 > Personal Builds
Ending up with the following two tar files:
mingw-w32-bin_x86_64-linux_20110510_sezero.tar.gz
mingw-w64-bin_x86_64-linux_20110510_sezero.tar.gz
Note that the part that says 'x86_64-linux' refers to the machine
you will run the cross-compiler on. I chose lamarc.gs.washington.edu
I untar'd the packages and installed them under
/net/gs/vol1/home/sanity/cross-tools
#########################################
# Using the compilers -- 64 bit lamarc.exe
I recommend that before you try to build lam_conv.exe (the windows
version of the converter gui), you first build the plain lamarc.exe
executable. This is because lam_conv.exe requires compiling wxWidgets,
which is typically more complicated than building lamarc.exe
Here are the steps I used to cross-compile a lamarc-only (no converter)
64-bit version of lamarc.exe on lamarc.gs.washington.edu
# Step 1:
# create a directory and check a new lamarc distribution out in it
mkdir myBuildDir
cd myBuildDIr
export CVS_RSH=ssh
export CVSROOT=/local/cvs
cvs co -P lamarc
# Step 2:
# invoke modules to get a more modern default g++ compiler and
# library. this is interesting -- we're not going to use the
# resulting compiler for our code, but our compiler needs
# access to some of its libraries
. /etc/profile.d/modules.sh
module load modules modules-init modules-gs
module load gmp mpfr/2.4.1 gcc
# Step 3:
# get the desired cross-compiler on our $PATH
export CROSS_HOME=/net/gs/vol1/home/sanity/cross-tools/cross_win64
export HOST_TYPE=x86_64-w64-mingw32
export PATH=$CROSS_HOME/bin:$CROSS_HOME/$HOST_TYPE/bin/:$PATH
# Step 4:
# unfortunately, in order to make the modules command make everything
# 'just work' for the typical user, several environment variables
# are set which hose the cross-compiling process. these steps
# undo that
unset CC
unset CPP
unset CXX
unset CPPFLAGS
unset LDFLAGS
# Step 5:
# make sure the autotools-produced Makefiles are up-to-date
# I used automake and autoconf
# If you update to new versions, you may need to change these
# directions as well as the Makefile.am and configure.ac files
cd lamarc
aclocal
autoconf
automake
# Step 6:
# configure and make the executable
mkdir rel64
cd rel64
../configure --disable-converter --host=$HOST_TYPE
make lamarc.exe
#########################################
# Using the compilers -- 32 bit lamarc.exe
To build a 32-bit windows executable, do as above, but replace steps 3
and 6 with these:
# Step 3 for win-32
export CROSS_HOME=/net/gs/vol1/home/sanity/cross-tools/cross_win32
export HOST_TYPE=i686-w64-mingw32
export PATH=$CROSS_HOME/bin:$CROSS_HOME/$HOST_TYPE/bin/:$PATH
# Step 6 for win-32
mkdir rel32
cd rel32
../configure --disable-converter --host=$HOST_TYPE
make lamarc.exe
#########################################
# building wxWidgets-enabled lam_conv.exe
Once you have the the above working, you can try to cross-compile
lam_conv.exe . First make sure you have cross-compiled versions
of the wxWidgets library. See here:
sanity@lamarc.gs.washington.edu:wx-libs/wx-notes.txt
Assuming things are cool there, here's the instructions for
a 64-bit lam_conv.exe on lamarc.gs.washington.edu
# modules as above
. /etc/profile.d/modules.sh
module load modules modules-init modules-gs
module load gmp mpfr/2.4.1 gcc
# get the desired cross-compiler on our $PATH
export CROSS_HOME=/net/gs/vol1/home/sanity/cross-tools/cross_win64
export HOST_TYPE=x86_64-w64-mingw32
export PATH=$CROSS_HOME/bin:$CROSS_HOME/$HOST_TYPE/bin/:$PATH
# remove unfortunate modules side-effects
unset CC
unset CPP
unset CXX
unset CPPFLAGS
unset LDFLAGS
# configure for compilation with wxWidgets cross-compiled library
cd <path to lamarc checkout>
export WX_LIB=/net/gs/vol1/home/sanity/wx-libs/
mkdir wxRel64
cd wxRel64
../configure --host=$HOST_TYPE \
--with-wx-config=/net/gs/vol1/home/sanity/wx-libs/wxMSW/bin/wx-config
make lam_conv.exe
# and now the same for 32 bits
# modules as above
. /etc/profile.d/modules.sh
module load modules modules-init modules-gs
module load gmp mpfr/2.4.1 gcc
# get the desired cross-compiler on our $PATH
export CROSS_HOME=/net/gs/vol1/home/sanity/cross-tools/cross_win32
export HOST_TYPE=i686-w64-mingw32
export PATH=$CROSS_HOME/bin:$CROSS_HOME/$HOST_TYPE/bin/:$PATH
# Step 4:
# remove unfortunate modules side-effects
unset CC
unset CPP
unset CXX
unset CPPFLAGS
unset LDFLAGS
# configure for compilation with wxWidgets cross-compiled library
cd <path to lamarc checkout>
export WX_LIB=/net/gs/vol1/home/sanity/wx-libs/
mkdir wxRel32
cd wxRel32
../configure --host=$HOST_TYPE \
--with-wx-config=/net/gs/vol1/home/sanity/wx-libs/wxMSW/bin/wx-config
make lam_conv.exe
|