V3.0.1 pecl install fail, Docker container php:7.4-fpm-buster

The spoiler is the error here when attempting to install the PHP lib. Below, I detail my entire process to get here.

/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/libtool: line 1283: src/couchbase/managers/bucket_manager.loT: No such file or directory

mkdir src/couchbase/managers/.libs

mkdir: cannot create directory 'src/couchbase/managers/.libs': No such file or directory

make: *** [Makefile:247: src/couchbase/managers/bucket_manager.lo] Error 1

ERROR: `make' failed

I’m new to Couchbase and new to Docker so either of those could be factors in this failure. I would like to run the Couchbase PHP SDK in a Docker container with PHP 7.4 and FPM but it doesn’t have to be on “buster” necessarily.

Here are all the steps I took to get to this failure.

➜ ~ docker container run -d --name test php:7.4-fpm-buster

f7ecf71fccf141c1784606cfd8b517af9d12d2a5b0aa3f3256d7bd46fa34dadf

➜ ~ docker container exec -it test /bin/bash

root@f7ecf71fccf1:/var/www/html#

After connecting to the container, here are my steps. I’ll extract these to a docker-compose file after I get it working. Also, to fit into the post size limit, I cut some output from the install step.

apt-get update

apt-get install -y wget

wget [https://packages.couchbase.com/clients/c/repos/deb/couchbase.key](%22h)

apt-get install -y lsb-release software-properties-common gnupg2 build-essential zlib1g-dev

apt-key add ./couchbase.key

rm couchbase.key

apt-add-repository 'deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main'

apt-get update

apt-get install -y libcouchbase-dev libcouchbase3-libevent libcouchbase3-tools

cbc version

root@f0e0a49cdf5d:/var/www/html# cbc version

cbc:

Runtime: Version=3.0.0, Changeset=69f9a4eb8414f4bfd3824b863701d89a313401d5

Headers: Version=3.0.0, Changeset=69f9a4eb8414f4bfd3824b863701d89a313401d5

Build Timestamp: 2020-01-17 00:34:19

Default plugin directory: /usr/lib/x86_64-linux-gnu/libcouchbase

IO: Default=libevent, Current=libevent, Accessible=libevent,select

SSL Runtime: OpenSSL 1.1.1d 10 Sep 2019

SSL Headers: OpenSSL 1.1.1d 10 Sep 2019

Snappy: 1.1.1

Tracing: SUPPORTED

System: Linux-4.4.0-135-generic; x86_64

CC: GNU 8.3.0; -fno-strict-aliasing -ggdb3 -pthread

CXX: GNU 8.3.0; -fno-strict-aliasing -ggdb3 -pthread

pecl install [https://packages.couchbase.com/clients/php/couchbase-3.0.1.tgz](%22)

root@f0e0a49cdf5d:/var/www/html# pecl install https://packages.couchbase.com/clients/php/couchbase-3.0.1.tgz

downloading couchbase-3.0.1.tgz ...

Starting to download couchbase-3.0.1.tgz (132,517 bytes)

.....done: 132,517 bytes

79 source files, building

running: phpize

Configuring for:

PHP Api Version: 20190902

Zend Module Api No: 20190902

Zend Extension Api No: 320190902

building in /tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1

running: /tmp/pear/temp/couchbase/configure --with-php-config=/usr/local/bin/php-config

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking for pkg-config... /usr/bin/pkg-config

checking pkg-config is at least version 0.9.0... yes

checking for cc... cc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking target system type... x86_64-pc-linux-gnu

checking for PHP prefix... /usr/local

checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib

checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20190902

checking for PHP installed headers prefix... /usr/local/include/php

checking if debug is enabled... no

checking if zts is enabled... no

checking for gawk... no

checking for nawk... nawk

checking if nawk is broken... no

checking whether to enable Couchbase support... yes, shared

checking wheter to use system FastLZ library... no

checking for libcouchbase in default path and yes... found in /usr

checking for libcouchbase version >= 2.9.5... 0x030000

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking zlib.h usability... yes

checking zlib.h presence... yes

checking for zlib.h... yes

checking for compress in -lz... yes

checking for a sed that does not truncate output... /bin/sed

checking for ld used by cc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognize dependent libraries... pass_all

checking dlfcn.h usability... yes

checking dlfcn.h presence... yes

checking for dlfcn.h... yes

checking the maximum length of command line arguments... 1572864

checking command to parse /usr/bin/nm -B output from cc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if cc supports -fno-rtti -fno-exceptions... no

checking for cc option to produce PIC... -fPIC

checking if cc PIC flag -fPIC works... yes

checking if cc static flag -static works... yes

checking if cc supports -c -o file.o... yes

checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

creating libtool

appending configuration tag "CXX" to libtool

configure: patching config.h.in

configure: creating ./config.status

config.status: creating config.h

running: make

/bin/bash /tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/include -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/couchbase.c -o couchbase.lo

mkdir .libs

 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/include -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/couchbase.c -fPIC -DPIC -o .libs/couchbase.o

(cut output here)

/bin/bash /tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/include -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/src/couchbase/lookup_spec.c -o src/couchbase/lookup_spec.lo

 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/include -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/src/couchbase/lookup_spec.c -fPIC -DPIC -o src/couchbase/.libs/lookup_spec.o

/bin/bash /tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/include -I/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/src/couchbase/managers/bucket_manager.c -o src/couchbase/managers/bucket_manager.lo

/tmp/pear/temp/pear-build-defaultuserWvzsLA/couchbase-3.0.1/libtool: line 1283: src/couchbase/managers/bucket_manager.loT: No such file or directory

mkdir src/couchbase/managers/.libs

mkdir: cannot create directory 'src/couchbase/managers/.libs': No such file or directory

make: *** [Makefile:247: src/couchbase/managers/bucket_manager.lo] Error 1

ERROR: `make' failed
1 Like

