Skip to content

MXE Dependencies

Cecil Coupe edited this page Dec 31, 2018 · 5 revisions


MXE a great project to build the dependent libraries used by Shoes and other FOSS projects for Windows cross compiling. That build process has always been painful with Shoes. MXE can ease that pain and it enables some interesting options for the future. MXE runs on Linux and OSX. It's not tied to any particular Linux or package manager.

Of course, MXE has its own set of rules but we get benefits from those rules by giving up some our notions of what is correct. One gain to be explored in the future is cross building Shoes/Windows on OSX as well as Linux. It could be just as simple as the linux steps below - Simpler if we do some MXE work.


cd to where you want things. For me, it's a ~/Projects/shoesdeps which is a nfs export and a samba mount.

git clone
cd mxe

We want to default to just building 32 bit shared libraries - because that's what Shoes on Windows uses. Edit the file and add the MXE_TARGETS setting. Mine looks like

# This variable controls the targets that will build.
#MXE_TARGETS := i686-w64-mingw32.static i686-w64-mingw32.shared x86_64-w64-mingw32.static x86_64-w64-mingw32.shared
MXE_TARGETS := i686-w64-mingw32.shared

Now build one of the some smallish dependencies used by Ruby - zlib and then we can poke around to see what's where.:

ccoupe@bronco:~/Projects/shoesdeps/mxe$ make zlib

The very first build of any MXE package is going to build the gcc cross compilers and that takes time. (10 to 30 minutes). Notice that it builds zlib for both the i686-w64-mingw32.shared arch and the build machine, x86_64-pc-linux-gnu, Lets find the dll.

find . -name 'zlib*'

There it is: the dll, the .h and the .pc ! And log files and patches and source tar balls. Celebrate!

Now would be a good to fix up .bash_rc (or .bash_profile or ..) to put the MXE compilers in the PATH environmental variable as mentioned in the MXE instructions.

Shoes dependencies

When you cloned Shoes from github you got a plugin-mxe subdirectory. It contains the mxe formulas for gdbm, openssl-1.0.2, yaml and ruby. Remember where that plugin-mxe directory is. We need to do one other thing to improve life and tell about our plugin directory. Edit and add a line:

# This variable controls which plugins are in use.
# See plugins/ for further information.
#override MXE_PLUGIN_DIRS += plugins/apps plugins/native
override MXE_PLUGIN_DIRS += plugins/native /home/ccoupe/Projects/shoes3/plugin-mxe

Of course your location will be different.

OSX Note 1: Gettext locations can get confused between Apples version and Homebrew's version. Set the path before you build anything using gettext. In our case we need it in order to build some of the shoes deps. Sigh. export PATH=/usr/local/opt/gettext/bin:$PATH

OSX Note 2: If you are using homebrew it may have installed the very latest automake/conf/tools and it may be too new for some packages (gdbm for one). The fine folks at MXE actually have an older version you can build an use inside mxe. After the above edit for MXE_PLUGIN_DIRS do

make autoconf
make automake

Now it's going to get simple. Watch:

make shoesdeps

and watch the terminal. Thats it. You can install the packages individually if you like:

make bzip2
make libffi
make gtk3
make librsvg
make sqlite
make giflib
make MXE_PLUGIN_DIRS=~/Projects/shoes3/plugin-mxe openssl1.0
make MXE_PLUGIN_DIRS=~/Projects/shoes3/plugin-mxe yaml
make MXE_PLUGIN_DIRS=~/Projects/shoes3/plugin-mxe gdbm
make MXE_PLUGIN_DIRS=~/Projects/shoes3/plugin-mxe ruby
make nsis

The Ruby build is pretty quiet for many minutes as is the gtk3 and nsis builds. In fact, all the package builds take time. Believe me, you'll get error messages if something fails. What to do if there is an error: There are log files for the download phase and the build phase in the mxe log/ directory.

Download errors can be checksums that don't match AND/OR use the wrong url. See the log file. You can delete the downloaded file in pkg/ if you need to try it again.

Build errors are harder to debug. The log file has a lot of build information to help. You may have to remove artifacts to trigger a rebuild. for example, if you want to rebuild gdbm after you changed the file:

ccoupe@bronco:~/Projects/shoesdeps/mxe$ rm usr/i686-w64-mingw32.shared/installed/gdbm 
ccoupe@bronco:~/Projects/shoesdeps/mxe$ make MXE_PLUGIN_DIRS=~/Projects/shoes3/plugin-mxe gdbm
[plugin]      /home/ccoupe/Projects/shoes3/plugin-mxe/
[build]       gdbm                   i686-w64-mingw32.shared
[done]        gdbm                   i686-w64-mingw32.shared
              12220 KiB      0m15.360s

Note 3 If you run into trouble building pango: There may be conflicting options on versions and patches. The plugin's says 1.40.14 but there may be a in mxe/src. Remove the one in src and the pango patch file in mxe/src and then do make shoesdeps to continue.

Building Shoes

You need a mxe-custom.yaml file to tell Shoes where the dependencies are and what gems you want. Mine looks like:

Deps: /home/ccoupe/Projects/shoesdeps/mxe/usr/i686-w64-mingw32.shared
Ruby: /home/ccoupe/Projects/shoesdeps/mxe/usr/i686-w64-mingw32.shared
Gemloc: /home/ccoupe/Projects/gems/rb23
  - chipmunk*
  - sqlite3*
  - nokogiri*
  - mini_portile2*
  - byebug*
  - rb-readline*
  - win32-shortcut*
  - ffi*
  # picky needs:
  - activesupport*
  - concurrent-ruby*
  - i18n*
  - multi_json*
  - picky*
  - rack_fast_escape*
  - thread_safe*
  - tzinfo*
  - url_escape*
  - yajl-ruby*
  # typhoeus
  - ethon*
  - typhoeus*
  # because
  #- bloopsaphone-0.4
MS-Theme: true 
Debug: true
Deprecations: true 
Installer: nsis
InstallerLoc: /home/ccoupe/Projects/nsis/nsis3/bin/makensis

The Shoes target, 'mxe' uses the mxe cross compiler to build Shoes for Windows. Note: there is an mxe_osx target for OSX which does the same thing (given an mxe_osx-custom.yaml)

rake linux:setup:mxe


rake osx:setup:mxe_osx

shoes.exe and cshoes.exe are in the mxe directory.

NSIS installer.

This is clever. MXE is very clever. In the mxe directory, make nsis builds the native Linux (makensis) and the big bad makensis.exe. We can use the linux or osx version by changing our InstallerLoc: setting in the mxe-custom.yaml. Mine looks like

InstallerLoc: /home/ccoupe/Projects/shoesdeps/mxe/usr/i686-w64-mingw32.shared/bin/makensis

A rake package will trundle off and create a Shoes installer, which only runs on Windows of course.

Clone this wiki locally
You can’t perform that action at this time.