I posted this message on c.l.l, where it was suggested that I try this mailing list.
I am trying to link to Gnu Scientific Library into clisp (2.44) on cygwin (I am trying to get nlisp running on cygwin)
(On cygwin, the shareable libraries (dll's) are prefixed with cyg, and live in /bin (linked to /usr/bin)).
I tried several variants of (cffi:define-foreign-library libgsl ...) Here is the transcript of one: CL-USER> (defpackage :cffi-user (:use :common-lisp :cffi)) #<PACKAGE CFFI-USER> CL-USER> (in-package :cffi-user) #<PACKAGE CFFI-USER> CFFI-USER> (cffi:define-foreign-library libgsl (:unix (:or "/bin/cyggsl-0.dll"))) LIBGSL CFFI-USER> (cffi:use-foreign-library libgsl) ; Evaluation aborted. CFFI-USER>
The error message is Unable to load any of the alternatives: ("/bin/cyggsl-0.dll") [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
I tried other alternatives, such as not specifying the full path in the library definition, and also setting the cffi:*foreign-library- directories*, but none of them could load the library.
I can (probe-file and (probe-directory, so I think I am OK there.
Anything obviously wrong in my definitions?
Thanks,
Mirko
On 18/02/2008, Mirko.Vukovic@gmail.com Mirko.Vukovic@gmail.com wrote:
Unable to load any of the alternatives: ("/bin/cyggsl-0.dll") [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
What does (cffi:load-foreign-library "/bin/cyggsl-0.dll") tell you?
On Mon, Feb 18, 2008 at 8:06 AM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko.Vukovic@gmail.com Mirko.Vukovic@gmail.com wrote:
Unable to load any of the alternatives: ("/bin/cyggsl-0.dll") [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
What does (cffi:load-foreign-library "/bin/cyggsl-0.dll") tell you?
-- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Luis,
Doing a (cffi:load gives:
EVAL: variable LIBGSL has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]
(I am doing this in emacs+slime)
I tried (type-of libgsl) at the top level and got the same message.
But doing (cffi:use-...) still gives the same message (unable to load).
gsl comes with documentation. I am trying to build its simple example in c using the shareable dll to verify that it is working. It will take me a bit to get that right (I'm not fluent in c)
Thanks,
Mirko
On Mon, Feb 18, 2008 at 9:04 AM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Mon, Feb 18, 2008 at 8:06 AM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko.Vukovic@gmail.com Mirko.Vukovic@gmail.com wrote:
Unable to load any of the alternatives: ("/bin/cyggsl-0.dll") [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
What does (cffi:load-foreign-library "/bin/cyggsl-0.dll") tell you?
-- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Luis,
Doing a (cffi:load gives:
EVAL: variable LIBGSL has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]
(I am doing this in emacs+slime)
I tried (type-of libgsl) at the top level and got the same message.
But doing (cffi:use-...) still gives the same message (unable to load).
gsl comes with documentation. I am trying to build its simple example in c using the shareable dll to verify that it is working. It will take me a bit to get that right (I'm not fluent in c)
Thanks,
Mirko
ok, I managed to compile a little c example and succesfully link against the shareable dll. It works.
Mirko
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Mon, Feb 18, 2008 at 8:06 AM, Luís Oliveira luismbo@gmail.com wrote:
What does (cffi:load-foreign-library "/bin/cyggsl-0.dll") tell you?
[...]
Doing a (cffi:load gives:
EVAL: variable LIBGSL has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]
That sounds like you tried (cffi:load-foreign-library libgsl) instead of (cffi:load-foreign-library "/bin/cyggsl-0.dll"). Can you try again?
Also, what version of CFFI are you using?
On Mon, Feb 18, 2008 at 10:01 AM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Mon, Feb 18, 2008 at 8:06 AM, Luís Oliveira luismbo@gmail.com wrote:
What does (cffi:load-foreign-library "/bin/cyggsl-0.dll") tell you?
[...]
Doing a (cffi:load gives:
EVAL: variable LIBGSL has no value [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]
That sounds like you tried (cffi:load-foreign-library libgsl) instead of (cffi:load-foreign-library "/bin/cyggsl-0.dll"). Can you try again?
This time I get:
Unable to load foreign library: /bin/cyggsl-0.dll [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
Also, what version of CFFI are you using?
0.9.2
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Thanks,
Mirko
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Also, what version of CFFI are you using?
0.9.2
Can you try the same thing with the latest version from darcs? darcs get --partial http://common-lisp.net/project/cffi/darcs/cffi
If you don't have darcs, you can get the latest snapshot instead: http://common-lisp.net/project/cffi/tarballs/cffi-080216.tar.gz
On Mon, Feb 18, 2008 at 10:53 AM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Also, what version of CFFI are you using?
0.9.2
Can you try the same thing with the latest version from darcs? darcs get --partial http://common-lisp.net/project/cffi/darcs/cffi
If you don't have darcs, you can get the latest snapshot instead: http://common-lisp.net/project/cffi/tarballs/cffi-080216.tar.gz
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Here is the transcript with the latest cffi:
CFFI-USER> (setf *target* #p"/bin/cyggsl-0.dll") #P"/bin/cyggsl-0.dll" CFFI-USER> (probe-file *target*) #P"/bin/cyggsl-0.dll" CFFI-USER> (cffi:load-foreign-library *target*)
and the error message:
Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
Mirko
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
CFFI-USER> (setf *target* #p"/bin/cyggsl-0.dll") #P"/bin/cyggsl-0.dll" CFFI-USER> (probe-file *target*) #P"/bin/cyggsl-0.dll" CFFI-USER> (cffi:load-foreign-library *target*)
and the error message:
Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
I'm out of ideas, sorry. It works for me on Cygwin:
[3]> (cffi:load-foreign-library "/bin/cyggsl-0.dll") #<CFFI::FOREIGN-LIBRARY #x1030C799>
[4]> (lisp-implementation-version) "2.44 (2008-02-02) (built on reini [192.168.1.7])" [5]> (software-version) "GNU C 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)"
On Mon, Feb 18, 2008 at 2:18 PM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
CFFI-USER> (setf *target* #p"/bin/cyggsl-0.dll") #P"/bin/cyggsl-0.dll" CFFI-USER> (probe-file *target*) #P"/bin/cyggsl-0.dll" CFFI-USER> (cffi:load-foreign-library *target*)
and the error message:
Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
I'm out of ideas, sorry. It works for me on Cygwin:
[3]> (cffi:load-foreign-library "/bin/cyggsl-0.dll") #<CFFI::FOREIGN-LIBRARY #x1030C799>
[4]> (lisp-implementation-version) "2.44 (2008-02-02) (built on reini [192.168.1.7])" [5]> (software-version) "GNU C 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)"
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Well, in one sense, that is good news: it can work. I just need to look harder to see where it is failing on my machine.
Can you just tell me what are the permission settings of the dll's that you have? (I'm grasping at straws here)
Thanks,
Mirko
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Can you just tell me what are the permission settings of the dll's that you have? (I'm grasping at straws here)
$ cygcheck /bin/cyggsl-0.dll | sed 's/\///g' | xargs ls -gGh -rwxrwx---+ 1 603K Aug 4 2004 C:/WINDOWS/system32/ADVAPI32.DLL -rwxrwx---+ 1 962K Apr 16 2007 C:/WINDOWS/system32/KERNEL32.dll -rwxrwx---+ 1 571K Jul 9 2007 C:/WINDOWS/system32/RPCRT4.dll -rwxrwx---+ 1 55K Aug 4 2004 C:/WINDOWS/system32/Secur32.dll -rwxrwx---+ 1 692K Aug 4 2004 C:/WINDOWS/system32/ntdll.dll -rwxr-x---+ 1 1.6M Sep 18 21:34 C:/cygwin/bin/cyggsl-0.dll -rwxr-x---+ 1 1.8M Dec 14 18:22 C:/cygwin/bin/cygwin1.dll -rwxr-x---+ 1 578K Mar 24 2006 C:/cygwin/lib/lapack/cygblas.dll
HTH.
On Mon, Feb 18, 2008 at 6:05 PM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Can you just tell me what are the permission settings of the dll's that you have? (I'm grasping at straws here)
$ cygcheck /bin/cyggsl-0.dll | sed 's/\///g' | xargs ls -gGh -rwxrwx---+ 1 603K Aug 4 2004 C:/WINDOWS/system32/ADVAPI32.DLL -rwxrwx---+ 1 962K Apr 16 2007 C:/WINDOWS/system32/KERNEL32.dll -rwxrwx---+ 1 571K Jul 9 2007 C:/WINDOWS/system32/RPCRT4.dll -rwxrwx---+ 1 55K Aug 4 2004 C:/WINDOWS/system32/Secur32.dll -rwxrwx---+ 1 692K Aug 4 2004 C:/WINDOWS/system32/ntdll.dll -rwxr-x---+ 1 1.6M Sep 18 21:34 C:/cygwin/bin/cyggsl-0.dll -rwxr-x---+ 1 1.8M Dec 14 18:22 C:/cygwin/bin/cygwin1.dll -rwxr-x---+ 1 578K Mar 24 2006 C:/cygwin/lib/lapack/cygblas.dll
HTH.
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Thanks. same here
You know what's funny (I mean exasperating)? I can load the curl library (the one in the cffi tutorial).
2008/2/18, Mirko Vukovic mirko.vukovic@gmail.com:
On Mon, Feb 18, 2008 at 2:18 PM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
CFFI-USER> (setf *target* #p"/bin/cyggsl-0.dll") #P"/bin/cyggsl-0.dll" CFFI-USER> (probe-file *target*) #P"/bin/cyggsl-0.dll" CFFI-USER> (cffi:load-foreign-library *target*)
and the error message:
Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
I'm out of ideas, sorry. It works for me on Cygwin:
[3]> (cffi:load-foreign-library "/bin/cyggsl-0.dll") #<CFFI::FOREIGN-LIBRARY #x1030C799>
[4]> (lisp-implementation-version) "2.44 (2008-02-02) (built on reini [192.168.1.7])" [5]> (software-version) "GNU C 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)"
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Well, in one sense, that is good news: it can work. I just need to look harder to see where it is failing on my machine.
Can you just tell me what are the permission settings of the dll's that you have? (I'm grasping at straws here)
What does $ cygcheck cyggsl-0.dll return for you? This should be your problem. As I said I suspect lapack is not in your path, or there is some problem loading the blas dll.
$ cygcheck cyggsl-0.dll Found: d:\cygwin\bin\cyggsl-0.dll d:\cygwin\bin\cyggsl-0.dll d:\cygwin\lib\lapack\cygblas.dll d:\cygwin\bin\cygwin1.dll C:\WINDOWS\system32\ADVAPI32.DLL C:\WINDOWS\system32\ntdll.dll C:\WINDOWS\system32\KERNEL32.dll C:\WINDOWS\system32\RPCRT4.dll C:\WINDOWS\system32\Secur32.dll
On Tue, Feb 19, 2008 at 9:54 AM, Reini Urban rurban@x-ray.at wrote:
2008/2/18, Mirko Vukovic mirko.vukovic@gmail.com:
On Mon, Feb 18, 2008 at 2:18 PM, Luís Oliveira luismbo@gmail.com wrote:
On 18/02/2008, Mirko Vukovic mirko.vukovic@gmail.com wrote:
CFFI-USER> (setf *target* #p"/bin/cyggsl-0.dll") #P"/bin/cyggsl-0.dll" CFFI-USER> (probe-file *target*) #P"/bin/cyggsl-0.dll" CFFI-USER> (cffi:load-foreign-library *target*)
and the error message:
Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
I'm out of ideas, sorry. It works for me on Cygwin:
[3]> (cffi:load-foreign-library "/bin/cyggsl-0.dll") #<CFFI::FOREIGN-LIBRARY #x1030C799>
[4]> (lisp-implementation-version) "2.44 (2008-02-02) (built on reini [192.168.1.7])" [5]> (software-version) "GNU C 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)"
--
Luís Oliveira http://student.dei.uc.pt/~lmoliv/
Well, in one sense, that is good news: it can work. I just need to look harder to see where it is failing on my machine.
Can you just tell me what are the permission settings of the dll's that you have? (I'm grasping at straws here)
What does $ cygcheck cyggsl-0.dll return for you? This should be your problem. As I said I suspect lapack is not in your path, or there is some problem loading the blas dll.
$ cygcheck cyggsl-0.dll Found: d:\cygwin\bin\cyggsl-0.dll d:\cygwin\bin\cyggsl-0.dll d:\cygwin\lib\lapack\cygblas.dll d:\cygwin\bin\cygwin1.dll
C:\WINDOWS\system32\ADVAPI32.DLL C:\WINDOWS\system32\ntdll.dll C:\WINDOWS\system32\KERNEL32.dll C:\WINDOWS\system32\RPCRT4.dll C:\WINDOWS\system32\Secur32.dll
-- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://spacemovie.mur.at/ http://helsinki.at/
Reini, I get the identical output to cygcheck as you. I don't know if I emailed to you, but I did write a little C program and linked it against the cyggsl-0.dll, and it worked.
I'm a bit puzzled by the error message: it is identical to the one if I give it a non-existant file name. Here is with an existing cyggsl-0.dll: Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dll": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
And here when loading cyggsl-0.dlla which does not exist: Unable to load foreign library (NIL). FFI::FOREIGN-LIBRARY: Cannot open library "/bin/cyggsl-0.dlla": "No such file or directory" [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
To my untrained eyes, it is almost that it really does not see the file.
I think that I need to play a bit in the debugger stack. I see that the -helper and -path functions are involved. Time to finally learn how to use slime's debugging features.
Thanks for staying with me this long :-)
Mirko
BTW, I keep replying to both you and and Luis directly, as well as to the cffi-devel. If direct emails are annoying, let me know.