Installing AMQP through PECL
Asked Answered
G

7

20

I'm trying to install the RabbitMQ PECL extension but after running

sudo pecl install amqp

I get the following cryptic error message, which extensive googling hasn't helped resolve.

I have these packages installed:

  • librabbitmq - RabbitMQ C client itself)
  • librabbitmq-dev - dev headers etc.

and RabbitMQ running successfully on localhost

Maybe it could be a mismatch in the version of the C client and what the PECL extension expects, anybody else come across this one?

Make output below....

Cheers

running: make
/bin/bash /tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/libtool --mode=compile cc  -I.         -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-        1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -I/tmp/pear/temp/amqp -      I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -       I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -    D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/amqp/amqp.c -o amqp.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-   build-rootZNUmac/amqp-1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -   I/tmp/pear/temp/amqp -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -  I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -  D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c    /tmp/pear/temp/amqp/amqp.c  -fPIC -DPIC -o .libs/amqp.o
/bin/bash /tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/libtool --mode=compile cc  -I.    -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-  1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -I/tmp/pear/temp/amqp -   I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -   I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -   D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c     /tmp/pear/temp/amqp/amqp_exchange.c -o amqp_exchange.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-   build-rootZNUmac/amqp-1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -  I/tmp/pear/temp/amqp -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -  I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -   D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c   /tmp/pear/temp/amqp/amqp_exchange.c  -fPIC -DPIC -o .libs/amqp_exchange.o
/bin/bash /tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/libtool --mode=compile cc  -I.  -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootZNUmac/amqp- 1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -I/tmp/pear/temp/amqp -  I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM - I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib - D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c  /tmp/pear/temp/amqp/amqp_queue.c -o amqp_queue.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/amqp -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/include -I/tmp/pear/temp/pear-build-rootZNUmac/amqp-1.0.0/main -   I/tmp/pear/temp/amqp -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -  I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -   D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c            /tmp/pear/temp/amqp/amqp_queue.c  -fPIC -DPIC -o .libs/amqp_queue.o
/tmp/pear/temp/amqp/amqp_queue.c: In function 'read_message_from_channel':
/tmp/pear/temp/amqp/amqp_queue.c:316:11: error: 'AMQP_FIELD_KIND_U64' undeclared (first use in this function)
/tmp/pear/temp/amqp/amqp_queue.c:316:11: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/amqp/amqp_queue.c: In function 'zim_amqp_queue_class_nack':
/tmp/pear/temp/amqp/amqp_queue.c:1020:2: error: unknown type name 'amqp_basic_nack_t'
/tmp/pear/temp/amqp/amqp_queue.c:1039:3: error: request for member 'delivery_tag' in something not a structure or union
/tmp/pear/temp/amqp/amqp_queue.c:1040:3: error: request for member 'multiple' in something not a structure or union
/tmp/pear/temp/amqp/amqp_queue.c:1041:3: error: request for member 'requeue' in something not a structure or union
/tmp/pear/temp/amqp/amqp_queue.c:1046:3: error: 'AMQP_BASIC_NACK_METHOD' undeclared     (first use in this function)
make: *** [amqp_queue.lo] Error 1
ERROR: `make' failed
Grummet answered 1/3, 2012 at 17:24 Comment(2)
I've experienced this also. On a Ubuntu Lucid system, I pulled rabbitmq-server from Ubuntu repositories, and librabbitmq-dev from the Drizzle PPA. Then doing pecl install amqp-beta results in the above error message. The same exact message also results from pecl install amqp.Appetizer
Or use the PHP only github.com/php-amqplib/php-amqplib libraryMakkah
E
3

It looks like the PECL extension is newer than the the libraries that you have got installed. Install RabbitMQ directly from the their website, using their packages and not the ones that have come with your distribution as they seems to be out of date.

Exciting answered 3/3, 2012 at 11:53 Comment(1)
Yep, Having looked at the RabbitMQ C library they make it clear it's experimental and finding a version that the PECL extension will compile against is hit and miss Instead I'm just going with a pure PHP implementation php-amqplib CheersGrummet
T
24

I had to install it applying following steps found here:

 # Download the rabbitmq-c library @ version 0-9-1
 git clone git://github.com/alanxz/rabbitmq-c.git
 cd rabbitmq-c
 # Enable and update the codegen git submodule
 git submodule init
 git submodule update
 # Configure, compile and install
 autoreconf -i && ./configure && make && sudo make install

After that, sudo pecl install amqp did the work.

Using Ubuntu 12.10 with PHP 5.4.3.

Terms answered 22/1, 2013 at 13:34 Comment(1)
On newer release versions such as Ubuntu 14.04 and PHP 5.6, you need to checkout the latest tag on the rabbitmq-c repository.pphKhaki
A
4

this is what I did to install it successfully on debian wheezy:

apt-get install pkg-config librabbitmq-dev librabbitmq0

git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c/
autoreconf -i
./configure
make
make install
pecl install amqp
Anisaanise answered 19/5, 2014 at 14:24 Comment(1)
This worked for me when all the other solutions failed (compilation errors galore). Thank you!Housebreak
E
3

It looks like the PECL extension is newer than the the libraries that you have got installed. Install RabbitMQ directly from the their website, using their packages and not the ones that have come with your distribution as they seems to be out of date.

Exciting answered 3/3, 2012 at 11:53 Comment(1)
Yep, Having looked at the RabbitMQ C library they make it clear it's experimental and finding a version that the PECL extension will compile against is hit and miss Instead I'm just going with a pure PHP implementation php-amqplib CheersGrummet
P
3

The dev lib from repo is broken (as usually....). You have to clone (from GIT or HG) and make the lib, from php.net :

hg clone http://hg.rabbitmq.com/rabbitmq-c/rev/b01825ecc112 rabbitmq-c
cd rabbitmq-c
# Add the codegen requirement. To find the full list, go here: http://hg.rabbitmq.com/rabbitmq-codegen/tags
# and copy the URL for the appropriate broker version.
hg clone http://hg.rabbitmq.com/rabbitmq-codegen/rev/16bbcb711380 codegen
# Configure, compile and install
autoreconf -i && ./configure && make && sudo make install

Then run "pecl install amqp", worked in my ubuntu 12 with Php 5.3

Phytophagous answered 14/7, 2012 at 11:4 Comment(1)
This also worked for me on 32bit 12.04 PHP 5.3. However on 13.04 64bit PHP 5.4 the PECL extension compiles but loading it in apache gives the following error: "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/amqp.so' - /usr/lib/php5/20100525/amqp.so: undefined symbol: amqp_open_socket in Unknown on line 0." Have you managed to get this to work? Any ideas?Oratorio
I
3

This is what I did to install it successfully on debian wheezy: I had to use version 0.5.2 of rabbitmq-c

git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git checkout tags/v0.5.2
git submodule init
git submodule update
autoreconf -i && ./configure && make && make install
pecl install amqp
Inference answered 26/5, 2015 at 14:12 Comment(0)
U
2

This is because your rabbitmq is older than the version the php extension requires.

You can install newer version of rabbitmq or lower version of the extension like:

pecl install amqp-1.2.0

But I think using latest versions is better choice.

Unshaped answered 28/4, 2014 at 17:58 Comment(1)
nice tip! It's Werd but only 1.6.beta version worked for me ubuntu 14/PHP 5.6Kenya
P
2

Installing rabbitmq's AMQP with pecl with PHP7.0

Just follow few these steps, this will install all its dependencies and amqp library. It works for me with bento/ubuntu-16.04 with php7.0

apt-get update

wget http://in.archive.ubuntu.com/ubuntu/ubuntu/pool/universe/libr/librabbitmq/librabbitmq1_0.5.2-2_amd64.deb
dpkg -i librabbitmq1_0.5.2-2_amd64.deb

wget http://in.archive.ubuntu.com/ubuntu/ubuntu/pool/universe/libr/librabbitmq/librabbitmq-dev_0.5.2-2_amd64.deb
dpkg -i librabbitmq-dev_0.5.2-2_amd64.deb

apt-get install php7.0 php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-xml php7.0-dev

pecl install amqp

echo "extension=amqp.so" >> /etc/php/7.0/cli/php.ini
echo "extension=amqp.so" >> /etc/php/7.0/fpm/php.ini

Librabbitmq-dev and its dependencies of different versions it can be downloaded from

http://in.archive.ubuntu.com/ubuntu/ubuntu/pool/universe/libr/librabbitmq/

Pallas answered 30/7, 2017 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.