I threw together some instructions on how to build the GUPnP stack on windows:
Tag Archives: Programmieren
Eternal struggle
My current task is evaluation crypto (here: OpenPGP) solutions for Microsoft Windows; of course including GnuPG.
Well, what do I say. While there is a nice installer for GnuPG on Windows available (either here or here), try to find one for the gpgme supporting library… (including header and .lib import files for Visual Studio, that is).
You can guess… It’s all about build-your-own-stuff. It basically boils down to this:
Preparations
- Create a directory to collect all the stuff you will need (e.g.
C:\gpgme
withbin
,include
andlib
sub folders) - Get mingw and install it
- Get MSYS and install it
- Download libgpg-error and extract it
- Download gpgme and extract it
Compiling libgpg-error
- In the MSYS bash, change to the directory you extracted libgpg-error into and run
./configure --prefix=/mingw && make install
- Call
strip src/.libs/libgpg-error-0.dll src/gpg-error.exe
as MSVC can’t use gcc’s debug info anyway - Copy
src/gpg-error.exe and src/.libs/libgpg-error-0.dll
to the bin directory created above - Copy
src/.libs/libgpg-error-0.dll.def
tolib/libgpg-error-0.def
(note the renaming; otherwise your program will look for alibgpg-error-0.dll.dll
) - Open the Visual Studio Command Prompt
- Call
lib /machine:i386 /def:lib\libgpg-error-0.def /out:lib\libgpg-error-0.lib
to create the import library - Copy
include/gpg-error.h
to include
Compiling gpgme
- In the MSYS bash, run
./configure --prefix=/mingw && make
- Call
strip src/gpgme-w32spawn.exe src/.libs/libgpgme-11.dll
- Copy
src/gpgme-w32spawn.exe
tobin
Note: To use the gpgme library, this binary has to live either in the installation dir of gpg (set in windows registry keyHKLM\Software\GNU\GnuPG\Installation Directory
) or in%PROGRAMFILES%\GNU\GnuPG
. Otherwise gpgme will not work! - Copy
src/.libs/libgpgme-11.dll
to bin andsrc/.libs/libgpgme-11.dll.def
tolib/libgpgme-11.def
(Once again, note the renaming) - Call
lib /machine:i386 /def:lib\libgpgme-11.def /out:lib\libgpgme-11.lib
to create the import library - Copy
include/gpgme.h
toinclude
Optional: Creating the documentation
I was not able to create the documentation properly using cygwin so I did this on a Linux host. Install a TeX distribution of your choice as well as texinfo (for Debian Lenny this would mean installing the packages texinfo, texi2html and texlive). Call make pdf in the doc subdir to generate the PDF documentation and manually call texi2html gpgme.texi
for a HTML document.
Summary
Now you can add the lib dir to your Visual Studio linker settings and the include dir to your C/C++ common settings. To make gpgme work, be sure you have the gpgme-w32spawn.exe installed properly as noted above.
I hope this helps to guide one or another through the struggle of getting gpgme on windows.
Q&A
-
Q: gpgme does not find libgpg-error
A: You did not call
make install
after compiling it -
Q: My program is looking for
{libgpg-error-0.dll.dll|libgpgme-11.dll.dll}
A: You did not rename the .def file before calling
lib.exe
-
Q: I did everything you said, but when I run my program,
gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP)
fails withGPG_ERR_INV_ENGINE
. If I check the engine info,info->version
is emptyA: First of all, check if you copied
gpgme-w32spawn.exe
to the correct directory. If this is the case, actually, I have no idea what went wrong
Hacking UPnP
While being at FOSDEM I attended a talk about rygel, an UPnP MediaServer written for Gnome using Vala. Writing plugins seemed dead-easy, and in fact it is 😉 So I came up with two plugins:
- One exposing all media files in a folder via UPnP
- One providing easy access to the ZDF Mediathek
While the second one is still somewhat under construction, I hereby present you screens of the first (Which I mostly hacked up for testing my whole Renderer – Control Point – Server chain)
Früher, als ich klein war…
… da mochte ich am liebsten Lego Technik. Und für jemanden, der den Rubik’s Cube genau einmal geschafft hat (ohne ihn auseinander zu nehmen), ist das hier einfach nur genial
Gefunden auf schockwellenreiter.de
Learning something new every day….
Just in case someone wonders what %~d0
in a .bat or .cmd file means, here’s the excerpt from help call
:
[…]
In addition, expansion of batch script argument references (%0, %1, etc.) have been changed as follows:
%* in a batch script refers to all the arguments (e.g. %1 %2 %3 %4 %5 …)
Substitution of batch parameters (%n) has been enhanced. You can
now use the following optional syntax:%~1        – expands %1 removing any surrounding quotes (“)
%~f1       – expands %1 to a fully qualified path name
%~d1       – expands %1 to a drive letter only
%~p1       – expands %1 to a path only
%~n1       – expands %1 to a file name only
%~x1       – expands %1 to a file extension only
%~s1       – expanded path contains short names only
%~a1       – expands %1 to file attributes
%~t1       – expands %1 to date/time of file
%~z1       – expands %1 to size of file
%~$PATH:1  – searches the directories listed in the PATH
environment variable and expands %1 to the fully
qualified name of the first one found. If the
environment variable name is not defined or the
file is not found by the search, then this
modifier expands to the empty string
The modifiers can be combined to get compound results:%~dp1      – expands %1 to a drive letter and path only
%~nx1      – expands %1 to a file name and extension only
%~dp$PATH:1 – searches the directories listed in the PATH
environment variable for %1 and expands to the
qualified name of the first one found. If the
environment variable name is not defined or the
file is not found by the search, then this
modifier expands to the empty string
The modifiers can be combined to get compound results:%~dp1      – expands %1 to a drive letter and path only
%~nx1      – expands %1 to a file name and extension only
%~dp$PATH:1 – searches the directories listed in the PATH
environment variable for %1 and expands to the
drive letter and path of the first one found.
%~ftza1    – expands %1 to a DIR like output line
In the above examples %1 and PATH can be replaced by other
valid values. The %~ syntax is terminated by a valid argument
number. The %~ modifiers may not be used with %*
I bet the guy meant %~dp0 in the call to cacls
Polyglott
Als bekennender Anhänger verschiedenster Programmiersprachen bin ich heute zufällig über Vala gestolpert. Hört sich interessant an. Vielleicht hilft es, endlich diesen fiesen GObject-Boilerplate-Code zu umgehen.