lokedhs / cl-rabbit

RabbitMQ interface to Common Lisp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to install

udalrich opened this issue · comments

I received compilation errors while attempting to install cl-rabbit on a Mac running OS X (Darwin Kernel Version 14.5.0). I followed the directions on the readme path to use quick load. The output is shown below. It looks like there are two errors: pkg-config was not found and amqp.h was not found. I was able to install pkg-config with brew install pkg-config. That changed the error to

; pkg-config libffi --cflags
ERROR: External process exited with code 1.
Command was: "pkg-config" "libffi" "--cflags"
Output was:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Attempting to continue anyway.

The amqp.h error remained.

Original Output
$ sbcl
This is SBCL 1.1.6.0-3c5581a, an implementation of ANSI Common Lisp.
More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

  • (ql:quickload :cl-rabbit)
    To load "cl-rabbit":
    Install 7 Quicklisp releases:
    alexandria babel cffi cl-ppcre cl-rabbit
    trivial-features uiop
    ; Fetching #<URL "http://beta.quicklisp.org/archive/cl-ppcre/2015-06-08/cl-ppcre-2.0.10.tgz">
    ; 156.05KB

    159,799 bytes in 0.75 seconds (208.07KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/uiop/2015-08-04/uiop-3.1.5.tgz">
    ; 87.12KB

    89,212 bytes in 0.43 seconds (203.08KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/cffi/2015-06-08/cffi_0.15.0.tgz">
    ; 210.58KB

    215,636 bytes in 0.66 seconds (320.52KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-features/2015-07-09/trivial-features-20150709-git.tgz">
    ; 10.23KB

    10,480 bytes in 0.01 seconds (1705.73KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/babel/2015-06-08/babel-20150608-git.tgz">
    ; 248.03KB

    253,987 bytes in 0.56 seconds (440.56KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/alexandria/2015-05-05/alexandria-20150505-git.tgz">
    ; 48.78KB

    49,955 bytes in 0.25 seconds (191.31KB/sec)
    ; Fetching #<URL "http://beta.quicklisp.org/archive/cl-rabbit/2015-08-04/cl-rabbit-20150804-git.tgz">
    ; 16.63KB

    17,026 bytes in 0.02 seconds (755.77KB/sec)
    ; Loading "cl-rabbit"
    [package alexandria.0.dev]........................
    [package babel-encodings].........................
    [package babel]...................................
    ..................................................
    [package uiop/package]............................
    ..................................................
    [package cffi-sys]................................
    [package cffi]....................................
    ..................................................
    [package cffi-features]...........................
    [package cffi-grovel].............................
    [package cl-ppcre]................................
    ...................; pkg-config libffi --cflags
    ERROR: Couldn't execute "pkg-config": No such file or directory
    Attempting to continue anyway.
    ; cc -m32 -I /opt/local/include/ -I/opt/local/include/ -I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/ -o /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix.c
    ; /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix.grovel-tmp.lisp
    ...............................
    [package cl-rabbit]...............................
    [package cl-rabbit.examples]; cc -m32 -I /opt/local/include/ -I/opt/local/include/ -I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/ -o /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel /Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c

debugger invoked on a CFFI-GROVEL:GROVEL-ERROR: External process exited with code 1.
Command was: "cc" "-m32" "-I" "/opt/local/include/" "-I/opt/local/include/" "-I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/" "-o" "/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel" "/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c"
Output was:
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c:8:10: fatal error: 'amqp.h' file not found

include <amqp.h>

     ^

1 error generated.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry # on #<GROVEL-FILE "cl-rabbit" "src" "grovel">.
1: [ACCEPT] Continue, treating # on #<GROVEL-FILE "cl-rabbit" "src" "grovel"> as having been successful.
2: [ABORT ] Give up on "cl-rabbit"
3: Exit debugger, returning to top level.

(CFFI-GROVEL:GROVEL-ERROR "External process exited with code S.@
Command was: S{ S}@
Output was:
%~A" 1 "cc" ("-m32" "-I" "/opt/local/include/" "-I/opt/local/include/" "-I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/" "-o" "/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel" "/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c") "/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c:8:10: fatal error: 'amqp.h' file not found

include <amqp.h>

     ^

1 error generated.
")
0]

CFFI has a dependency on libffi when you define functions that either accept or return structs. It is quite rare that C libraries do this, which is why it's possible to use CFFI without having it installed.

rabbitmq-c does do this, which is why CFFI tries to load libffi. To install libffi on OSX all you need to do is to install it using brew: brew install libffi

I also noticed that the groveller was unable to find the amqp.h header file. Did you install rabbitmq-c?

I did not install rabbitmq-c, as the installation instructions did not
mention installing it.

Troy

On Thu, Sep 24, 2015 at 8:42 PM, Elias Mårtenson notifications@github.com
wrote:

I also noticed that the groveller was unable to find the amqp.h header
file. Did you install rabbitmq-c?


Reply to this email directly or view it on GitHub
#2 (comment).

Good point. It should be updated. I will do it, or you are welcome to send a patch to the README.

I did these commands:

brew install libffi
brew install rabbitmq-c

Both reported that the formula was keg-only, and the contents were not
symlinked to /usr/local. Attempting to run (ql:quickload :cl-rabbit) then
gave

To load "cl-rabbit":
Load 1 ASDF system:
cl-rabbit
; Loading "cl-rabbit"
; pkg-config libffi --cflags
ERROR: External process exited with code 1.
Command was: "pkg-config" "libffi" "--cflags"
Output was:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Attempting to continue anyway.
; cc -m32 -I /opt/local/include/ -I/opt/local/include/
-I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/ -o
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix.c
;
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/libffi/libffi-unix.grovel-tmp.lisp
......; cc -m32 -I /opt/local/include/ -I/opt/local/include/
-I/Users/tda0106/quicklisp/dists/quicklisp/software/cffi_0.15.0/ -o
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.c
;
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel
/Users/tda0106/.cache/common-lisp/sbcl-1.1.6.0-3c5581a-macosx-x86/Users/tda0106/quicklisp/dists/quicklisp/software/cl-rabbit-20150804-git/src/grovel.grovel-tmp.lisp
...............
debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR:
Unable to load foreign library (LIBRABBITMQ).
Error opening shared object
"/usr/local/Cellar/rabbitmq-c/0.7.0/lib/librabbitmq.4.1.1.dylib":
dlopen(/usr/local/Cellar/rabbitmq-c/0.7.0/lib/librabbitmq.4.1.1.dylib,
10): no suitable image found. Did find:
/usr/local/Cellar/rabbitmq-c/0.7.0/lib/librabbitmq.4.1.1.dylib: mach-o, but
wrong architecture.

I could fix the error about libffi by

export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig

Regarding the librabbitmq dylib error, i looked at the file types:

$ file /usr/local/Cellar/rabbitmq-c/0.7.0/lib/librabbitmq.4.1.1.dylib
/usr/local/Cellar/rabbitmq-c/0.7.0/lib/librabbitmq.4.1.1.dylib: Mach-O
64-bit dynamically linked shared library x86_64

file $(which sbcl)
/usr/local/bin/sbcl: Mach-O executable i386

So it seems I have a 32 bit sbcl and 64 bit rabbit. I deleted everything
in /usr/local matching sbcl, which I had manually installed from the sbcl
website, and ran

brew install sbcl

After some confusion trying to update my brew formulas, that worked.

So it looks like the full set of instructions for a Mac is:

Make sure sbcl is installed

brew install sbcl

Make sure libffi is installed

brew install libffi

---Use actual location of libffi.pc

export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig

Make sure rabbitmq-c is installed

brew install rabbitmq-c

Install cl-rabbitmq

sbcl
(ql:quickload :cl-rabbit)

This also assumes that brew and quickload are installed.

Thanks,
Troy

On Thu, Sep 24, 2015 at 10:28 PM, Elias Mårtenson notifications@github.com
wrote:

Good point. It should be updated. I will do it, or you are welcome to send
a patch to the README.


Reply to this email directly or view it on GitHub
#2 (comment).

Where did you get the 32-bit SBCL from? Whenever you compile it, it will always compile in 64-bit.

Last I compiled it on OSX I didn't have to go through the PKG_CONFIG_PATH steps. I will try again on my laptop and see how my configuration is different.

I got the 32-bit from a precompiled build on the sbcl site.

I see. They provide both. There isn't much that cl-rabbit can do in this case. The assumption is that the libraries can be loaded and if there is an error when doing that, cffi raises the error you could see.