Gprolog 1.4 exec/5 does not work under cygwin

View: New views
4 Messages — Rating Filter:   Alert me  

Gprolog 1.4 exec/5 does not work under cygwin

by Mark Utting-2 :: Rate this Message:

| View Threaded | Show Only this Message

I'm trying to upgrade to Gprolog 1.4, but my exec calls to a theorem prover have stopped working.

In fact, every exec/5 call seems not to work, and causes wait/2 to throw an error as the following 2 examples show:

===================================================
$ gprolog
GNU Prolog 1.4.0
By Daniel Diaz
Copyright (C) 1999-2011 Daniel Diaz
| ?- exec('bash query_Simplify.sh simplifyFile.smp', A, B, C, PID).

A = '$stream'(3)
B = '$stream'(4)
C = '$stream'(5)
PID = 5972

yes
| ?- wait(5972, Status).
uncaught exception: error(system_error('No child processes'),wait/2)


# even /bin/echo gives the same error

| ?- exec('/bin/echo abc', A,B,C,D).

A = '$stream'(9)
B = '$stream'(10)
C = '$stream'(11)
D = 7564

yes
| ?- wait(7564).
uncaught exception: error(existence_error(procedure,wait/1),top_level/0)
| ?- wait(7564, Status).
uncaught exception: error(system_error('No child processes'),wait/2)
| ?- exec('/bin/echo', A,B,C,D).

A = '$stream'(12)
B = '$stream'(13)
C = '$stream'(14)
D = 4900

yes
| ?- wait(4900, Status).
uncaught exception: error(system_error('No child processes'),wait/2)
| ?-
=======================================================

The above exec of 'bash query_Simplify.sh simplifyFile.smp' worked fine with Gprolog 1.3.
(and that command works from the command line).

Any suggestions how I can work around this problem?


I'm using the binary 64-bit Windows version of GProlog 1.4.0:
Windows intel 64 bits auto-install setup (compiled under x86_64 / Windows 7 with MinGW64 gcc under Cygwin).

This is under Windows 7 64-bit with an up-to-date Cygwin, and Mingw 64-bit gcc installed (the gprolog and gplc commands work fine).

$ uname -a
CYGWIN_NT-6.1-WOW64 RWS034 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

Thanks!
Mark



_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
https://lists.gnu.org/mailman/listinfo/bug-prolog

Re: Gprolog 1.4 exec/5 does not work under cygwin

by Daniel Diaz-3 :: Rate this Message:

| View Threaded | Show Only this Message

Hello Mark,

A first remark without looking at details...

The gprolog version you downloaded is a native Windows app. It does not know nothing about cygwin.
In particular bash or /bin cannot be resolved.
You can try passing 'c:/cygwin/bin/echo abc' to see if it is better.
For instance try:

exec('dir', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).

or

