openlink / iODBC

An open-source ODBC driver manager and SDK that facilitates the development of database-independent applications on linux, freebsd, unix and MacOS X platforms.
http://www.iodbc.org/
Other
157 stars 53 forks source link

why 'php' is loading libiodbc.so.2 ? #83

Closed GaneshKandu closed 1 year ago

GaneshKandu commented 1 year ago

Hi,

I am building php with odbc and pdo_odbc

configuration

./configure --prefix=/usr/local/apps/php
...
        --with-iodbc=shared,/usr/local/apps \
        --with-pdo-odbc=shared,unixODBC,/usr/local/apps \
...

build was successful and odbc and pdo_odbc created successful with no issue

but

ldd php, ldd php-fpm and some other binaries show that it need libiodbc.so.2

mt thought is only odbc and pdo_odbc should load libiodbc.so.2 why ldd php, ldd php-fpm and some other binaries of php is loading libiodbc.so.2 even after disabling odbc and pdo_odbc in php's php.ini file

what could be issue ? why this happening in php < 7.4 ?

HughWilliams commented 1 year ago

This is more question for the PHP maintainers as to how there --with-iodbc configure option behaves which building PHP, as it seems to be linking libiodbc.so.2 into the PHP binary.

Why are you actually linking with iodbc for the odbc and unixODBC for the pdo_odbc , as both use different ODBC library names and so best to use one or the other ?

Disabling the odbc and pdo_odbc in php's php.ini file will not affect what is linked into the php, php-fpm applications when built ...

GaneshKandu commented 1 year ago

For this issue i compiled php without odbc and pdo_odbc and building odbc separately with iODBC

cd /setups/php-7.3.33/ext/odbc
/usr/local/apps/php/bin/phpize
./configure --with-php-config=/usr/local/apps/php/bin/php-config --with-iodbc=shared,/usr/local/apps ODBC_TYPE=iODBC 

for make command i am getting this error, do you know where its wrong ?

/bin/sh /setups/php-7.3.33/ext/odbc/libtool --mode=compile cc  -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/setups/php-7.3.33/ext/odbc -DPHP_ATOM_INC -I/setups/php-7.3.33/ext/odbc/include -I/setups/php-7.3.33/ext/odbc/main -I/setups/php-7.3.33/ext/odbc -I/usr/local/apps/php/include/php -I/usr/local/apps/php/include/php/main -I/usr/local/apps/php/include/php/TSRM -I/usr/local/apps/php/include/php/Zend -I/usr/local/apps/php/include/php/ext -I/usr/local/apps/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /setups/php-7.3.33/ext/odbc/php_odbc.c -o php_odbc.lo
mkdir .libs
 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/setups/php-7.3.33/ext/odbc -DPHP_ATOM_INC -I/setups/php-7.3.33/ext/odbc/include -I/setups/php-7.3.33/ext/odbc/main -I/setups/php-7.3.33/ext/odbc -I/usr/local/apps/php/include/php -I/usr/local/apps/php/include/php/main -I/usr/local/apps/php/include/php/TSRM -I/usr/local/apps/php/include/php/Zend -I/usr/local/apps/php/include/php/ext -I/usr/local/apps/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /setups/php-7.3.33/ext/odbc/php_odbc.c  -fPIC -DPIC -o .libs/php_odbc.o
In file included from /setups/php-7.3.33/ext/odbc/php_odbc.c:35:0:
/setups/php-7.3.33/ext/odbc/php_odbc_includes.h:163:21: fatal error: WINDOWS.H: No such file or directory
 #include <WINDOWS.H>
                     ^
compilation terminated.
make: *** [php_odbc.lo] Error 1
[root@localhost odbc]# odbc/php_odbc_includes.h:163:21: fatal error: WINDOWS.H: No such file or directory
TallTed commented 1 year ago

@GaneshKandu — I trust you closed this because you found the cause and thus a solution. Would you please share it, so others who hit the same issue in the future may be helped more quickly?

GaneshKandu commented 1 year ago

@TallTed I am just accepting that php compilation works in that way and will load libiodbc.so

I didn't found any solution for this issue.

compilation terminated.
make: *** [php_odbc.lo] Error 1
[root@localhost odbc]# odbc/php_odbc_includes.h:163:21: fatal error: WINDOWS.H: No such file or directory