gpgme does not find engine on windows

Jeroen Ooms jeroen.ooms at
Wed Jul 15 10:42:14 CEST 2015

I wrote some gpgme bindings for the R programming language, and they
work great on OSX and Linux, but I am having difficulty getting it to
work on Windows. The gpgme library has been compiled with mingw-w64
(gcc 4.6.3). The code builds and links, but the program fails with
'Invalid crypto engine' when calling


I tried both using the gpg2.exe or gpgconf.exe engine from gpg4win as
well as from msys2 but gpgme seems unable to find it. The debug traces
are actually different when building for win32 then for win64, see the
logs: . On
win64 the program doesn't find the gpg executable at all, whereas on
win32 the initialization fails with 'CreateProcess failed: ec=87'.

I tried pointing gpgme to the correct path:

  gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, "C:\\GNU\\GnuPG\\gpg2", NULL);

And also tried setting global flags:

  gpgme_set_global_flag("gpgconf-name", "C:\\GNU\\GnuPG\\gpgconf");
  gpgme_set_global_flag("gpg-name", "C:\\GNU\\GnuPG\\gpg2");

I also tried installing gpg4win in another directory, but the same
errors remain.

So my questions: are there working examples of gpgme on windows?
Should it be possible for a mingw-w64 build of gpgme to use the
gpg4win engine?

More information about the Gnupg-devel mailing list