Using GMP on a Github Action for Windows

I’m getting started on making Github Actions, and I thought I would start by making one that compiles a C++ library, in one of my private repos. The action I made uses ubuntu (20.04) and does what I intended it to do. So I decided to try it on Windows since I also need to compile it there.

Unfortunately, it is not so easy now since the workflow crashes because g++ can’t find a library that I need in order to compile my library. The library that I need is GMP (a C library), and the error message is:

In file included from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_rooted_trees.hpp:50,
                 from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.hpp:50,
                 from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.cpp:42:
D:/a/linear-arrangement-library/linear-arrangement-library/lal/numeric/integer.hpp:45:10: fatal error: gmp.h: No such file or directory
 #include <gmp.h>
compilation terminated.

I think that either:

  1. GMP is installed but the compiler can’t find it.
  2. the GMP library is missing in the (windows) runner machine

Since I don’t know in which situation I find myself in, I’ll make questions for each of them. Most of them are very specific and few are general. I would be very happy if someone answered them.

(1) How do I know that GMP is installed? More generally, how do I know if a certain resource (a library, compiler, or a certain version of a compiler, library, …) is installed? How do I find out the appropriate paths of a library for a compiler to use it properly?

(2) I browsed Github Marketplace but I couldn’t find any action to setup GMP. Any advice on how to install GMP on Windows? If the library is to be installed by my .yml file then the installation will happen every time the action is run: is there a way to ensure it’s done only once? My main interest for the latter is to reduce execution time.

Thank you very much.

1 Like

Not sure what GMP is.

If you weren’t using g++, I’d suggest looking at vcpkg as it sounds like it supports some library by that name:

Otherwise, you might want: Package: mingw-w64-x86_64-gmp - MSYS2 Packages


Thank you for your answer. GMP “is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers” (quote from

The terms “GMP” or “gmp” seem to be interchangeable since many people use both to refer to the same (I think). I’ll take a look at " Package: mingw-w64-x86_64-gmp - MSYS2 Packages" to see how that works.

I’ll keep you informed about my progress and come back with more questions if I have them.