I have made this change removing the "lib/" part of the path for Darwin (in the cffi-libffi branch, which is what I am maintaining now, and requires the cffi-libffi branch of Antik and the fsbv branch of CFFI). As far as CFFI accepting a pathname is concerned, see <a href="http://lists.common-lisp.net/pipermail/cffi-devel/2012-February/003693.html">this recent email</a>; this should be a fixed problem in CFFI. So do we need the ccl:native-translated-namestring anymore?<br>
<br>Liam<br><br>Head: 2ea64e9044 - Rename dependent system cffi-libffi, fix Darwin path<br><br><br><div class="gmail_quote">On Fri, Nov 25, 2011 at 11:48 PM, Yuan MEI <span dir="ltr"><<a href="mailto:yuan.mei@gmail.com" target="_blank">yuan.mei@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think it is a good idea. (gsl-config-pathname<br>
"lib/libgslcblas.dylib") could be abandoned and (:darwin<br>
"libgslcblas.dylib") would just work fine. I have already confirmed<br>
such change works on CCL 1.7 and SBCL 1.0.52 (both are x86-64, on<br>
MacOSX Lion).<br>
<br>
Yuan<br>
<br>
(cffi:define-foreign-library libgsl<br>
(:darwin "libgsl.dylib")<br>
<div> (:cygwin "cyggsl-0.dll")<br>
(:unix (:or "libgsl.so.0" "libgsl.so"))<br>
(t (:default "libgsl")))<br>
<br>
</div><div><div></div><div>On Thu, Nov 24, 2011 at 10:27 PM, Liam Healy <<a href="mailto:lhealy@common-lisp.net" target="_blank">lhealy@common-lisp.net</a>> wrote:<br>
> In light of this:<br>
><br>
> <a href="http://lispcaveats.tumblr.com/post/13259176455/ffi-linking-against-shared-libraries" target="_blank">http://lispcaveats.tumblr.com/post/13259176455/ffi-linking-against-shared-libraries</a><br>
><br>
> I'd like to reconsider these changes. Can we remove the special-case<br>
> :darwin :ccl conditional that has the literal path, and leave this up to<br>
> dlopen?<br>
><br>
> Liam<br>
><br>
> On Mon, Oct 17, 2011 at 11:16 PM, Liam Healy <<a href="mailto:lhealy@common-lisp.net" target="_blank">lhealy@common-lisp.net</a>> wrote:<br>
>><br>
>> Yuan,<br>
>><br>
>> Thanks for the patch. I don't use MacOSX so I can't test it, but I've<br>
>> committed it. If possible, in the future please join the mailing list<br>
>> and post your items there. As far as your CFFI suggestions go, I<br>
>> encourage you to post them on the cffi-devel list; Mac users seem to<br>
>> have a lot of trouble with paths and anything that improves that<br>
>> situation should be welcome.<br>
>><br>
>> Liam<br>
>><br>
>> On Thu, Oct 13, 2011 at 5:46 PM, Yuan MEI <<a href="mailto:yuan.mei@gmail.com" target="_blank">yuan.mei@gmail.com</a>> wrote:<br>
>> > Hi Liam,<br>
>> > I've started using GSLL. It is wonderful! I just discovered a<br>
>> > glitch though, when using CCL under MacOSX, it complains that a<br>
>> > #P"xxx.dylib" is not accepted. I'd rather think cffi should be blamed<br>
>> > for not accepting a path, but I'd like to let you know that there is<br>
>> > this issue and here is a quick fix. Actually a better portable way<br>
>> > should be implemented to translate #P"" to a string that cffi could<br>
>> > understand, or better cffi should be modified to accept #P in any CL<br>
>> > implementation on any platform.<br>
>> ><br>
>> > Thanks,<br>
>> ><br>
>> > Yuan Mei<br>
>> ><br>
>> > diff --git a/init/init.lisp b/init/init.lisp<br>
>> > index 41ef370..e632f09 100644<br>
>> > --- a/init/init.lisp<br>
>> > +++ b/init/init.lisp<br>
>> > @@ -66,7 +66,9 @@<br>
>> > (merge-pathnames pn (pathname (format nil "~a/" (gsl-config<br>
>> > "--prefix"))))))<br>
>> ><br>
>> > (cffi:define-foreign-library libgslcblas<br>
>> > - (:darwin #.(gsl-config-pathname "lib/libgslcblas.dylib"))<br>
>> > + (:darwin #+ccl #.(ccl:native-translated-namestring<br>
>> > + (gsl-config-pathname "lib/libgslcblas.dylib"))<br>
>> > + #-ccl #.(gsl-config-pathname "lib/libgslcblas.dylib"))<br>
>> > (:cygwin "cyggslcblas-0.dll")<br>
>> > (:unix (:or "libgslcblas.so.0" "libgslcblas.so"))<br>
>> > (t (:default "libgslcblas")))<br>
>> > @@ -80,9 +82,12 @@<br>
>> > (cffi:load-foreign-library "/lib/lapack/cygblas.dll")<br>
>> ><br>
>> > (cffi:define-foreign-library libgsl<br>
>> > - (:darwin #. (gsl-config-pathname "lib/libgsl.dylib"))<br>
>> > + (:darwin #+ccl #.(ccl:native-translated-namestring<br>
>> > + (gsl-config-pathname "lib/libgsl.dylib"))<br>
>> > + #-ccl #.(gsl-config-pathname "lib/libgsl.dylib"))<br>
>> > (:cygwin "cyggsl-0.dll")<br>
>> > (:unix (:or "libgsl.so.0" "libgsl.so"))<br>
>> > (t (:default "libgsl")))<br>
>> ><br>
>> > (cffi:use-foreign-library libgsl)<br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>