Skip to content

Building MUSCLE

Robert Edgar edited this page Jan 15, 2022 · 16 revisions

Design of the build system

This page is a how-to. See build design wiki page for background on why things work this way.

Building under Visual Studio on Windows

You can use the free edition of Visual Studio for C++. Open the muscle.sln solution file, select Release configuration for the x64 platform and select Build Solution (F7).

At the time of writing I'm using Microsoft Visual Studio Community 2022 v17.0.4, this is likely to change as updates to VS are released. Generally the project imports seamlessly into new releases. Everything in the project is pretty standard for a C++ console project, except for a pre-build step which embeds git version information into the executable so that it can be displayed at runtime. This step checks whether Cygwin is installed. If Cygwin is found, then the git version in gitver.txt is updated.

Building under Cygwin on Windows

I don't generally do this because the native Windows executable compiled by Visual Studio is compatible with Cygwin (though of course Cygwin paths are not interpreted, you must use native Windows paths). Using the native gcc package for Cygwin seems to produce a 32-bit exe which is limited to 2Gb RAM. You can probably compile a 64-bit exe using the mingw64-x86_64-gcc package; I haven't investigated this. Please let me know if you can provide a robust recipe for compiling a 64-bit exe with OpenMP under Cygwin.

Compiler dependencies and options

The first post of MUSCLE v5 had several compiler portability issues. Most of these turned out to be caused by typedef unsigned char byte; which conflicts with std::byte in recent versions of C++. This is solved by #define byte __mybyte__ in myutils.cpp. At the time of writing, I've tested the most recent code and Makefile (Version 5.1) on a wide range of compilers including gcc versions from v8 to v11 and it seems to be much more portable now.

Building under Linux

Change to the src/ directory and run make. The Makefile requires that g++, make, sed and git are installed.

Building under OSX

Change to the src/ directory and run make. The Makefile requires that gcc v11, make, sed and git are installed. Note that in recent releases of OSX, "gcc" is an alias for clang. You must install genuine gcc v11 and its OpenMP library; currently brew install gcc does this.

Unfortunately, the OSX build creates a binary that requires gcc-11 to be installed when the binary is run (see https://github.com/rcedgar/muscle/issues/21). If you have a solution to this, please post a message to issue #21.

Building using a github workflow

See these workflows under the .github/ directory of the repo.

build_linux.yml

build_osx.yml

build_windows.yml

Clone this wiki locally