Suggestions for gpgme on mingw-w64
jeroen.ooms at stat.ucla.edu
Fri Sep 4 12:42:58 CEST 2015
I am writing gpgme bindings for the R statistical programming language
which need to run on linux, mac and windows. I noticed there has been
some work on windows support in gpgme 1.6.0 and have a few
It is explicitly noted in the changelog that gpgme-w32spawn.exe has to
be in the installation directory. However in my case this is
unfortunately impossible. R installs packages (modules) in the user
home directory, and then dynamically loads them when needed. Therefore
_gpgme_get_inst_dir() returns the installation directory of the main R
software, which is not writable by the user.
It would be really nice if we could manually set the path to
gpgme-w32spawn.exe, for example with a runtime environment variable or
via gpgme_set_global_flag("gpgme-w32spawn", ...) or something similar.
Alternatively gpgme could search the PATH as well.
One final suggestion is that the error message in
_gpgme_get_w32spawn_path could be improved a bit. I spent a lot of
time debugging "CreateProcess failed: ec=87". This is probably a
fairly common problem, a small hint about missing gpgme-w32spawn.exe
would be great.
## finding gpgconf
There are several methods described to find gpg, and none of them
worked on my windows 64 system, though I have a completely standard
According to the documentation, gpgme searches the PATH for gpgconf or
gpg2. There is a function walk_path() in posix-util.c but unless I am
missing something, this has not been implemented in w32-util.c. Is
this a deliberate choice? Windows has PathFindOnPath(), though that
would introduce a dependency on Shlwapi.dll.
The docs also state that the directory can be set manually using:
#define GPG4WIN "C:/Program Files (x86)/GNU/GnuPG/gpg2.exe"
gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, GPG4WIN, NULL)
However I tried all possible combinations of this function, and none
worked on windows.
Finally, the find_program_at_standard_place() function in w32-util.c
checks CSIDL_PROGRAM_FILES (which corresponds to c:/program files/).
However on a windows 64 machine, the default directory of gpg4win is
actually in CSIDL_PROGRAM_FILESX86 (which corresponds to c:/program
files (x86)/), so gpgme should check this dir as well. After I changed
this in the gpgme source code, I finally got my bindings to work, both
for win32 and win64! Yay!
I am very glad I finally figured this out locally, but in order to
release this software it will need to be able to find a gpg
installation on an arbitrary windows system. On Linux and Mac, gpgme
does a good job in searching the PATH, hopefully this can be improved
on Windows. Please let me know if I can help testing.
I am writing bindings to
More information about the Gnupg-devel