Skip to content

Unable to load dynamic library cassandra.so: __gmpz_cmp_ui: symbol not found #117

@dercoder

Description

@dercoder

Hi,

tried to follow the README instractions to install the php extension in my Docker container.
After changing some OS and package version's.
I was able to build and to install it, but the library could not be loaded and the tests are failing:

# make test
/bin/sh /tmp/scylladb-php-driver/libtool --tag=CC --mode=install cp ./cassandra.la /tmp/scylladb-php-driver/modules
cp ./.libs/cassandra.so /tmp/scylladb-php-driver/modules/cassandra.so
cp ./.libs/cassandra.lai /tmp/scylladb-php-driver/modules/cassandra.la
PATH="$PATH:/sbin" ldconfig -n /tmp/scylladb-php-driver/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/scylladb-php-driver/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/cmake -G "Unix Makefiles" -B out/ \
                -DCUSTOM_PHP_CONFIG=php-config \
                -DCMAKE_BUILD_TYPE=Release \
                -DCPU_TYPE=x86-64-v2 \
                -DENABLE_LTO=OFF \
                -DENABLE_AVX=OFF \
                -DENABLE_AVX2=OFF \
                -DENABLE_SANITIZERS=OFF \
                -DLINK_LIBUV_STATIC=OFF \
                -DPHP_DRIVER_STATIC=OFF \
                -DUSE_LIBCASSANDRA=OFF \
                -DCMAKE_INSTALL_PREFIX=./out/install \
                -DPHP_SCYLLADB_DRIVER_VERSION=master
-- Using custom php config: php-config
-- Configuring done (0.1s)
-- Generating done (0.3s)
-- Build files have been written to: /tmp/scylladb-php-driver/out
cmake --build out/
gmake[1]: Entering directory '/tmp/scylladb-php-driver/out'
[  2%] Built target zend_strings
[  8%] Built target type
[ 11%] Built target ssl_options
[ 14%] Built target timestamp_generator
[ 34%] Built target exceptions
[ 39%] Built target retry_policy
[ 45%] Built target numbers
[ 50%] Built target datetime
[ 64%] Built target database
[ 84%] Built target src
[ 88%] Built target cluster_builder
[ 96%] Built target util
[ 98%] Built target zend
[100%] Built target ext_scylladb
gmake[1]: Leaving directory '/tmp/scylladb-php-driver/out'
if [ -f ./out/cassandra.dylib ] ; then \
        cp ./out/cassandra.dylib ./modules/cassandra.so ; fi
if [ -f ./out/cassandra.so ] ; then \
        cp ./out/cassandra.so ./modules/cassandra.so ; fi

Build complete.


=====================================================================
PHP         : /usr/local/bin/php 
Warning: PHP Startup: Unable to load dynamic library 'cassandra.so' (tried: /tmp/scylladb-php-driver/modules/cassandra.so (Error relocating /tmp/scylladb-php-driver/modules/cassandra.so: __gmpz_cmp_ui: symbol not found), /tmp/scylladb-php-driver/modules/cassandra.so.so (Error loading shared library /tmp/scylladb-php-driver/modules/cassandra.so.so: No such file or directory)) in Unknown on line 0

PHP_SAPI    : cli
PHP_VERSION : 8.2.28
ZEND_VERSION: 4.2.28
PHP_OS      : Linux - Linux 2ad88f745540 6.10.14-linuxkit #1 SMP PREEMPT_DYNAMIC Thu Mar 20 16:36:58 UTC 2025 x86_64
INI actual  : /tmp/scylladb-php-driver/tmp-php.ini
More .INIs  :  
---------------------------------------------------------------------
PHP         : /usr/local/bin/php-cgi 
Warning: PHP Startup: Unable to load dynamic library 'cassandra.so' (tried: /tmp/scylladb-php-driver/modules/cassandra.so (Error relocating /tmp/scylladb-php-driver/modules/cassandra.so: __gmpz_cmp_ui: symbol not found), /tmp/scylladb-php-driver/modules/cassandra.so.so (Error loading shared library /tmp/scylladb-php-driver/modules/cassandra.so.so: No such file or directory)) in Unknown on line 0

PHP_SAPI    : cgi-fcgi
PHP_VERSION : 8.2.28
ZEND_VERSION: 4.2.28
PHP_OS      : Linux - Linux 2ad88f745540 6.10.14-linuxkit #1 SMP PREEMPT_DYNAMIC Thu Mar 20 16:36:58 UTC 2025 x86_64
INI actual  : /tmp/scylladb-php-driver/tmp-php.ini
More .INIs  : 
--------------------------------------------------------------------- 
---------------------------------------------------------------------
PHP         : /usr/local/bin/phpdbg 
Warning: PHP Startup: Unable to load dynamic library 'cassandra.so' (tried: /tmp/scylladb-php-driver/modules/cassandra.so (Error relocating /tmp/scylladb-php-driver/modules/cassandra.so: __gmpz_cmp_ui: symbol not found), /tmp/scylladb-php-driver/modules/cassandra.so.so (Error loading shared library /tmp/scylladb-php-driver/modules/cassandra.so.so: No such file or directory)) in Unknown on line 0

PHP_SAPI    : phpdbg
PHP_VERSION : 8.2.28
ZEND_VERSION: 4.2.28
PHP_OS      : Linux - Linux 2ad88f745540 6.10.14-linuxkit #1 SMP PREEMPT_DYNAMIC Thu Mar 20 16:36:58 UTC 2025 x86_64
INI actual  : /tmp/scylladb-php-driver/tmp-php.ini
More .INIs  : 
---------------------------------------------------------------------
CWD         : /tmp/scylladb-php-driver
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2025-04-12 12:55:17
=====================================================================
No tests were run.

I prepared a Dockerfile to reproduce this issue:
https://gist.github.com/dercoder/bb7b0a5e401b1418471923e19ab5e8d2

Maybe someone can help me to solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions