pysmt-install: Installed yices binary is broken on older platforms
csH7KmCC9 opened this issue · comments
If I install Yices with pysmt-install --yices
, then change the solver in my project to use Yices rather than z3 (and also removing the timeout option), I get SIGILL, and everything dies.
Here's the backtrace (unfortunately values were optimized out so this is the best I can do):
Program received signal SIGILL, Illegal instruction.
0x00007ffff4d195ed in __gmpn_set_str () from /usr/local/lib/python3.7/dist-packages/yices_bin/lib/libyices.so.2.6
(gdb)
(gdb) bt
#0 0x00007ffff4d195ed in __gmpn_set_str () from /usr/local/lib/python3.7/dist-packages/yices_bin/lib/libyices.so.2.6
#1 0x00007ffff4d1048a in __gmpz_set_str () from /usr/local/lib/python3.7/dist-packages/yices_bin/lib/libyices.so.2.6
#2 0x00007ffff4acc74c in ?? () from /usr/local/lib/python3.7/dist-packages/yices_bin/lib/libyices.so.2.6
#3 0x00007ffff49a32b0 in yices_parse_rational () from /usr/local/lib/python3.7/dist-packages/yices_bin/lib/libyices.so.2.6
#4 0x00007ffff6d02d92 in _wrap_yices_parse_rational (self=<optimized out>, args=<optimized out>) at yices_python_wrap.c:7780
#5 0x00000000005ccc42 in _PyMethodDef_RawFastCallKeywords ()
pysmt-install --yices
gives these potentially-related warnings:
swigging yices_python.i to yices_python_wrap.c
swig -python -I/usr/local/lib/python3.7/dist-packages/yices_bin/include -o yices_python_wrap.c yices_python.i
creating build
creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.7/dist-packages/yices_bin/include -I/usr/include/python3.7m -c yices_python_wrap.c -o build/temp.linux-x86_64-3.7/yices_python_wrap.o
yices_python_wrap.c: In function ‘_wrap_yices_poly_int64’:
yices_python_wrap.c:8424:42: warning: passing argument 2 of ‘yices_poly_int64’ from incompatible pointer type [-Wincompatible-pointer-types]
result = (term_t)yices_poly_int64(arg1,(long long const (*))arg2,(int const (*))arg3);
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from yices_python_wrap.c:3254:
/usr/local/lib/python3.7/dist-packages/yices_bin/include/yices.h:1286:76: note: expected ‘const int64_t *’ {aka ‘const long int *’} but argument is of type ‘const long long int *’
__YICES_DLLSPEC__ extern term_t yices_poly_int64(uint32_t n, const int64_t a[], const term_t t[]);
~~~~~~~~~~~~~~^~~
yices_python_wrap.c: In function ‘_wrap_yices_poly_rational64’:
yices_python_wrap.c:8556:47: warning: passing argument 2 of ‘yices_poly_rational64’ from incompatible pointer type [-Wincompatible-pointer-types]
result = (term_t)yices_poly_rational64(arg1,(long long const (*))arg2,(unsigned long long const (*))arg3,(int const (*))arg4);
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from yices_python_wrap.c:3254:
/usr/local/lib/python3.7/dist-packages/yices_bin/include/yices.h:1299:81: note: expected ‘const int64_t *’ {aka ‘const long int *’} but argument is of type ‘const long long int *’
__YICES_DLLSPEC__ extern term_t yices_poly_rational64(uint32_t n, const int64_t num[], const uint64_t den[], const term_t t[]);
~~~~~~~~~~~~~~^~~~~
yices_python_wrap.c:8556:73: warning: passing argument 3 of ‘yices_poly_rational64’ from incompatible pointer type [-Wincompatible-pointer-types]
result = (term_t)yices_poly_rational64(arg1,(long long const (*))arg2,(unsigned long long const (*))arg3,(int const (*))arg4);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from yices_python_wrap.c:3254:
/usr/local/lib/python3.7/dist-packages/yices_bin/include/yices.h:1299:103: note: expected ‘const uint64_t *’ {aka ‘const long unsigned int *’} but argument is of type ‘const long long unsigned int *’
__YICES_DLLSPEC__ extern term_t yices_poly_rational64(uint32_t n, const int64_t num[], const uint64_t den[], const term_t t[]);
~~~~~~~~~~~~~~~^~~~~
yices_python_wrap.c: In function ‘_wrap__yices_get_integer_value’:
yices_python_wrap.c:14092:11: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
int32_t result;
^~~~~~
yices_python_wrap.c:14091:9: warning: unused variable ‘val’ [-Wunused-variable]
mpz_t val ;
^~~
yices_python_wrap.c:14090:10: warning: unused variable ‘t’ [-Wunused-variable]
term_t t ;
^
yices_python_wrap.c:14089:12: warning: unused variable ‘mdl’ [-Wunused-variable]
model_t *mdl ;
^~~
yices_python_wrap.c: In function ‘_wrap__yices_get_rational_value’:
yices_python_wrap.c:14153:9: warning: unused variable ‘out’ [-Wunused-variable]
mpq_t out ;
^~~
yices_python_wrap.c:14152:10: warning: unused variable ‘t’ [-Wunused-variable]
term_t t ;
^
yices_python_wrap.c:14151:12: warning: unused variable ‘mdl’ [-Wunused-variable]
model_t *mdl ;
^~~
Hi @csH7KmCC9 ,
thanks for reporting this. Which OS (and OS version) are you using?
Debian 10 x86-64
FWIW I tried to add a print debugging statement print("yices wrapper parsing %s" % s)
to see what was borking yices/gmp on line 820 of ~/.local/lib/python3.7/site-packages/yicespy.py, but I couldn't figure out how to make it actually effective and never got the desired debug output...
Actually, I think this is an issue with the static yices binary. I'm using an older machine without the newer SSSSSE7/AVX-4096 doo-dads and I guess Yices is assuming support for them. Building Yices from source and replacing the binaries/libs/includes in ~/.local/lib/python3.7/site-packages/yices_bin/ works fine.
So, this is not really PySMT's fault, although building from source instead of downloading static binaries is not that hard, doesn't add too many dependencies (just libgmp and a compiler I think?), and it would make pysmt-install --yices
work across a broader range of platforms.
@csH7KmCC9 Which version of pysmt are you using? Since Yices binaries are no longer available we switched to compiling yices in pysmt-install a while back: https://github.com/pysmt/pysmt/blob/master/pysmt/cmd/installers/yices.py
Could it be that the compile script we invoke is broken or outdated?
Installed from pip.
user@host:~$ pysmt-install --version
pysmt-install 0.9.0
user@host:~$ pip3 show pysmt
Name: PySMT
Version: 0.9.0
I don't know what exactly is going on but I'm quite sure it's not compiling Yices from source; it downloads yices-2.6.2-x86_64-pc-linux-gnu-static-gmp.tar.gz to ~/.smt_solvers/yices/
Ah, sure the current pip relese is a bit old. You can install the newest version with pip install PySMT==0.9.1.dev132
@marcogario I think that we shall consider advancing pysmt to a stable release to avoid this and other misaligned behaviors
We released 0.9.5 today, so this issue can be closed. I tried to install yices (2.6.2) and it compiles from source as expected.
We might upgrade the version of yices to a more recent one, but that is for another issue.