Tag Archives: Programmieren

Fake rpm database in ubuntu

At work I’m currently developing software which is supposed to run on openSUSE. I need to query the package database at some point which of course does not exist on my ubuntu machine. Here’s a quick setup how to create a fake local RPM database:

echo "%_dbpath /home/user/rpmdb" >> ~/.rpmmacros
mkdir /home/user/rpmdb
rpm -i --nodeps --justdb --force-debian *.rpm

And that’s it.

pmp 0.1 released

I just uploaded pmp 0.1 – Poor man’s prism desktop web application creator to github: http://github.com/phako/pmp

A release tarball can be found here: pmp-0.1.tar.gz

What is pmp?

pmp shares some similarities to Mozilla’s Prism. It creates a “standalone” app from a web application. Pmp uses Webkit as its rendering backend.

How do I use it?

To create an edge (that is pmp’s terminus for a captured app), run
pmp-create --url=<url to website> --name=<descriptivename>
You can also create a desktop icon by passing it the --desktop parameter. If you want to use the site’s favicon, use --icon=:favicon

To run the edge, call pmp-run --name=<DescriptiveName>

Known limitations:
It does not work properly with Google’s apps. Google does some weird URL redirects. I’m working on that. Apps known to work are WordPress and TT RSS.

Location-dependant IGMP

Could someone please enlighten me?

I spent a third of my work today wondering why

  • a modified QUdpSocket only leads to IGMPv1 membership reports
  • a self-written plain old socket multicast client only leads to IGMPv2 joins, but very seldom leaves

Now being at home, I tried both programs and both reliably send IGMPv3 joins and leaves…

Smart pointers…

Can someone explain me the following behaviour:

I have the following smart pointer:

class AlsaHwParams
    AlsaHwParams() : m_params(0) 
    { snd_pcm_hw_params_alloca (&m_params); }
    { if (m_params != 0) snd_pcm_hw_params_free (m_params); }
    operator snd_pcm_hw_params_t*() { return m_params; }
    snd_pcm_hw_params_t *m_params;

Thing is: It doesn’t work. Alsa behaves very strange if I use it. Even if I make the m_params member public and access it directly. The only way it works is to not allocate from inside the class but outside like

snd_pcm_hw_params_alloca (&(hwparams.m_params));

Update: Seems replacing _alloca with _malloc fixes it.
Update: Duh, that is because alloca allocates on stack and not on heap.

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:


  • Create a directory to collect all the stuff you will need (e.g. C:\gpgme with bin, include and lib 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 to lib/libgpg-error-0.def (note the renaming; otherwise your program will look for a libgpg-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 to bin Note: To use the gpgme library, this binary has to live either in the installation dir of gpg (set in windows registry key HKLM\Software\GNU\GnuPG\Installation Directory) or in %PROGRAMFILES%\GNU\GnuPG. Otherwise gpgme will not work!
  • Copy src/.libs/libgpgme-11.dll to bin and src/.libs/libgpgme-11.dll.def to lib/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 to include

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.


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: 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 with GPG_ERR_INV_ENGINE. If I check the engine info, info->version is empty

    A: 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