I have been using the Lisp Linear Algebra package (LLA) for about a year. It provides a Common Lisp interface to the BLAS and LAPACK libraries using CFFI. I use SBCL on Windows and have been loading the BLAS and LAPACK libraries from Cygwin64.
A couple of days ago I updated my Cygwin installation (because of the Shellshock vulnerability) and now when I load these libraries, my SBCL process crashes after a second or two.
CL-USER> (ql:quickload "cffi") To load "cffi": Load 1 ASDF system: cffi ; Loading "cffi" ; Loading system definition for alexandria from C:/Users/Dad/quicklisp/dists/quicklisp/software/alexandria-20140826-git/alexandria.asd ; Registering #<SYSTEM "alexandria"> ; Loading system definition for trivial-features from C:/Users/Dad/quicklisp/dists/quicklisp/software/trivial-features-20130312-git/trivial-features.asd ; Registering #<SYSTEM "trivial-features"> ; Loading system definition for babel from C:/Users/Dad/quicklisp/dists/quicklisp/software/babel-20140713-git/babel.asd ; Registering #<SYSTEM "babel"> . ("cffi") CL-USER> (cffi:load-foreign-library "CYGBLAS-0.DLL") #<CFFI:FOREIGN-LIBRARY CYGBLAS-0.DLL-872 "CYGBLAS-0.DLL"> (crashed)
The two libraries I load (CYGBLAS-0.DLL and CYGLAPACK-0.DLL) have not changed in about a year. Other libraries (such as the DLLs found in Windows/System32) load without a problem. The Lapack libraries in the Cygwin32 distribution are not recognized as valid Win32 applications by CFFI. I've tried older versions of SBCL and CFFI with no success.
I've replicated the problem exactly on a second machine. It should be easy to test: Install SBCL, install Cygwin64, install CFFI, and then try (cffi:load-foreign-library "CYGBLAS-0.DLL"). You may have to provide the full path. Sometimes it takes a short while for the process to crash.
I'm very baffled by the problem, and I hope someone on this list will have a fix or some ideas on how to debug the situation. I'd also appreciate it if someone would see if the problem replicates on their machine. Also, if someone has a source for alternate DLLs for BLAS and LAPACK that CFFI can load on Windows, I could try those to see if they have the same problem.
Thanks!
Scott Turner
Hello Scott,
From your description, it seems unlikely that CFFI is to blame. Can you
reproduce the crash using sb-alien:load-shared-object instead?
(sent from my phone) On Oct 4, 2014 4:59 AM, "Scott Turner" srt19170@gmail.com wrote:
I have been using the Lisp Linear Algebra package (LLA) for about a year. It provides a Common Lisp interface to the BLAS and LAPACK libraries using CFFI. I use SBCL on Windows and have been loading the BLAS and LAPACK libraries from Cygwin64.
A couple of days ago I updated my Cygwin installation (because of the Shellshock vulnerability) and now when I load these libraries, my SBCL process crashes after a second or two.
CL-USER> (ql:quickload "cffi") To load "cffi": Load 1 ASDF system: cffi ; Loading "cffi" ; Loading system definition for alexandria from C:/Users/Dad/quicklisp/dists/quicklisp/software/alexandria-20140826-git/alexandria.asd ; Registering #<SYSTEM "alexandria"> ; Loading system definition for trivial-features from C:/Users/Dad/quicklisp/dists/quicklisp/software/trivial-features-20130312-git/trivial-features.asd ; Registering #<SYSTEM "trivial-features"> ; Loading system definition for babel from C:/Users/Dad/quicklisp/dists/quicklisp/software/babel-20140713-git/babel.asd ; Registering #<SYSTEM "babel"> . ("cffi") CL-USER> (cffi:load-foreign-library "CYGBLAS-0.DLL") #<CFFI:FOREIGN-LIBRARY CYGBLAS-0.DLL-872 "CYGBLAS-0.DLL"> (crashed)
The two libraries I load (CYGBLAS-0.DLL and CYGLAPACK-0.DLL) have not changed in about a year. Other libraries (such as the DLLs found in Windows/System32) load without a problem. The Lapack libraries in the Cygwin32 distribution are not recognized as valid Win32 applications by CFFI. I've tried older versions of SBCL and CFFI with no success.
I've replicated the problem exactly on a second machine. It should be easy to test: Install SBCL, install Cygwin64, install CFFI, and then try (cffi:load-foreign-library "CYGBLAS-0.DLL"). You may have to provide the full path. Sometimes it takes a short while for the process to crash.
I'm very baffled by the problem, and I hope someone on this list will have a fix or some ideas on how to debug the situation. I'd also appreciate it if someone would see if the problem replicates on their machine. Also, if someone has a source for alternate DLLs for BLAS and LAPACK that CFFI can load on Windows, I could try those to see if they have the same problem.
Thanks!
Scott Turner
Cffi-devel mailing list Cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
On Sat, Oct 4, 2014 at 3:50 PM, Luís Oliveira luismbo@gmail.com wrote:
From your description, it seems unlikely that CFFI is to blame. Can you reproduce the crash using sb-alien:load-shared-object instead?
I didn't know about sb-alien -- you learn something new with every bug.
The crash is reproducible with sb-alien:load-shared-object as well. Does that confirm that the problem is with the DLLs? I can cross-post this to the SBCL list and see if anyone there has any insight.
-- Scott
Scott, the problem is probably either with the DLLs or SBCL. At this point, I'd try to reproduce the crash with another Lisp, e.g. CCL.
(sent from my phone) On Oct 4, 2014 9:55 PM, "Scott Turner" srt19170@gmail.com wrote:
On Sat, Oct 4, 2014 at 3:50 PM, Luís Oliveira luismbo@gmail.com wrote:
From your description, it seems unlikely that CFFI is to blame. Can you reproduce the crash using sb-alien:load-shared-object instead?
I didn't know about sb-alien -- you learn something new with every bug.
The crash is reproducible with sb-alien:load-shared-object as well. Does that confirm that the problem is with the DLLs? I can cross-post this to the SBCL list and see if anyone there has any insight.
-- Scott
On Sat, Oct 4, 2014 at 5:35 PM, Luís Oliveira luismbo@gmail.com wrote:
Scott, the problem is probably either with the DLLs or SBCL.
After many hours of testing, it looks like the problem is in the 64 bit version of SBCL. I'm going to take this discussion over to the SBCL list, but I appreciate your help. Learning about sb-alien was very helpful.
-- Scott Turner
On Sat, Oct 4, 2014 at 8:09 PM, Scott Turner srt19170@gmail.com wrote:
On Sat, Oct 4, 2014 at 5:35 PM, Luís Oliveira luismbo@gmail.com wrote:
Scott, the problem is probably either with the DLLs or SBCL.
Did you double-check that the libraries are in Windows' PATH?
Mirko