Dienstag, 25. August 2009

Howto compile libMSN without CMake

Well, this blog entry serves rather as a note to myself, but I guess it could be useful for others, too. Compiling the excellent libMSN is pretty easy (especially when running Linux), but every time I do something wrong with the cmake building system on Windows it becomes a PITA (I had some problems with cmake finding my OpenSSL installation... no idea why). That's why I'll show how to build it manually for Visual Studio 2008 (should also work with other versions though).

If you have already installed OpenSSL in your IDE, you can start immediately. If not, you can download here a precompiled package which contains everything you need (I used the package "Win32 OpenSSL v0.9.8k" with a size of 7MBs). Just put the 2 precompiled files and the headers into the particular directories of Visual Studio.

  1. At first, grab the latest version from SVN trunk: svn co https://libmsn.svn.sourceforge.net/svnroot/libmsn libmsn. In case you don't have a suitable SVN client: I'm quite happy for now with the free client from SlikSVN.
  2. Make a new empty file with the name config.h in trunk/msn. This file is normally automatically generated by cmake and contains a few macros which enable or disable certain features. But for now, we're in a hurry so we don't care :-).
  3. Now copy all header files in trunk/msn to a new msn folder in your include directory of visual studio (e.g.: C:\Program Files\Microsoft Visual Studio 9.0\VC\include\msn).
  4. Create a new project with Visual Studio. We need an empty Win32 project for a dynamic link libary.
  5. Try to find "Add" -> "Existing Item" somewhere and add all headers and source files to the project. Add also all files in the subdirectory "libsiren".
  6. Open up your project settings (or property pages) :
  7. Go to "C/C++" -> "Preprocessor" and add msn_EXPORTS to the "Preprocessor Definitions".
  8. Go also to "General" and set the character set to "Not Set".
  9. Now "Linker" -> "Input" and add libeay32.lib and ssleay32.lib.
  10. You may experience some linker problems related to debug code. Search "Linker" -> "Debugging" and set "Generate Debug Info" to "No".
Now pray and compile the project. You should get libmsn.lib and libmsn.dll. Put the lib into the lib directory of Visual Studio and the DLL either into the same directory of your executable or into system32 of your windows folder. That's it.


  1. Hi,

    Have you implemented the libmsn on windows with winsock2 and native framework such as win32api or QT? This is a very interesting topic but seems no one complete it.


  2. Hi Sam,

    Yes I did, but I used my own socket wrapper and that is why I didn't think about releasing it. Well, in that case I guess I'll write an article about it.


  3. Hi Sascha,

    Yes, maybe you can write an article to describe it. Furthermore you can submit your code to the autor of libmsn which makes a good library to share. let more people use libmsn under win32 platform.

    On top of that, I start using winsock with libmsn but fail at SSL reading. Still need some day to debug...