Unable to install aerospike on Ubuntu 16.04

Trying to install aerospike from the below link:

I tried to use composer and ran the below commands.

composer require aerospike/aerospike-client-php ~7.0
find vendor/aerospike/aerospike-client-php/ -name "*.sh" -exec chmod +x {} \;
cd vendor/aerospike/aerospike-client-php/ && sudo composer run-script post-install-cmd

Output of the 3rd command:

> cd src && ./build.sh
> This Aerospike client requires PHP7
> Downloading Aerospike C Client SDK 
> info: downloading 'https://artifacts.aerospike.com/aerospike-client-c/4.1.8/aerospike-client-c-devel-4.1.8.ubuntu16.04.x86_64.deb' to '/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/../aerospike-client-c/package/aerospike-client-c-devel-4.1.8.ubuntu16.04.x86_64.deb'
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100   385  100   385    0     0   1018      0 --:--:-- --:--:-- --:--:--  1021
> 100 1307k  100 1307k    0     0   322k      0  0:00:04  0:00:04 --:--:--  432k
> info: extracting files from 'aerospike-client-c-devel-4.1.8.ubuntu16.04.x86_64.deb'
> 
> CHECK
>    [✓] /var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/../aerospike-client-c/package/usr/lib/libaerospike.a
>    [✓] /var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/../aerospike-client-c/package/usr/include/aerospike/aerospike.h
> 
> Configuring for:
> PHP Api Version:         20121113
> Zend Module Api No:      20121212
> Zend Extension Api No:   220121212
> cp: cannot stat 'ltmain.sh': No such file or directory
> 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 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 whether cc understands -c and -o together... yes
> 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
> checking for PHP includes... -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
> checking for PHP extension directory... /usr/lib/php5/20121212
> checking for PHP installed headers prefix... /usr/include/php5
> checking if debug is enabled... no
> checking if zts is enabled... no
> checking for re2c... no
> configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
> checking for gawk... gawk
> checking whether to enable aerospike support... yes, shared
> checking how to print strings... printf
> checking for a sed that does not truncate output... (cached) /bin/sed
> checking for fgrep... /bin/grep -F
> checking for ld used by cc... /usr/bin/ld
> checking if the linker (/usr/bin/ld) is GNU ld... yes
> checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
> checking the name lister (/usr/bin/nm -B) interface... BSD nm
> checking whether ln -s works... yes
> checking the maximum length of command line arguments... 1572864
> checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
> checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
> checking for /usr/bin/ld option to reload object files... -r
> checking for objdump... objdump
> checking how to recognize dependent libraries... pass_all
> checking for dlltool... no
> checking how to associate runtime and link libraries... printf %s\n
> checking for ar... ar
> checking for archiver @FILE support... @
> checking for strip... strip
> checking for ranlib... ranlib
> checking for gawk... (cached) gawk
> checking command to parse /usr/bin/nm -B output from cc object... ok
> checking for sysroot... no
> checking for a working dd... /bin/dd
> checking how to truncate binary pipes... /bin/dd bs=4096 count=1
> checking for mt... mt
> checking if mt is a manifest tool... no
> 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 for dlfcn.h... yes
> checking for objdir... .libs
> checking if cc supports -fno-rtti -fno-exceptions... no
> checking for cc option to produce PIC... -fPIC -DPIC
> checking if cc PIC flag -fPIC -DPIC works... yes
> checking if cc static flag -static works... yes
> checking if cc supports -c -o file.o... yes
> checking if cc supports -c -o file.o... (cached) 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
> configure: creating ./config.status
> config.status: creating config.h
> config.status: executing libtool commands
> sed: can't read ./ltmain.sh: No such file or directory
> mv: cannot stat 'libtoolT': No such file or directory
> cp: cannot stat 'libtoolT': No such file or directory
> chmod: cannot access 'libtool': No such file or directory
> ls: cannot access '/usr/local/ssl/lib/libcrypto.a': No such file or directory
> ls: cannot access '/usr/local/ssl/lib/libcrypto.so': No such file or directory
> ls: cannot access '/usr/lib64/libcrypto.a': No such file or directory
> ls: cannot access '/usr/lib64/libcrypto.so': No such file or directory
> find . -name \*.gcno -o -name \*.gcda | xargs rm -f
> find . -name \*.lo -o -name \*.o | xargs rm -f
> find . -name \*.la -o -name \*.a | xargs rm -f 
> find . -name \*.so | xargs rm -f
> find . -name .libs -a -type d|xargs rm -rf
> rm -f libphp.la       modules/* libs/*
> /bin/bash /var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src -DPHP_ATOM_INC -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/include -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/main -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src -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 -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/../aerospike-client-c/include -I/var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/../aerospike-client-c/include/ck  -DHAVE_CONFIG_H  -std=gnu99 -g -D__AEROSPIKE_PHP_CLIENT_LOG_LEVEL__=PHP_EXT_AS_LOG_LEVEL_OFF -Wall   -c /var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/aerospike.c -o aerospike.lo 
> /bin/bash: /var/www/html/trend3/Trendsutra/Lib/vendor/aerospike/aerospike-client-php/src/libtool: No such file or directory
> Makefile:180: recipe for target 'aerospike.lo' failed
> make: *** [aerospike.lo] Error 127
> The build has failed...exiting
> Script cd src && ./build.sh handling the post-install-cmd event returned with error code 3

Output of php -v

PHP 7.1.18-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 11 2018 14:22:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.18-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Please suggest what might have gone wrong here.

It looks like you might be missing some required packages needed to build the extension.

I would try sudo apt-get install build-essential autoconf libssl-dev as they are prerequisites for installation.

If that doesn’t fix the issue, we can troubleshoot more.

Thank you for replying.

I ran the above command and then ran the 3 composer commands, but still getting the same error.

Are you still getting these lines in your error message?:

config.status: executing libtool commands
sed: can't read ./ltmain.sh: No such file or directory
mv: cannot stat 'libtoolT': No such file or directory
cp: cannot stat 'libtoolT': No such file or directory
chmod: cannot access 'libtool': No such file or directory
ls: cannot access '/usr/local/ssl/lib/libcrypto.a': No such file or directory
ls: cannot access '/usr/local/ssl/lib/libcrypto.so': No such file or directory
ls: cannot access '/usr/lib64/libcrypto.a': No such file or directory
ls: cannot access '/usr/lib64/libcrypto.so': No such file or directory

Hello,

I ran the below command:

sudo apt-get install php7.0-dev php-pear

and then did:

cd vendor/aerospike/aerospike-client-php/ && sudo composer run-script post-install-cmd

This time it succeeded, but adding

extension=aerospike.so

in my php.ini gave an error

Unable to load dynamic library '/usr/lib/php/20160303/aerospike.so' - /usr/lib/php/20160303/aerospike.so: cannot open shared object file: No such file or directory in Unknown on line 0

I have 2 php versions installed 5.6 and 7.1. I switched to 7.1 prior to installing aerospike, however it seems the aerospike.so extension was installed in /usr/lib/php5/20121212/aerospike.so.

How do I fix this?

You might be able to just copy the file. To find out where PHP is looking for extensions, you can run:

php -i | grep extension_dir

Also, just remove PHP 5.6 - it’s long past support, so whatever bugs and issues it still has are there to stay.

Got it working.

Since there were multiple php versions installed, had to change the path of phpize in src/build.sh and it worked then.

Thanks