[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frustrations/problems with GNU Prolog.

From: Daniel Diaz
Subject: Re: Frustrations/problems with GNU Prolog.
Date: Mon, 11 Jul 2011 15:59:44 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110516 Thunderbird/3.1.10

Le 11/07/2011 15:32, Steve641 a écrit :
I'm not sure how complex these questions are... I last wrote Prolog (using
Sicstus/SWI Prolog interpreters) in the early 1990s... I was rusty, but I
soon rediscovered lots of useful idioms.

I've a script which I can consult from the command line of gprolog, and it
does what I want when I evaluate a predicate main/0.  I'm having some
difficulties packaging my solution....  I'd like users to be blissfully
unaware that they're using a Prolog solution when they invoke it by name
from a shell prompt.

The environment I'm using is Linux - the current Ubuntu Server distribution
for a 64-bit AMD system.

$ uname -a
Linux server 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011
x86_64 x86_64 x86_64 GNU/Linux

I've installed the GNU prolog package (version 1.3.0 is the one in the
current Ubuntu Universe) and it's details are:

$ apt-cache showpkg gprolog
Package: gprolog
  Description Language:
                   MD5: bda800d61124d7f1de09fc061fac1d22
Reverse Depends:
   gprolog-doc,gprolog 1.2.7
1.3.0-6.1 - libc6 (2 2.11) gprolog-doc (0 (null))
1.3.0-6.1 -
Reverse Provides:

When I try to compile my script to native, using glpc, I get unexpected

First, for any script, I get two (worrying-looking) warnings:

$ gplc
/usr/bin/ld: Warning: alignment 8 of symbol `init_stream_supp' in
/usr/lib/gprolog-iso/libbips_pl.a(stream_supp.o) is smaller than 16 in
/usr/bin/ld: Warning: alignment 8 of symbol `fd_reset_solver' in
/usr/lib/gprolog-iso/libengine_fd.a(fd_inst.o) is smaller than 16 in

At first glance, these seem to be a problem with the Ubuntu packages for my
architecture.  Is this a known problem?  Are there any quick/easy
work-arounds?  (I'd like a clean compile.)
This is due to a gcc bug. This should not prevent gprolog from working.

If you want a clean compile, get the last version.

You will have to compile and install it by yourself (until a ubuntu package is available). Follow the INSTALL file for this.


cd src
make install

Next, for my script, I get a series of frustrating errors - all of this

/tmp/gplcUheTSf.o: In function `predicate(isValid/2)':
(.text+0x1ad): undefined reference to `predicate(validRanges/2)'

Subsequent errors have a different location in .text - of course.  In one
sense, this should not surprise me as there is no explicit definition for
validRanges/2 in my source code.  My strategy was to require user input of
the desired ranges - then use asserta/1 to establish validRanges as a fact
before evaluating any predicate that needed it.  This works fine from the
interactive prompt - but not when compiling to native.
You have to inform the compiler validRanges/2 is a dynamic predicate. Add the following directive to your Prolog file:

:- dynamic(validRanges/2).

be to pass the ranges recursively and explicitly to every predicate that
needs them... but this seems ugly.  Are there any alternative strategies to
overcome this?

Finally, I'm wondering if there is any support for passing command line
arguments to executables implemented using GNU prolog?  In an ideal world,
I'd pass the desired ranges as command line arguments rather than require
them to be entered interactively.  Any hints gratefully received.
You can look at the following built-in predicates: argument_counter, argument_value, argument_list


Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]