{"id":38,"date":"2014-09-22T09:00:30","date_gmt":"2014-09-22T09:00:30","guid":{"rendered":"http:\/\/www.voidbred.com\/blog\/?p=38"},"modified":"2014-09-21T01:56:17","modified_gmt":"2014-09-21T01:56:17","slug":"resolving-cffiload-foreign-library-error","status":"publish","type":"post","link":"http:\/\/www.voidbred.com\/blog\/2014\/09\/resolving-cffiload-foreign-library-error\/","title":{"rendered":"Resolving CFFI:LOAD-FOREIGN-LIBRARY-ERROR"},"content":{"rendered":"<p>So, you decided to play around with quicklisp but when you try to load some packages you get a CFFI:LOAD-FOREIGN-LIBRARY-ERROR ?\u00a0 CFFI is a Common Lisp library for interfacing with C libraries.\u00a0 So if you install a quicklisp package like SDL2 it will attempt to load the libSDL2 shared library (libSDL2.dylib on Mac OS X) so that CFFI can forward calls to the shared library.\u00a0 Usually when this error arises CFFI can&#8217;t find the library at all**.\u00a0 What you need to do is just tell CFFI how to find it.\u00a0 CFFI has a variable cffi:*foreign-library-directories* which is a list of directories to hunt for dynamic libraries.\u00a0 So you can do something like this if you library is in &#8220;\/opt\/local\/lib&#8221;:<\/p>\n<pre class=\"toolbar:2 lang:default decode:true\">(pushnew \"\/opt\/local\/lib\/\"                                                                                                                            \r\n         cffi:*foreign-library-directories*                                                                                                           \r\n         :test #'equal)<\/pre>\n<p>You could even throw this code in your init file for you lisp as well so that it always gets executed (sbcl: ~\/.sbclrc\u00a0 ccl:~\/.ccl-init.lisp)<\/p>\n<p>** You also might want to check that your architecture is correct for your lisp as well (on Mac OS X &#8220;lipo -info &lt;library file&gt;&#8221;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you decided to play around with quicklisp but when you try to load some packages you get a CFFI:LOAD-FOREIGN-LIBRARY-ERROR ?\u00a0 CFFI is a Common Lisp library for interfacing with C libraries.\u00a0 So if you install a quicklisp package like SDL2 it will attempt to load the libSDL2 shared library (libSDL2.dylib on Mac OS X)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[5],"_links":{"self":[{"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/posts\/38"}],"collection":[{"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":3,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":41,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/posts\/38\/revisions\/41"}],"wp:attachment":[{"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.voidbred.com\/blog\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}