I was surprised when I did not find good answers from Google. Activstate seems to work for some, but not for others. There were suspicions of conflicts with different versions of the Windows system libraries, but nothing final. However, I was finally able to create a plperl.dll file that works using strawberry perl.
Here are step-by-step instructions to get plperl to work with strawberry perl. The trick is to recompile postgresql and plperl, but install plperl on top of your existing postgresql installation.
first you need the following:
The mingw site is messy. There is no single package to download. You need to download the installer, which downloads everything else. Here is a quick link to it.
http://sourceforge.net/projects/mingw/files/Installer/
In your installer, select C and C ++ and the MSYS environment to install. Mingw will not pollute the environment, so install it in any old location.
As for perl, I donβt think that files (shared libraries) are needed to activate this process, and I found CPAN support for strawberries better (vs activestate proprietary ppm sites) and activate the transfer of douchebag old versions behind a paid line (and forcing other sites to delete their posted copies). F.Yu. ActiveState
Postgresql 9.1 was originally built against perl 5.14, so it is probably best to stick with this version.
Unzip and install it all. Mingw will provide you with a shell (find the shortcut in the start menu) to compile. Launch the shell and do not close it.
follow these steps to install / uninstall packages:
mingw-get install libminizip mingw-get remove mingw-perl
you need to remove mingw perl so that perl is used during the build process instead. Instead, you can screw in with a path variable, but this method is simpler
Now you need to go to the directory where you unpacked the unpacked postgresql sources. In the mingw shell, use the / c root path to access the C: drive.
Now just configure and do
./configure --with-perl make
Note that postgres docs say use gmake, but in mingw it does.
The assembly will probably fail when creating the actual plperl.dll file. This is because the build environment does not create the correct command to build the dll. If you get an error message:
dllwrap -o plperl.dll --dllname plperl.dll --def libplperldll.def plperl.o SPI.o Util.o -L../../../src/port -Wl,--allow-multiple-definition -Wl,--as-needed -LC:/strawberry/perl/lib/CORE -l -L../../../src/backend -lpostgres c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: cannot find -lL../../../src/backend c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/ld.exe: cannot find -lpostgres
cd in src / pl / plperl and run the following command:
dllwrap -o plperl.dll --dllname plperl.dll --def libplperldll.def plperl.o SPI.o Util.o -L../../../src/port -Wl,--allow-multiple-definition -Wl,--as-needed -L/c/strawberry/perl/lib/CORE -L../../../src/backend -lpostgres -lperl514
(note that I have perl installed in c: \ strawberry and mingw installed in c: \ mingw)
This is where we are done. you have the plperl.dll file in this directory, which can replace the one that comes with postgresql.