exec('c:/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).

What do you obtain ?

If you want a pure cygwin app you should download a source .tar.gz package and build it under cygwin.

Daniel

Le 12/12/2011 21:22, Mark Utting a écrit :
I'm trying to upgrade to Gprolog 1.4, but my exec calls to a theorem prover have stopped working.

In fact, every exec/5 call seems not to work, and causes wait/2 to throw an error as the following 2 examples show:

===================================================
$ gprolog
GNU Prolog 1.4.0
By Daniel Diaz
Copyright (C) 1999-2011 Daniel Diaz
| ?- exec('bash query_Simplify.sh simplifyFile.smp', A, B, C, PID).

A = '$stream'(3)
B = '$stream'(4)
C = '$stream'(5)
PID = 5972

yes
| ?- wait(5972, Status).
uncaught exception: error(system_error('No child processes'),wait/2)


# even /bin/echo gives the same error

| ?- exec('/bin/echo abc', A,B,C,D).

A = '$stream'(9)
B = '$stream'(10)
C = '$stream'(11)
D = 7564

yes
| ?- wait(7564).
uncaught exception: error(existence_error(procedure,wait/1),top_level/0)
| ?- wait(7564, Status).
uncaught exception: error(system_error('No child processes'),wait/2)
| ?- exec('/bin/echo', A,B,C,D).

A = '$stream'(12)
B = '$stream'(13)
C = '$stream'(14)
D = 4900

yes
| ?- wait(4900, Status).
uncaught exception: error(system_error('No child processes'),wait/2)
| ?-
=======================================================

The above exec of 'bash query_Simplify.sh simplifyFile.smp' worked fine with Gprolog 1.3.
(and that command works from the command line).

Any suggestions how I can work around this problem?


I'm using the binary 64-bit Windows version of GProlog 1.4.0:
Windows intel 64 bits auto-install setup (compiled under x86_64 / Windows 7 with MinGW64 gcc under Cygwin).

This is under Windows 7 64-bit with an up-to-date Cygwin, and Mingw 64-bit gcc installed (the gprolog and gplc commands work fine).

$ uname -a
CYGWIN_NT-6.1-WOW64 RWS034 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

Thanks!
Mark



--
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.

_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
https://lists.gnu.org/mailman/listinfo/bug-prolog


--
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.
_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
https://lists.gnu.org/mailman/listinfo/bug-prolog

Re: Gprolog 1.4 exec/5 does not work under cygwin

by Mark Utting :: Rate this Message:

| View Threaded | Show Only this Message

Daniel Diaz-3 wrote:
    A first remark without looking at details...
   
    The gprolog version you downloaded is a native Windows app. It does
    not know nothing about cygwin.
    In particular bash or /bin cannot be resolved.
    You can try passing 'c:/cygwin/bin/echo abc' to see if it is better.
    For instance try:
   
    exec('dir', I,O,E,P), repeat, get_char(O,T), write(T), T = end_of_file, !, wait(P,S).

    What do you obtain ?

Interesting, I get this:


$ gprolog
GNU Prolog 1.4.0
By Daniel Diaz
Copyright (C) 1999-2011 Daniel Diaz
| ?- exec('dir', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).
 Volume in drive C is OS
 Volume Serial Number is F44F-E564

 Directory of C:\marku\starlog\trunk

12/12/2011  12:31 PM    <DIR>          .
12/12/2011  12:31 PM    <DIR>          ..
13/12/2011  02:13 PM    <DIR>          .svn
12/12/2011  12:30 PM    <DIR>          art
12/12/2011  12:31 PM    <DIR>          cuda
12/12/2011  12:31 PM    <DIR>          doc
...
               0 File(s)              0 bytes
              31 Dir(s)  314,787,344,384 bytes free
end_of_file

uncaught exception: error(system_error('No child processes'),wait/2)
| ?-


which shows that the exec is working, but the wait is not (perhaps the child process is not being kept around as a zombie until the wait?)


>    or
>    exec('c:/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).
>    What do you obtain ?


Same result.  
I did this twice - the first time with a non-existent executable and the second time with the correct path to cygwin echo.


$ gprolog
GNU Prolog 1.4.0
By Daniel Diaz
Copyright (C) 1999-2011 Daniel Diaz
| ?- exec('c:/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).
end_of_file

uncaught exception: error(system_error('No child processes'),wait/2)
| ?- exec('c:/Apps/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).
abc
end_of_file

uncaught exception: error(system_error('No child processes'),wait/2)
| ?-

 


>    If you want a pure cygwin app you should download a source .tar.gz package and build it under cygwin.


Yes, I've tried that.  It builds and installs successfully, but I get the same problem with wait/2:


Mark.Utting@RWS034 /cygdrive/c/Apps/gprolog-1.4.0/src
$ which gprolog
/usr/local/bin/gprolog


$ gprolog
GNU Prolog 1.4.0
By Daniel Diaz
Copyright (C) 1999-2011 Daniel Diaz
| ?- exec('dir', I,O,E,P), repeat, get_char(O,T), write(T),  T = end_of_file, !, wait(P,S).
 Volume in drive C is OS
 Volume Serial Number is F44F-E564

 Directory of C:\Apps\gprolog-1.4.0\src

14/12/2011  06:01 AM    <DIR>          .
14/12/2011  06:01 AM    <DIR>          ..
17/12/2008  02:36 AM             4,131 .indent.pro
18/06/1999  05:53 PM             7,832 AUTOCONF-INFO
14/12/2011  06:00 AM    <DIR>          BipsFD
14/12/2011  05:59 AM    <DIR>          BipsPl
...
              22 File(s)        414,279 bytes
              16 Dir(s)  314,768,809,984 bytes free
end_of_file

uncaught exception: error(system_error('No child processes'),wait/2)
| ?-


> Does the gprolog 1.4.0 wait/2 call work on your Windows machine?

Ordinary C programs that use exec and wait seem to work fine,
for example the fork-03.c program here: http://www.csl.mtu.edu/cs4411/www/NOTES/process/fork/wait.html  seems to produce the expected output.


Thanks
Mark


   

Re: Gprolog 1.4 exec/5 does not work under cygwin

by Daniel Diaz-3 :: Rate this Message:

| View Threaded | Show Only this Message

Hello Mark,

sorry I'm overheaded currently. Could tou however try the last version
(in unstable):

http://gprolog.univ-paris1.fr/unstable/gprolog-20120131.tgz

I have fixed somethings about wait/2.

Please keep me informed.

Daniel

Le 06/02/2012 08:36, Mark Utting a écrit :

>
> Daniel Diaz-3 wrote:
>>      A first remark without looking at details...
>>
>>      The gprolog version you downloaded is a native Windows app. It does
>>      not know nothing about cygwin.
>>      In particular bash or /bin cannot be resolved.
>>      You can try passing 'c:/cygwin/bin/echo abc' to see if it is better.
>>      For instance try:
>>
>>      exec('dir', I,O,E,P), repeat, get_char(O,T), write(T), T =
>> end_of_file, !, wait(P,S).
>>
>>      What do you obtain ?
>>
>
> Interesting, I get this:
>
>
> $ gprolog
> GNU Prolog 1.4.0
> By Daniel Diaz
> Copyright (C) 1999-2011 Daniel Diaz
> | ?- exec('dir', I,O,E,P), repeat, get_char(O,T), write(T),  T =
> end_of_file, !, wait(P,S).
>   Volume in drive C is OS
>   Volume Serial Number is F44F-E564
>
>   Directory of C:\marku\starlog\trunk
>
> 12/12/2011  12:31 PM<DIR>           .
> 12/12/2011  12:31 PM<DIR>           ..
> 13/12/2011  02:13 PM<DIR>           .svn
> 12/12/2011  12:30 PM<DIR>           art
> 12/12/2011  12:31 PM<DIR>           cuda
> 12/12/2011  12:31 PM<DIR>           doc
> ...
>                 0 File(s)              0 bytes
>                31 Dir(s)  314,787,344,384 bytes free
> end_of_file
>
> uncaught exception: error(system_error('No child processes'),wait/2)
> | ?-
>
>
> which shows that the exec is working, but the wait is not (perhaps the child
> process is not being kept around as a zombie until the wait?)
>
>
>>     or
>>     exec('c:/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T),
>> write(T),  T = end_of_file, !, wait(P,S).
>>     What do you obtain ?
>
> Same result.
> I did this twice - the first time with a non-existent executable and the
> second time with the correct path to cygwin echo.
>
>
> $ gprolog
> GNU Prolog 1.4.0
> By Daniel Diaz
> Copyright (C) 1999-2011 Daniel Diaz
> | ?- exec('c:/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T),
> write(T),  T = end_of_file, !, wait(P,S).
> end_of_file
>
> uncaught exception: error(system_error('No child processes'),wait/2)
> | ?- exec('c:/Apps/cygwin/bin/echo abc', I,O,E,P), repeat, get_char(O,T),
> write(T),  T = end_of_file, !, wait(P,S).
> abc
> end_of_file
>
> uncaught exception: error(system_error('No child processes'),wait/2)
> | ?-
>
>
>
>
>>     If you want a pure cygwin app you should download a source .tar.gz
>> package and build it under cygwin.
>
> Yes, I've tried that.  It builds and installs successfully, but I get the
> same problem with wait/2:
>
>
> Mark.Utting@RWS034 /cygdrive/c/Apps/gprolog-1.4.0/src
> $ which gprolog
> /usr/local/bin/gprolog
>
>
> $ gprolog
> GNU Prolog 1.4.0
> By Daniel Diaz
> Copyright (C) 1999-2011 Daniel Diaz
> | ?- exec('dir', I,O,E,P), repeat, get_char(O,T), write(T),  T =
> end_of_file, !, wait(P,S).
>   Volume in drive C is OS
>   Volume Serial Number is F44F-E564
>
>   Directory of C:\Apps\gprolog-1.4.0\src
>
> 14/12/2011  06:01 AM<DIR>           .
> 14/12/2011  06:01 AM<DIR>           ..
> 17/12/2008  02:36 AM             4,131 .indent.pro
> 18/06/1999  05:53 PM             7,832 AUTOCONF-INFO
> 14/12/2011  06:00 AM<DIR>           BipsFD
> 14/12/2011  05:59 AM<DIR>           BipsPl
> ...
>                22 File(s)        414,279 bytes
>                16 Dir(s)  314,768,809,984 bytes free
> end_of_file
>
> uncaught exception: error(system_error('No child processes'),wait/2)
> | ?-
>
>
>> Does the gprolog 1.4.0 wait/2 call work on your Windows machine?
> Ordinary C programs that use exec and wait seem to work fine,
> for example the fork-03.c program here:
> http://www.csl.mtu.edu/cs4411/www/NOTES/process/fork/wait.html  seems to
> produce the expected output.
>
>
> Thanks
> Mark
>
>
>


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


_______________________________________________
Bug-prolog mailing list
Bug-prolog@...
https://lists.gnu.org/mailman/listinfo/bug-prolog