Agar

   <-- Back to Documentation

Installing Agar on Windows 64-bit (MinGW-w64)

This guide describes the recommended procedure for producing a native 64-bit Windows build of Agar and Agar applications (for a 32-bit host, see instead: Installing on Windows 32-bit).

We are cross-compiling to a MinGW host, so the build will consist of native Windows executables and DLLs. This may be done from the Cygwin shell, MSYS, a BSD or Linux system, or any other environment where a MinGW cross-compiler is available.

The Cygwin environment is convenient for cross-compiling since most of the MinGW cross-compilation environment is already available in binary package form.

The procedure described here was tested on fresh install of Windows 7 (64-bit), with all available updates installed.

Installing required Cygwin packages

Before you continue, make sure that your Cygwin installation is up to date. Run Cygwin Setup and ensure that the following packages are enabled:

  • Devel / make
  • Devel / gcc-core
  • Devel / mingw64-x86_64-binutils
  • Devel / mingw64-x86_64-gcc-core
  • Devel / mingw64-x86_64-pthreads
  • Devel / mingw64-x86_64-runtime
  • Devel / mingw64-x86_64-pkg-config

The following packages are optional:

  • Devel / mingw64-x86_64-freetype2 (recommended font engine)
  • Devel / mingw64-x86_64-libjpeg-turbo (for JPEG image support)
  • Devel / mingw64-x86_64-libpng (for PNG image support)
  • Devel / mingw64-x86_64-SDL (for the Agar drivers sdlfb and sdlgl)
  • Devel / mingw64-x86_64-gettext (for multi-language support)
  • Devel / mingw64-x86_64-win-iconv (for multi-language support)

Developers may also wish to install:

  • Archive / unzip
  • Devel / gdb
  • Devel / patch
  • Devel / subversion
  • Interpreters / perl (for ./configure --srcdir feature)
Setting up the environment

Start up the Cygwin shell. Set the $MINGWROOT environment variable to the installation directory. For quick access, you may also wish to create a shortcut to this directory in your Desktop or Favorites.

  export MINGWROOT="/usr/x86_64-w64-mingw32/sys-root/mingw"

It is good practice to use -g in your global compiler flags, so that debugging information will be included in the build:

  export CFLAGS="-O2 -g"
  export CXXFLAGS="-O2 -g"

Using -O0 instead of -O2 can also improve the debugger's ability to produce reliable traces.

Agar installation

Download the Agar sources, compile and install using:

  $ tar -xzf agar-1.5.0.tar.gz
  $ cd agar-1.5.0
  $ ./configure --host=x86_64-w64-mingw32 \
      --prefix=$MINGWROOT \
      --enable-debug \
      --with-{freetype,sdl,png,jpeg,gl}=$MINGWROOT \
      --without-{fontconfig,sndfile,gettext,iconv}
  $ make depend all && make install

There are a number of build options available (see ./configure --help).

  • --enable-debug is recommended for developers, since it enables assertions and type safety checking for event handler arguments.
  • Omit --with-sdl if the SDL drivers are not needed.
  • Omit --with-png and --with-jpeg if the ability to load images in PNG and JPEG format is not required.
  • For native language support, add --enable-nls, --with-iconv=$MINGWROOT and --with-gettext=$MINGWROOT.

If you wish to make the Agar manual available from cygwin's manual reader, append $MINGWROOT/share/man to your /etc/man.conf. If you don't need the manual installed, using the ./configure --without-manpages option will speed up the build process.

Test suite installation

Agar provides a test suite for developers, agartest.exe. It must be compiled and installed separately.

  $ cd agar-1.5.0/tests
  $ ./configure --host=x86_64-w64-mingw32 \
      --prefix=$MINGWROOT \
      --with-agar=$MINGWROOT
  $ make depend all && make install

Then execute the installed agartest.exe in the $MINGWROOT\bin directory.

You can also check that Agar is working with hello.c:

  #include <agar/core.h>
  #include <agar/gui.h>
  
  int
  main(int argc, char *argv)
  {
          AG_Window *win;
          
          if (AG_InitCore(NULL, AG_VERBOSE) == -1 ||
              AG_InitGraphics(0) == -1) {
		AG_Verbose("Init failed: %s\n", AG_GetError());
		return (1);
	  }
          win = AG_WindowNew(0);
          AG_LabelNew(win, 0, "Hello, world!");
          AG_WindowShow(win);
          AG_EventLoop();
          return (0);
  }

To compile hello.c as a standalone Windows executable, use:

  $ x86_64-w64-mingw32-cc -o hello \
      `$MINGWROOT/bin/agar-config --cflags` hello.c \
      `$MINGWROOT/bin/agar-config --libs`

BSDBuild is a BSD-style build system which provides useful make libraries as well as the ability to generate GNU-compatible configure scripts.

Troubleshooting

1) If you are using Agar's wgl driver (the default on Windows) and your application freezes a few seconds after focus is switched to a different application, this is an Aero bug affecting OpenGL applications. To disable Aero, right-click on the Windows Desktop, click on Personalize, and select a basic theme such as "Windows Classic". Alternatively, you can work around this problem using a compatibility tweak: right-click on your application .exe file, go to Properties / Compatibility, and check the "Disable visual themes" option.


Csoft.net ElectronTubeStore.com