Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I have a simple list generation problem, where my program needs to generate a series of lists from a few rules. The SQL would be fairly nightmarish, but I thought maybe some Prolog might help. So I tried to install AI::Prolog under MSW. I seem to be having a lot of problems with the dependencies. So I have two questions:

1 - Is there an easier version of Prolog to install?
2 - Can I fix this one?

I am working through the errors one by one, but the current one just goes straight over my head.

If I try to run the program, with some failed dependencies to try to see what works and what doesn't the code:

use warnings; use strict; use Term::ReadLine; use Term::ReadKey; use Pod::Usage 1.12; use aliased 'AI::Prolog';

Generates:

Can't load 'C:/Perl/site/lib/auto/Term/ReadKey/ReadKey.dll' for module + Term::ReadKey: load_file:Invalid access to memory location at C:/Per +l/lib/DynaLoader.pm line 229. at C:\Documents and Settings\Steve.Cookson\My Documents\Projects\Endo +scopy System\Endoscopia\aiprolog.pl line 21 Compilation failed in require at C:\Documents and Settings\Steve.Cooks +on\My Documents\Projects\Endoscopy System\Endoscopia\aiprolog.pl line + 21. BEGIN failed--compilation aborted at C:\Documents and Settings\Steve.C +ookson\My Documents\Projects\Endoscopy System\Endoscopia\aiprolog.pl +line 21.
OK, so it looks like I have a problem with ReadKey. I check the download, it's fine. I run nmake, although it looks quite wordy, there are a couple of warnings, but no fatal errors:
Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. gcc -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_F +CRYPT -DNO _HASH_SEED -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_C +ONTEXT -DP ERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fn +o-strict-a liasing -O2 -DVERSION=\"2.30\" -DXS_VERSION=\"2.30\" "-IC:\Perl\l +ib\CORE" ReadKey.c In file included from ReadKey.xs:6: ppport.h:227:1: warning: "PERL_UNUSED_DECL" redefined In file included from ReadKey.xs:4: C:/Perl/lib/CORE/perl.h:188:1: warning: this is the location of the pr +evious def inition Running Mkbootstrap for Term::ReadKey () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 ReadKey. +bs dlltool --def ReadKey.def --output-exp dll.exp g++ -o blib\arch\auto\Term\ReadKey\ReadKey.dll -Wl,--base-file + -Wl,dll.b ase -mdll -L"C:\Perl\lib\CORE" ReadKey.o -Wl,--image-base,0x19000000 +C:\Perl\li b\CORE\perl58.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -l +advapi32 - lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm - +lversion - lodbc32 -lodbccp32 -lmsvcrt dll.exp dlltool --def ReadKey.def --base-file dll.base --output-exp dl +l.exp g++ -o blib\arch\auto\Term\ReadKey\ReadKey.dll -mdll -L"C:\Per +l\lib\CORE " ReadKey.o -Wl,--image-base,0x19000000 C:\Perl\lib\CORE\perl58.lib - +lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -l +oleaut32 - lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 +-lmsvcrt d ll.exp C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arc +h\auto\Ter m\ReadKey\ReadKey.dll C:\Perl\bin\perl.exe -MExtUtils::Command -e cp ReadKey.bs blib +\arch\auto \Term\ReadKey\ReadKey.bs C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arc +h\auto\Ter m\ReadKey\ReadKey.bs
Howver, when I run nmake test, I get fatal errors:
Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. C:\Perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" -w test.pl 1 .. 8 Can't load 'blib\arch/auto/Term/ReadKey/ReadKey.dll' for module Term:: +ReadKey: l oad_file:Invalid access to memory location at C:/Perl/lib/DynaLoader.p +m line 229 . at test.pl line 21 Compilation failed in require at test.pl line 21. BEGIN failed--compilation aborted at test.pl line 21. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x2' Stop.

So Load up test.pl in Komodo and get the same error. The line in question is just:

use Term::ReadKey;

Your wisdom would be appreciated

Regards

PS I see Term-ReadKey is a module on PPM, so I pressed the validate button and it says "fine", or words to that effect.

Replies are listed 'Best First'.
Re: Which Version of Prolog
by james2vegas (Chaplain) on Aug 26, 2009 at 02:04 UTC

      I installed SWI Prolog, but it wanted to adopt the .pl extension for prolog files. Clearly this was something I couldn't live with, so I adopted the .pro extension instead. I also changed the default installation from "program files\pl" to "\program files\prolog". Installation failed the first time saying it couldn't write registry settings, however I ran it again, with the same settings and it run without error. Installing the dependency Language::Prolog::Sugar, was error free. But the Makefile for Language::Prolog::Yaswi is crashing with:

      C:\Perl\Language-Prolog-Yaswi-0.18>perl Makefile.PL Set up gcc environment - 3.4.5 (mingw special) Checking if your kit is complete... Looks good retrieving SWI-Prolog configuration: running 'plcon.exe -dump-runtime-variables' 'plcon.exe' is not recognized as an internal or external command, operable program or batch file. unable to run swi-prolog command 'plcon.exe': 256 Aborting...

      Manual Makefile installs are new for me, I've just used PPM before. Have I done anything obviously wrong?

      Thanks

        Yeah, I had never tried this under Windows and was going on the authors claim that it was working with Windows.

        According to the README:
        To install this module the SWI-Prolog executable "pl" has to be in the + PATH or alternatively the PL environment variable can be used to sel +ect another executable name and location.
        for windows understand 'pl' to mean 'plcon.exe' and
        This module has been minimal tested under windows, it seems to work, a +nd I plan to support it, but the primary development platform continu +es to be Linux/Unix. To make it work, the "bin" directory for your SWI-Prolog installation +will have to be included in your PATH also at runtime (If you get an +error telling about the lippl.dll being missing, try using 8 chars na +mes in the PATH, i.e. C:\PROGRA~1\SWI-PR~1\BIN).

      Great answer. I'll give it a try.

      Thanks