phporacle-databasedevopsoci8instantclient

skipping incompatible libclntsh.so when searching for -lclntsh


Platform/PHP versions:

Ubuntu 22.04

Linux *** 5.15.0-1013-oracle #17-Ubuntu SMP Fri Jun 24 10:14:16 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

PHP 8.1.2 (cli) (built: Jun 13 2022 13:52:54) (NTS)

Followed instruction:

https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/adbbw/index.html https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

Problem:

/usr/bin/ld: skipping incompatible /opt/oracle/instantclient_21_7/libclntsh.so when searching for -lclntsh
/bin/bash /tmp/pear/temp/pear-build-rootJI40hE/oci8-3.2.1/libtool --mode=link cc -shared -I/tmp/pear/temp/pear-build-rootJI40hE/oci8-3.2.1/include -I/tmp/pear/temp/pear-build-rootJI40hE/oci8-3.2.1/main -I/tmp/pear/temp/oci8 -I/usr/include/php/20210902 -I/usr/include/php/20210902/main -I/usr/include/php/20210902/TSRM -I/usr/include/php/20210902/Zend -I/usr/include/php/20210902/ext -I/usr/include/php/20210902/ext/date/lib -I/opt/oracle/instantclient_21_7/sdk/include -DHAVE_CONFIG_H -g -O2 -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-rootJI40hE/oci8-3.2.1/modules oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo oci8_failover.lo -Wl,-rpath,/opt/oracle/instantclient_21_7 -L/opt/oracle/instantclient_21_7 -lclntsh 
libtool: link: cc -shared -fPIC -DPIC .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o .libs/oci8_failover.o -L/opt/oracle/instantclient_21_7 -lclntsh -g -O2 -Wl,-rpath -Wl,/opt/oracle/instantclient_21_7 -Wl,-soname -Wl,oci8.so -o .libs/oci8.so 
/usr/bin/ld: skipping incompatible /opt/oracle/instantclient_21_7/libclntsh.so when searching for -lclntsh 
/usr/bin/ld: cannot find -lclntsh: No such file or directory 
/usr/bin/ld: skipping incompatible /opt/oracle/instantclient_21_7/libclntsh.so when searching for -lclntsh 
collect2: error: ld returned 1 exit status 
make: *** [Makefile:224: oci8.la] Error 1 
ERROR: make' failed```


Solution

  • The actual problem was with the infra architecture. Earlier I downloaded the normal linux files: Instant Client for Linux x86-64 whereas I have to download Instant Client for Linux ARM (aarch64)

    So,

    Removed all files/folder rm -r /opt/oracle

    Removed ld config rm -r /etc/ld.so.conf.d/oracle-instantclient.conf

    Created new oracle folder mkdir /opt/oracle Downloaded basic and SDK library

    sudo wget https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
    sudo wget https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sdk-linux.arm64-19.10.0.0.0dbru.zip
    

    Extraced both files

    sudo unzip instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
    sudo unzip instantclient-sdk-linux.arm64-19.10.0.0.0dbru.zip
    

    Made a soft linking of the version folder to a normal folder

    sudo ln -s instantclient_19_10 instantclient
    

    Result of ll /opt/oracle/

    total 69364
    drwxr-xr-x 3 root root     4096 Jul 23 22:21 ./
    drwxr-xr-x 3 root root     4096 Jul 23 22:17 ../
    lrwxrwxrwx 1 root root       19 Jul 23 22:21 instantclient -> instantclient_19_10/
    -rw-r--r-- 1 root root 70080139 May  3  2021 instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
    -rw-r--r-- 1 root root   933127 May  3  2021 instantclient-sdk-linux.arm64-19.10.0.0.0dbru.zip
    drwxr-xr-x 4 root root     4096 Jul 23 22:25 instantclient_19_10/
    

    Informed the system about the path

    sudo sh -c "echo /opt/oracle/instantclient > \
          /etc/ld.so.conf.d/oracle-instantclient.conf"
    sudo ldconfig
    

    And the final command

    sudo pecl install oci8
    

    Here I won