Menu

Building Fuse on Windows with Cygwin

Sergio Baldoví

1. Introduction

This page describes how to build Fuse on Windows using Cygwin (http://www.cygwin.com), a collection of tools which provide a Linux look and feel environment for Windows. We will use Mingw-w64 cross compiler to produce native Windows libraries and applications. These instructions are correct as of May 2023.

Caution, line endings should be Unix style (LF), so use a text editor that can handle them (e.g., Notepad++).

2. Setting up the environment

Cygwin installation

Download the installer of Cygwin and run the setup program.

You should select the following packages (some others will automatically be selected as well):

Devel
  autoconf
  automake 
  bison
  flex
  gcc-core
  gcc-g++
  gettext-devel
  libtool
  make
  mingw64-i686-bzip2
  mingw64-i686-gcc-core
  mingw64-i686-gcc-g++
  mingw64-i686-libgcrypt
  mingw64-i686-libgpg-error
  mingw64-i686-libpng
  mingw64-i686-win-iconv
  mingw64-i686-winpthread
  mingw64-i686-zlib
  pkg-config

Perl
  perl

Then execute the shortcut created by the setup.

Environment variables

Custom build libraries will be installed into the prefix /usr/local/i686-w64-mingw32:

$ mkdir -p /usr/local/i686-w64-mingw32

In order to locate custom build libraries at build time and don't use the native Cygwin libraries, you need to manually pass some variables to the configure scripts, but it is easier to export some variables, e.g.,

$ export CPPFLAGS=-I/usr/local/i686-w64-mingw32/include
$ export LDFLAGS=-L/usr/local/i686-w64-mingw32/lib
$ export PKG_CONFIG_LIBDIR=/usr/local/i686-w64-mingw32/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig

If you are not interested in compiling binaries for the Cygwin environment and want to make this setting permanent, you could add these lines into $HOME/.bash_profile and execute:

$ source $HOME/.bash_profile

Anyway, check out the value of these variables before continuing:

$ echo $CPPFLAGS
$ echo $LDFLAGS
$ echo $PKG_CONFIG_LIBDIR

3. Building dependencies

Let's start building some libraries needed by libspectrum and Fuse. Only libspectrum is a requirement for Fuse, the rest provide some features than could be disabled. Usually, you should use the latest version available.

audiofile

Upstream source tarball from <http://audiofile.68k.org/> is outdated (version 0.3.6). Download latest git source code with some Debian patches:
https://github.com/sbaldovi/audiofile/archive/refs/heads/patched.zip

and then build the library:

$ cd audiofile-patched/
$ ./autogen.sh --build=i686-pc-cygwin --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32 --disable-static --disable-flac --disable-docs --disable-examples
$ make
$ make install-strip
$ cd ..

libxml2

Get the source tarball from <ftp://xmlsoft.org/libxml2/>. The current version is 2.9.12.

$ cd libxml2-2.9.12/
$ ./configure --build=i686-pc-cygwin --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32 --disable-static --without-python --without-lzma --with-minimum --with-tree --with-writer
$ make
$ make install-strip
$ cd ..

libspectrum

Get the source tarball from <http://sourceforge.net/projects/fuse-emulator/files/libspectrum/>. The current version is 1.5.0.

$ cd libspectrum-1.5.0/
$ ./configure --build=i686-pc-cygwin --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32 --disable-static --with-fake-glib
$ make
$ make install-strip
$ cd ..

4. Building Fuse

Get the source tarball from <http://sourceforge.net/projects/fuse-emulator/files/fuse/>. The current version is 1.6.0.

$ cd fuse-1.6.0/
$ export XML_CFLAGS=-I/usr/local/i686-w64-mingw32/include/libxml2
$ export XML_LIBS="-L/usr/local/i686-w64-mingw32/lib -lxml2"
$ ./configure --build=i686-pc-cygwin --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32 --with-win32
$ make
$ make dist-win32-dir

That should make the fuse-1.6.0-win32/ directory with almost all files.

The application will need some custom build libraries from /usr/local/i686-w64-mingw32/bin:

libaudiofile-1.dll
libspectrum-9.dll
libxml2-2.dll

and some precompiled libraries from /usr/i686-w64-mingw32/sys-root/mingw/bin:

libbz2-1.dll
libgcc_s_sjlj-1.dll
libgcrypt-20.dll
libgpg-error-0.dll
libpng16-16.dll
libstdc++-6.dll
libwinpthread-1.dll
zlib1.dll

Congratulations! You have now built Fuse for Windows from sources.

5. Alternative builds

The SDL UI doesn't look like a native Windows application but has some nice features like full-screen. To build this flavour take these extra steps...

Install the libSDL 1.2 library with this Cygwin package:

Devel
  mingw64-i686-SDL

Configure Fuse with these options:

$ export SDL_CONFIG=/usr/i686-w64-mingw32/sys-root/mingw/bin/sdl-config
$ ./configure --build=i686-pc-cygwin --host=i686-w64-mingw32 --prefix=/usr/local/i686-w64-mingw32 --without-win32 --with-sdl

Finally copy also this library to the fuse-1.6.0-sdl/ directory:

SDL.dll

Related

Wiki: Home

Discussion

  • Arki55

    Arki55 - 2022-11-12

    Hi.

    Trying out the whole process in November 2022, Windows 10.
    - Installing CyGWIN - OK, but it is very confusing giving the possibilities of various libraries and versions when installing. Had to run the setup multiple times. And it seems that something is not in the list : autogen, configure
    - Executing ./configure not possible with fresh clone of any source code. ./autogen.sh has to be executed before that.
    - When cloning libraries, be sure to first disable AutoCrLF (off). Really, really.. or suffer when redoing everything :)
    - No need for patch in latest version of audiofile, line already changed there.
    - libxml2/include/libxml directory needs to be copied to "fuse" dir before compiling the app
    - can't compile audiofile yet..

    When running, problems with dlls:
    - libspectrum-9.dll ... not 8. Not sure what it depends on..

    App compiled, I can run it even with my addition, without audiofile.
    Maybe it's needed only by some sub function.

     

    Last edit: Arki55 2022-11-12
    • Sergio Baldoví

      Sergio Baldoví - 2023-05-31

      Fixing a build environment is part of the fun ;-)

      libspectrum-9.dll ... not 8. Not sure what it depends on..

      The number bumps when the ABI changes and old executables can't safely use a newer DLL library.

       

Log in to post a comment.

MongoDB Logo MongoDB