Build libpst for Windows?

We’re about to do a new Xena release at work, but before that happens I need to (somehow) create a Windows binary of readpst (from libpst) to normalise Outlook PST files. Normally I’d just do it under cygwin, but as of version 0.6.x that requires the cygwin server to be installed and running on the client’s machine (which introduces a whole new level of pain).

We have a native build of readpst from before I worked there, but no-one on “the Google” appears to know how to build it. It’s certainly not my strong point! It’s starting to get tricky..

12 Responses to “Build libpst for Windows?”


  • I have no idea about the question, but I’d like to note that Microsoft have committed to documenting the PST file format(s) (after more than a few people asked). It looks like if you are on the “nice” list (and not on the “naughty” list), you can get some pre-release stuff.

  • Hey Brad,

    Thanks for the suggestion. We get the Microsoft guys coming around every now and then trying to get us to use their technologies. We’ve asked for information on data formats (specifically PST actually, because previously libpst couldn’t read files from Outlook 2003 and later) a number of times, and it keeps getting promised but never delivered.

    I think recently Mike had a conversation with them and apparently they are releasing a whole bunch of PST doco over the next few years, in stages. One of the first is how to read the files, which is all we need. Still, in light of that being some ways away and me needing to release Xena this week, if I can get readpst going it will be useful :-)

    It’ll certainly be interesting to see what comes out of that documentation release, though.

    Thanks again for the suggestion. I might double check where it’s up to and see if some data format stuff is out yet.

    Cheers,
    Chris

  • Chris,

    Have you tried cross compiling it from Linux to windows? If it uses the autotools, it should be as easy as:

    ./configure –host=i586-mingw32msvc –target=i586-pc-mingw32msvc –build=i686-linux

    I use the mingw32 packages on Debian/Ubuntu to compile win32 binaries for libsndfile (I also run the test suite under Wine). For 64 bit windows i’ve built a cross-compiler from the mingw-w64.sf.net sources.

    HTH,
    Erik

  • Hey Erik,

    Thanks for the suggestion. I previously tried all sorts of things, including MinGW, without success.

    With Fedora 12 however, it appears to work. Yay!

    I can build it now with simply:
    mingw32-configure && make

    Or this should work:
    ./configure –host=i686-pc-mingw32 && make

    This creates readpst.exe which is what I want.

    I’d like to build it statically however, rather than having to ship all the MinGW dlls separately.

    I did have to install a number of extra MinGW libraries, including mingw32-gcc-c++, mingw32-libgnurx and mingw32-iconv.

    Thanks for the suggestion to try MinGW again! :-)

  • Hi Chris,

    I had the same problem yesterday, so I hacked together a simple solution. Using libpst-0.6.45.tar.gz, MinGW, GnuWin32’s Regex and LibIconv I came up with a simple gcc command to create readpst.exe. See my blog at http://ionipti.blogspot.com/2009/12/libpst-and-readpst-hacked-way-on-vista.html. I am running Vista 64 but this creates a 32-bit executable.

    I also put up readpst.exe on my site: http://nkcorner.com/readpst.exe.

    I didn’t check all the functions, but it extracts my files to text which is all I desired.

  • Thanks Nachum,

    I did manage to get it working, which I’ll have to post at some point!

    Cheers,
    Chris

  • Hi, i tried all the tips posted here, used fedora, ubuntu, cygwin with cygserver, also the command line mingw32-configure && make, ./configure –host=i686-pc-mingw32 && make.
    The compiling starts great, but almost in the end, it returns error “checking for iconv… no, consider installing GNU libiconv”.

    Can someone help me?

  • Have you tried installing mingw32-iconv?

    -c

  • ok, so far so good,now i get this error:

    Could not link test program to Python. Maybe the main Python library has been
    installed in some non-standard library path. If so, pass it to configure,
    via the LDFLAGS environment variable.
    Example: ./configure LDFLAGS=”-L/usr/non-standard-path/python/lib”
    ============================================================================
    ERROR!
    You probably have to install the development version of the Python package
    for your distribution. The exact name of this package varies among them.
    ============================================================================

    Python 2.7 is already installed, why am i getting this error?

    im using Fedora 11.

    Thank you.
    Any ideas?

  • Do you have python-devel installed? You need the -devel packages for anything you need development libraries for.

    -c

  • yum install python-devel*
    Loaded plugins: langpacks, presto, refresh-packagekit
    Setting up Install Process
    Package python-devel-2.7.1-7.fc15.i686 already installed and latest version
    Nothing to do

    it returns again:

    checking for a version of Python >= ‘2.1.0’… yes
    checking for a version of Python 2.7… yes
    checking for the distutils Python package… yes
    checking for Python include path… -I/usr/include/python2.7
    checking for Python library path… -L/usr/lib -lpython2.7
    checking for Python site-packages path… /usr/lib/python2.7/site-packages
    checking python extra libraries… -lpthread -ldl -lutil
    checking python extra linking flags… -Xlinker -export-dynamic
    checking consistency of all components of python development environment… no
    configure: error: in `/home/myprofile/libpst':
    configure: error:
    Could not link test program to Python. Maybe the main Python library has been
    installed in some non-standard library path. If so, pass it to configure,
    via the LDFLAGS environment variable.
    Example: ./configure LDFLAGS=”-L/usr/non-standard-path/python/lib”
    ============================================================================
    ERROR!
    You probably have to install the development version of the Python package
    for your distribution. The exact name of this package varies among them.
    ============================================================================

    Im stuck

  • Got it, just use this command line:

    ./configure -host=i686-pc-mingw32 –enable-python=no

    make

    : o )

    the only problem now is when i export a pst with special characters folders in windows, it displays them wrong in console. The linux port doesnt have this problem. Any idea why?

Leave a Reply