Dockerfile Cassandra PHP driver build fails "Unable to load libcassandra"

I’m trying to build Datastax C++ and PHP driver for my docker container.

My depencies:

git wget libssl-dev zlib1g-dev libicu-dev g++ make cmake build-essential libkrb5-dev php7.3-dev libuv1-dev libpcre3-dev libgmp-dev uuid-dev

And here is build script

# Install datastax php-driver fox cassandra
RUN git clone https://github.com/datastax/php-driver.git /usr/src/datastax-php-driver && 
    cd /usr/src/datastax-php-driver && 
    git submodule update --init && 
    cd ext && 
    ./install.sh

Build seems to go fine until the end, it gives me error

configure: error: Unable to load libcassandra

What might be causing this? Here is full log of installation:

Cloning into '/usr/src/datastax-php-driver'...
Submodule 'lib/cpp-driver' (https://github.com/datastax/cpp-driver.git) registered for path 'lib/cpp-driver'
Cloning into 'lib/cpp-driver'...
Submodule path 'lib/cpp-driver': checked out '2b3fb19e1ee28ac12ec9dde63a560511018b7195'
+ rm -Rf /tmp/php-driver-installation
+ mkdir /tmp/php-driver-installation
+ pushd /tmp/php-driver-installation
+ mkdir build
/tmp/php-driver-installation /usr/src/datastax-php-driver/ext
++ cd build
++ pwd
+ builddir=/tmp/php-driver-installation/build
+ echo 'Compiling cpp-driver...'
+ mkdir cpp-driver
Compiling cpp-driver...
/tmp/php-driver-installation/cpp-driver /tmp/php-driver-installation /usr/src/datastax-php-driver/ext
+ pushd cpp-driver
+ cmake -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX:PATH=/tmp/php-driver-installation/build -DCASS_BUILD_STATIC=ON -DCASS_BUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCASS_USE_ZLIB=ON -DCMAKE_INSTALL_LIBDI
R:PATH=lib /usr/src/datastax-php-driver/ext/../lib/cpp-driver/
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- libuv version: v1.9.1
-- Found Libuv: /usr/lib/x86_64-linux-gnu/libuv.so (found suitable version "1.9.1", minimum required is "1.0.0")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so (found version "1.1.1d")
-- OpenSSL version: v1.1.1d
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Could NOT find CLANG_FORMAT (missing:  CLANG_FORMAT_EXE)
-- Unable to find clang-format. Not creating format targets.
-- Driver version: 2.15.1
-- Using std::atomic implementation for atomic operations
-- Checking to see if CXX compiler accepts flag -std=c++11
-- Checking to see if CXX compiler accepts flag -std=c++11 - yes
-- Using hash header <functional> and namespace "std"
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for memcpy
-- Looking for memcpy - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long long
-- Check size of long long - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of u_int16_t
-- Check size of u_int16_t - done
-- Check size of __uint16_t
-- Check size of __uint16_t - done
-- Looking for GRND_NONBLOCK
-- Looking for GRND_NONBLOCK - found
-- Looking for timerfd_create
-- Looking for timerfd_create - found
-- Looking for SO_NOSIGPIPE
-- Looking for SO_NOSIGPIPE - not found
-- Looking for sigtimedwait
-- Looking for sigtimedwait - found
-- Performing Test HAVE_BUILTIN_BSWAP32
-- Performing Test HAVE_BUILTIN_BSWAP32 - Success
-- Performing Test HAVE_BUILTIN_BSWAP64
-- Performing Test HAVE_BUILTIN_BSWAP64 - Failed
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/php-driver-installation/cpp-driver
+ make
Scanning dependencies of target minizip_static
[  1%] Building C object src/third_party/minizip/CMakeFiles/minizip_static.dir/ioapi.c.o
[  2%] Building C object src/third_party/minizip/CMakeFiles/minizip_static.dir/unzip.c.o
[  2%] Built target minizip_static
Scanning dependencies of target curl_hostcheck_static
[  3%] Building CXX object src/third_party/curl/CMakeFiles/curl_hostcheck_static.dir/hostcheck.cpp.o
[  3%] Built target curl_hostcheck_static
Scanning dependencies of target hdr_histogram_static
[  4%] Building CXX object src/third_party/hdr_histogram/CMakeFiles/hdr_histogram_static.dir/hdr_histogram.cpp.o
[  4%] Built target hdr_histogram_static
Scanning dependencies of target http-parser_static
[  5%] Building C object src/third_party/http-parser/CMakeFiles/http-parser_static.dir/http_parser.c.o
[  5%] Built target http-parser_static
Scanning dependencies of target cassandra_static
[  5%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_statement.cpp.o
[  6%] Building CXX object src/CMakeFiles/cassandra_static.dir/timer.cpp.o
[  7%] Building CXX object src/CMakeFiles/cassandra_static.dir/user_type_value.cpp.o
[  8%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_tuple.cpp.o
[  9%] Building CXX object src/CMakeFiles/cassandra_static.dir/row.cpp.o
[  9%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_batch_request.cpp.o
[ 10%] Building CXX object src/CMakeFiles/cassandra_static.dir/auth_requests.cpp.o
[ 11%] Building CXX object src/CMakeFiles/cassandra_static.dir/reconnection_policy.cpp.o
[ 12%] Building CXX object src/CMakeFiles/cassandra_static.dir/md5.cpp.o
[ 13%] Building CXX object src/CMakeFiles/cassandra_static.dir/host.cpp.o
[ 13%] Building CXX object src/CMakeFiles/cassandra_static.dir/connection.cpp.o
[ 14%] Building CXX object src/CMakeFiles/cassandra_static.dir/connection_pool_manager.cpp.o
[ 15%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_point.cpp.o
[ 16%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_line_string.cpp.o
[ 17%] Building CXX object src/CMakeFiles/cassandra_static.dir/address.cpp.o
[ 17%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_polygon.cpp.o
[ 18%] Building CXX object src/CMakeFiles/cassandra_static.dir/config.cpp.o
[ 19%] Building CXX object src/CMakeFiles/cassandra_static.dir/control_connection.cpp.o
[ 20%] Building CXX object src/CMakeFiles/cassandra_static.dir/startup_request.cpp.o
[ 21%] Building CXX object src/CMakeFiles/cassandra_static.dir/batch_request.cpp.o
[ 21%] Building CXX object src/CMakeFiles/cassandra_static.dir/data_type.cpp.o
[ 22%] Building CXX object src/CMakeFiles/cassandra_static.dir/delayed_connector.cpp.o
[ 23%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_user_type_value.cpp.o
[ 24%] Building CXX object src/CMakeFiles/cassandra_static.dir/session.cpp.o
[ 25%] Building CXX object src/CMakeFiles/cassandra_static.dir/client_insights.cpp.o
[ 25%] Building CXX object src/CMakeFiles/cassandra_static.dir/cluster.cpp.o
[ 26%] Building CXX object src/CMakeFiles/cassandra_static.dir/decoder.cpp.o
[ 27%] Building CXX object src/CMakeFiles/cassandra_static.dir/statement.cpp.o
[ 28%] Building CXX object src/CMakeFiles/cassandra_static.dir/murmur3.cpp.o
[ 29%] Building CXX object src/CMakeFiles/cassandra_static.dir/auth.cpp.o
[ 30%] Building CXX object src/CMakeFiles/cassandra_static.dir/async.cpp.o
[ 30%] Building CXX object src/CMakeFiles/cassandra_static.dir/map_iterator.cpp.o
[ 31%] Building CXX object src/CMakeFiles/cassandra_static.dir/ssl.cpp.o
[ 32%] Building CXX object src/CMakeFiles/cassandra_static.dir/uuids.cpp.o
[ 33%] Building CXX object src/CMakeFiles/cassandra_static.dir/get_time-unix.cpp.o
[ 34%] Building CXX object src/CMakeFiles/cassandra_static.dir/driver_info.cpp.o
[ 34%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_value.cpp.o
[ 35%] Building CXX object src/CMakeFiles/cassandra_static.dir/socket.cpp.o
[ 36%] Building CXX object src/CMakeFiles/cassandra_static.dir/future.cpp.o
[ 37%] Building CXX object src/CMakeFiles/cassandra_static.dir/wkt.cpp.o
[ 38%] Building CXX object src/CMakeFiles/cassandra_static.dir/encode.cpp.o
[ 38%] Building CXX object src/CMakeFiles/cassandra_static.dir/prepare_request.cpp.o
[ 39%] Building CXX object src/CMakeFiles/cassandra_static.dir/execute_request.cpp.o
[ 40%] Building CXX object src/CMakeFiles/cassandra_static.dir/micro_timer.cpp.o
[ 41%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_date_range.cpp.o
[ 42%] Building CXX object src/CMakeFiles/cassandra_static.dir/whitelist_dc_policy.cpp.o
[ 42%] Building CXX object src/CMakeFiles/cassandra_static.dir/auth_responses.cpp.o
[ 43%] Building CXX object src/CMakeFiles/cassandra_static.dir/token_map_impl.cpp.o
[ 44%] Building CXX object src/CMakeFiles/cassandra_static.dir/latency_aware_policy.cpp.o
[ 45%] Building CXX object src/CMakeFiles/cassandra_static.dir/logger.cpp.o
[ 46%] Building CXX object src/CMakeFiles/cassandra_static.dir/timestamp_generator.cpp.o
[ 46%] Building CXX object src/CMakeFiles/cassandra_static.dir/user_type_field_iterator.cpp.o
[ 47%] Building CXX object src/CMakeFiles/cassandra_static.dir/token_aware_policy.cpp.o
[ 48%] Building CXX object src/CMakeFiles/cassandra_static.dir/protocol.cpp.o
[ 49%] Building CXX object src/CMakeFiles/cassandra_static.dir/http_client.cpp.o
[ 50%] Building CXX object src/CMakeFiles/cassandra_static.dir/allocated.cpp.o
[ 50%] Building CXX object src/CMakeFiles/cassandra_static.dir/prepared.cpp.o
[ 51%] Building CXX object src/CMakeFiles/cassandra_static.dir/request.cpp.o
[ 52%] Building CXX object src/CMakeFiles/cassandra_static.dir/whitelist_policy.cpp.o
[ 53%] Building CXX object src/CMakeFiles/cassandra_static.dir/tracing_data_handler.cpp.o
[ 54%] Building CXX object src/CMakeFiles/cassandra_static.dir/abstract_data.cpp.o
[ 55%] Building CXX object src/CMakeFiles/cassandra_static.dir/connection_pool_manager_initializer.cpp.o
[ 55%] Building CXX object src/CMakeFiles/cassandra_static.dir/result_response.cpp.o
[ 56%] Building CXX object src/CMakeFiles/cassandra_static.dir/list_policy.cpp.o
[ 57%] Building CXX object src/CMakeFiles/cassandra_static.dir/request_handler.cpp.o
[ 58%] Building CXX object src/CMakeFiles/cassandra_static.dir/external.cpp.o
[ 59%] Building CXX object src/CMakeFiles/cassandra_static.dir/connector.cpp.o
[ 59%] Building CXX object src/CMakeFiles/cassandra_static.dir/cluster_connector.cpp.o
[ 60%] Building CXX object src/CMakeFiles/cassandra_static.dir/memory.cpp.o
[ 61%] Building CXX object src/CMakeFiles/cassandra_static.dir/collection_iterator.cpp.o
[ 62%] Building CXX object src/CMakeFiles/cassandra_static.dir/address_factory.cpp.o
[ 63%] Building CXX object src/CMakeFiles/cassandra_static.dir/dc_aware_policy.cpp.o
[ 63%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_collection.cpp.o
[ 64%] Building CXX object src/CMakeFiles/cassandra_static.dir/testing.cpp.o
[ 65%] Building CXX object src/CMakeFiles/cassandra_static.dir/metadata.cpp.o
[ 66%] Building CXX object src/CMakeFiles/cassandra_static.dir/socket_connector.cpp.o
[ 67%] Building CXX object src/CMakeFiles/cassandra_static.dir/data_type_parser.cpp.o
[ 67%] Building CXX object src/CMakeFiles/cassandra_static.dir/event_loop.cpp.o
[ 68%] Building CXX object src/CMakeFiles/cassandra_static.dir/utils.cpp.o
[ 69%] Building CXX object src/CMakeFiles/cassandra_static.dir/retry_policy.cpp.o
[ 70%] Building CXX object src/CMakeFiles/cassandra_static.dir/blacklist_dc_policy.cpp.o
[ 71%] Building CXX object src/CMakeFiles/cassandra_static.dir/string_ref.cpp.o
[ 71%] Building CXX object src/CMakeFiles/cassandra_static.dir/collection.cpp.o
[ 72%] Building CXX object src/CMakeFiles/cassandra_static.dir/cloud_secure_connection_config.cpp.o
[ 73%] Building CXX object src/CMakeFiles/cassandra_static.dir/prepare_host_handler.cpp.o
[ 74%] Building CXX object src/CMakeFiles/cassandra_static.dir/iterator.cpp.o
[ 75%] Building CXX object src/CMakeFiles/cassandra_static.dir/event_response.cpp.o
[ 75%] Building CXX object src/CMakeFiles/cassandra_static.dir/request_processor_initializer.cpp.o
[ 76%] Building CXX object src/CMakeFiles/cassandra_static.dir/schema_agreement_handler.cpp.o
[ 77%] Building CXX object src/CMakeFiles/cassandra_static.dir/request_processor.cpp.o
[ 78%] Building CXX object src/CMakeFiles/cassandra_static.dir/value.cpp.o
[ 79%] Building CXX object src/CMakeFiles/cassandra_static.dir/execution_profile.cpp.o
[ 80%] Building CXX object src/CMakeFiles/cassandra_static.dir/register_request.cpp.o
[ 80%] Building CXX object src/CMakeFiles/cassandra_static.dir/control_connector.cpp.o
[ 81%] Building CXX object src/CMakeFiles/cassandra_static.dir/wait_for_handler.cpp.o
[ 82%] Building CXX object src/CMakeFiles/cassandra_static.dir/error_response.cpp.o
[ 83%] Building CXX object src/CMakeFiles/cassandra_static.dir/session_base.cpp.o
[ 84%] Building CXX object src/CMakeFiles/cassandra_static.dir/token_map.cpp.o
[ 84%] Building CXX object src/CMakeFiles/cassandra_static.dir/tuple.cpp.o
[ 85%] Building CXX object src/CMakeFiles/cassandra_static.dir/result_metadata.cpp.o
[ 86%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_auth.cpp.o
[ 87%] Building CXX object src/CMakeFiles/cassandra_static.dir/connection_pool_connector.cpp.o
[ 88%] Building CXX object src/CMakeFiles/cassandra_static.dir/round_robin_policy.cpp.o
[ 88%] Building CXX object src/CMakeFiles/cassandra_static.dir/supported_response.cpp.o
[ 89%] Building CXX object src/CMakeFiles/cassandra_static.dir/pooled_connection.cpp.o
[ 90%] Building CXX object src/CMakeFiles/cassandra_static.dir/cluster_metadata_resolver.cpp.o
[ 91%] Building CXX object src/CMakeFiles/cassandra_static.dir/cluster_config.cpp.o
[ 92%] Building CXX object src/CMakeFiles/cassandra_static.dir/connection_pool.cpp.o
[ 92%] Building CXX object src/CMakeFiles/cassandra_static.dir/ring_buffer.cpp.o
[ 93%] Building CXX object src/CMakeFiles/cassandra_static.dir/query_request.cpp.o
[ 94%] Building CXX object src/CMakeFiles/cassandra_static.dir/random.cpp.o
[ 95%] Building CXX object src/CMakeFiles/cassandra_static.dir/request_callback.cpp.o
[ 96%] Building CXX object src/CMakeFiles/cassandra_static.dir/response.cpp.o
[ 96%] Building CXX object src/CMakeFiles/cassandra_static.dir/dse_cluster_config.cpp.o
[ 97%] Building CXX object src/CMakeFiles/cassandra_static.dir/blacklist_policy.cpp.o
[ 98%] Building CXX object src/CMakeFiles/cassandra_static.dir/prepare_all_handler.cpp.o
[ 99%] Building CXX object src/CMakeFiles/cassandra_static.dir/ssl/ssl_openssl_impl.cpp.o
[100%] Building CXX object src/CMakeFiles/cassandra_static.dir/ssl/ring_buffer_bio.cpp.o
[100%] Linking CXX static library ../libcassandra_static.a
[100%] Built target cassandra_static
+ make install
[  2%] Built target minizip_static
[  3%] Built target curl_hostcheck_static
[  4%] Built target hdr_histogram_static
[  5%] Built target http-parser_static
[100%] Built target cassandra_static
Install the project...
-- Install configuration: "RELEASE"
-- Installing: /tmp/php-driver-installation/build/include/dse.h
-- Installing: /tmp/php-driver-installation/build/include/cassandra.h
-- Installing: /tmp/php-driver-installation/build/lib/libcassandra_static.a
/tmp/php-driver-installation /usr/src/datastax-php-driver/ext
+ popd
+ rm -Rf cpp-driver
+ rm -f build/lib/libcassandra.dylib build/lib/libcassandra.so
+ mv build/lib/libcassandra_static.a build/lib/libcassandra.a
+ popd
+ echo 'Compiling and installing the extension...'
+ phpize
/usr/src/datastax-php-driver/ext
Compiling and installing the extension...
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
./configure --with-cassandra=/tmp/php-driver-installation/build --with-libdir=lib
+ echo ./configure --with-cassandra=/tmp/php-driver-installation/build --with-libdir=lib
+ LIBS='-lssl -lz -luv -lm -lstdc++'
+ LDFLAGS=-L/tmp/php-driver-installation/build/lib
+ ./configure --with-cassandra=/tmp/php-driver-installation/build --with-libdir=lib
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/php/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20
180731/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20180731
checking for PHP installed headers prefix... /usr/include/php/20180731
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... no
checking for nawk... nawk
checking if nawk is broken... no
checking Enable Cassandra extension... yes, shared
checking for supported PHP version... supported (7.3)
checking libuv install dir... yes, shared
checking GNU MP install dir... yes, shared
checking for __gmp_version in -lgmp... yes
checking for uv_version in -luv... yes
checking for supported DataStax C/C++ driver version... supported (2.15.1)
checking for cass_cluster_new in -lcassandra... no
configure: error: Unable to load libcassandra

Source: StackOverflow

One Reply to “Dockerfile Cassandra PHP driver build fails "Unable to load libcassandra"”

LEAVE A COMMENT