Same issue here! Please!

Could you try 3.0.2 release?

pecl install https://packages.couchbase.com/clients/php/couchbase-3.0.2.tgz

Among other issues, this build problem has been resolved too.

Same issues on 3.0.2 :frowning:

Oh, this is really strange. Seems like some debian-specific issue.

apt update
apt install -y gnupg2
echo "deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main" > /etc/apt/sources.list.d/libcouchbase.list
curl https://packages.couchbase.com/clients/c/repos/rpm/couchbase.key | apt-key add -
apt update
apt install -y libcouchbase-dev

And then manually install from the same file

cd /tmp
curl -O https://packages.couchbase.com/clients/php/couchbase-3.0.2.tgz
tar xf couchbase-3.0.2.tgz
cd couchbase-3.0.2
phpize
./configure --with-couchbase
make
make install

to verify that it actually install, you can check modules list:

# php -dextension=couchbase -m
[PHP Modules]
Core
couchbase
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

I’m looking into why it does not work with pecl (and cannot create that directory automatically)

Interesting, other projects also seem to have similar issue on debian: https://github.com/websupport-sk/pecl-memcache/issues/60

I will add similar fix, meanwhile, could you do manual install?

This is for an automated dev environment so manual install is a no go - it would defeat the purpose. I’m happy to use any php 7.4 fpm base image though if that helps - I’m not locked into Debian.

The issue has been fixed on master:

to verify, you can try snapshot build from our CI

pecl install http://sdk.jenkins.couchbase.com/view/PHP/job/php/job/php-win-scripted-build-pipeline/lastSuccessfulBuild/artifact/couchbase-3.0.2.tgz

the fix will be included in the upcoming maintenance release 3.0.3.

Thank you for patience and help.

This was successful. Thank You! I’ll watch for the release.

Here’s a sample Dockerfile. There are some extensions installed with this file that may not be necessary for you.

Also, you’ll need to manually edit the php.ini file to include the couchbase extension there. For me, I do this with a custom configuration file copied in with docker-compose.

FROM php:7.4-fpm-buster

# php extension installer for the common ones
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
    install-php-extensions gd imagick imap mailparse mysqli opcache xdebug zip

# Get the Couchbase Repository Key
ADD https://packages.couchbase.com/clients/c/repos/deb/couchbase.key .

RUN apt-get update \
    && apt-get install -y lsb-release software-properties-common gnupg2 build-essential zlib1g-dev \
    && apt-key add ./couchbase.key \
    && rm ./couchbase.key \
    && apt-add-repository 'deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main' \
    && apt-get update \
    && apt-get install -y libcouchbase-dev libcouchbase3-libevent libcouchbase3-tools

# Install ext-couchbase
# After the fix is released in 3.0.3
#RUN pecl install https://packages.couchbase.com/clients/php/couchbase-3.0.3.tgz
# Until that fix
RUN pecl install http://sdk.jenkins.couchbase.com/view/PHP/job/php/job/php-win-scripted-build-pipeline/lastSuccessfulBuild/artifact/couchbase-3.0.2.tgz

WORKDIR /var/www/html

# Copy configuration files
COPY ./config/php.ini /usr/local/etc/php/php.ini