Posted by: wbailer | January 17, 2012

Shogun Machine Learning Toolbox under Win64

I’ve used the Shogun Machine Learning Toolbox under Win32, compiled in the Cygwin environment, as described in the documentation. However, for processing a large data set, I needed a 64bit build. As there is currently no 64bit version of Cygwin, I followed the approach described here, using MinGW-w64.

The current version of Cygwin includes MinGW-w64, as well as an appropriate build of pthreads (if needed: compile pthreads as described here).

To configure, pass the MinGW-w64 to the script:

--cc=/usr/bin/x86_64-w64-mingw32-gcc --cflags=-m64
--cxx=/usr/bin/x86_64-w64-mingw32-gcc --cxxflags=-m64

Note: the path needs to be included due to a bug in MinGW-w64, as described on the MinGW-w64 site:

The mingw-w64 toolchain has been officially added to Cygwin mirrors, you can find the basic C toolchain as mingw64-x86_64-gcc-core. The languages enabled are C, Ada, C++, Fortran, Object C and Objective C++. There is a known caveat where calling the compiler directly as “/bin/x86_64-w64-mingw32-gcc” will fail, use “/usr/bin/x86_64-w64-mingw32-gcc” instead and make sure that your PATH variable has “/usr/bin” before “/bin”.

In addition, we add the following libraries to the linker:

-lstdc++ -lmsvcrt -lpthread

As MinGW-w64 has WIN32 defined (in contrast to GCC under Cygwin), there are a number of issues in the Shogun code that need to be fixed (see patch).

Currently, the following issues in the code are still unresolved:

  • only command line static interface is supported
  • MemoryMappedFile is not implemented (needs reimplementation based on Win API

After the Shogun library is built, ranlib needs to be run before building the command line interface:

/usr/bin/x86_64-w64-mingw32-ranlib shogun/libshogun.a

The resulting command line application needs the MinGW DLLs in the path. It also has the following limitations:

  • some strange characters in console (instead of colors)
  • issues with locale setting in when serialising/parsing files
  • applications exists on exceptions from SG_ERROR


  1. I failed to install shogun on latest version Cygwin on Win-32.
    dealing with the python_modular, as described in the documentation
    ./configure –interfaces=python_modular
    make DESTDIR= install (failed here)
    errorlog as below:

    Administrator@PC–20130406RRE ~/shogun/shogun-2.1.0/src
    $ make DESTDIR= install
    make -C shogun install
    make[1]: 进入目录“/home/Administrator/shogun/shogun-2.1.0/src/shogun”
    install -d -m755 /usr/local/lib
    install -d -m755 “/usr/local/include/shogun”
    install -m755 libshogun-13.0.dll /usr/local/lib
    install -m755 libshogun.a /usr/local/lib
    find ./ -mindepth 1 -type d ! \( -path ‘*.git*’ -o \
    -path ‘*interface*’ -o -path ‘*doxygen*’ -o -path ‘*tapkee*’ \)\
    -exec install -d -m755 “/usr/local/include/shogun/”\{\} \;
    find ./ -mindepth 1 -type d ! \( -path ‘*.git*’ -o -path ‘*wrap*’ -o \
    -name ‘*optimization’ -o -name ‘*transfer’ -o -path ‘*tapkee*’ -o -path ‘*doxygen*’ \) \
    -exec sh -c “install -m644 {}/*.h /usr/local/include/shogun/{}” \;
    install: 无法获取”./.settings/*.h” 的文件状态(stat): No such file or directory
    rm -f /usr/local/lib/libshogun.dll /usr/local/lib/libshogun-13.dll
    cd /usr/local/lib && ( ln -s libshogun-13.0.dll libshogun.dll; \
    ln -s libshogun-13.0.dll libshogun-13.dll )
    ldconfig >/dev/null 2>&1 || true
    make[1]: 离开目录“/home/Administrator/shogun/shogun-2.1.0/src/shogun”
    make -C interfaces/python_modular install-python_modular && true
    make[1]: 进入目录“/home/Administrator/shogun/shogun-2.1.0/src/interfaces/python_modular”
    install -d -m755 “/usr/local/lib/python2.7/dist-packages/shogun”
    install -m644 “/usr/local/lib/python2.7/dist-packages”
    install: 在”/usr/local/lib/python2.7/dist-packages” 后缺少了要操作的目标文件
    请尝试执行”install –help”来获取更多信息。
    Makefile:265: recipe for target `install-python_modular’ failed
    make[1]: *** [install-python_modular] Error 1
    make[1]: 离开目录“/home/Administrator/shogun/shogun-2.1.0/src/interfaces/python_modular”
    Makefile:56: recipe for target `install’ failed
    make: *** [install] Error 2

    puzzled indeed………

  2. I’m trying to install / run whatever the word is for shogun… I’m using windows 8.1.

    I tried almost everyting,,

    cygwin64 > failed

    VMware + Ubuntu 14.04 TS > failed, trying to install a compiler, not sure if it will work..

    I guess shogun is built for not using. I couldn’t find anybody who was able to use it.

  3. I want to compile shogun for windows 32bit, but cygwin also get me error *recipe for target “all” failed*.

    I see that you have already compiled SHOGUN on win32…

    can you give me some guide how to install it ?

    or can you get me already compiled binaries ?

    my mai: tvix_8@mail.rul

    • What I describe is crosscompiling for Win64. In the Shogun FAQ you find some hints, that some modules will not compile under Cygwin, so you should exclude them when building.

  4. How to use the Shogun Machine Learning Toolbox under Win32, compiled in the Cygwin ?

    if i use the MinGW32 compiler, it dont work, if i use cigwins compiler – it works, but only with console application, and i wont to use GUI.

    • Shogun does not have it’s own GUI, see how to build the interface for eg MATLAB or Octave to use a GUI.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: