users-prolog
[Top][All Lists]
Advanced

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

Frustrations/problems with GNU Prolog.


From: Steve641
Subject: Frustrations/problems with GNU Prolog.
Date: Mon, 11 Jul 2011 06:32:11 -0700 (PDT)

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
Versions:
1.3.0-6.1
(/var/lib/apt/lists/gb.archive.ubuntu.com_ubuntu_dists_natty_universe_binary-amd64_Packages)
(/var/lib/dpkg/status)
 Description Language:
                 File:
/var/lib/apt/lists/gb.archive.ubuntu.com_ubuntu_dists_natty_universe_binary-amd64_Packages
                  MD5: bda800d61124d7f1de09fc061fac1d22
Reverse Depends:
  science-machine-learning,gprolog
  prolog-el,gprolog
  mace2,gprolog
  laby,gprolog
  laby,gprolog
  gprolog-doc,gprolog 1.2.7
Dependencies:
1.3.0-6.1 - libc6 (2 2.11) gprolog-doc (0 (null))
Provides:
1.3.0-6.1 -
Reverse Provides:
$

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

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

$ gplc trivial.pl
/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/lib/gprolog-iso/libengine_pl.a(engine.o)
/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
/usr/lib/gprolog-iso/libengine_pl.a(if_no_fd.o)
$

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.)

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

/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.  One solution would
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.

-- 
View this message in context: 
http://old.nabble.com/Frustrations-problems-with-GNU-Prolog.-tp32037478p32037478.html
Sent from the Gnu - Prolog - Users mailing list archive at Nabble.com.




reply via email to

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