2

I just installed the latest Postgres binary from Enterprise DB and tried to install some user languages, and but it failed with the following errors:

postgres=# create language pltcl;
ERROR: could not load library "C:/Software/PostgreSQL/9.2/lib/pltcl.dll": The specified module could not be found.

postgres=# create language plperl;
ERROR: could not load library "C:/Software/PostgreSQL/9.2/lib/plperl.dll": %1 is not a valid Win32 application.

postgres=# select version();
PostgreSQL 9.2.4, compiled by Visual C++ build 1600, 64-bit

I have verified that there are dll's in the above locations, so I wonder if $libdir needs to have M$ windows backslashes instead of unix forward slashes? But I don't really know.

I would appreciate any ideas on how to fix. I am going to try a 32 bit install. THanks!

Thanks!

forkandwait
  • 5,041
  • 7
  • 23
  • 22

1 Answers1

4

Windows raises the error "The specified module could not be found" when it really means "The specified module or, recursively, any DLL that it requires to be loaded could not be found"

In this case you probably don't have a suitable TCL runtime installed. Check the installer documentation to see what TCL version it needs.

%1 is not a valid Win32 application is likely because you have a 32-bit PostgreSQL trying to load a 64-bit perl DLL or vice versa. The Perl that's first on the PATH in the system environment needs to be of the same architecture as PostgreSQL, ie both 32-bit or both 64-bit.

In both these cases it will be informative to examine the plperl.dll and pltcl.dll files with Dependency Walker (depends.exe) from http://dependencywalker.com/ .. This tool will help you identify any missing or mismatched libraries.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
  • Running "depends" shows that postgres.exe and tcl85.dll both are not found. I have a tcl 8.6 installed, so the latter makes sense, but not the former. Is there a envar that I can set or anything? – forkandwait Jul 08 '13 at 15:46
  • @forkandwait `postgres.exe` will be found when the executable is actually loaded with a `LoadLibrary` call by `postgres.exe` so that isn't a problem. Sounds like you've identified the issue - you need to install TCL 8.5. – Craig Ringer Jul 09 '13 at 01:52
  • In order to get it to work I had to install everything from scratch, starting with Tcl8.5, THEN Postgresql (so the installation program can find pltcl, I assume). THanks for the help. – forkandwait Jul 09 '13 at 16:42
  • @forkandwait That's quite surprising... TCL should be found if it's present. Maybe the PATH wasn't updated until a reboot, and you rebooted as part of reinstalling Pg? Either way, glad to see it's working. I'd like the EnterpriseDB installer to do a better job of reporting what 3rd party installers and their versions are required to support the procedural languages, you shouldn't have to be playing with depends.exe to figure it out. – Craig Ringer Jul 10 '13 at 00:55