php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16286 undefined symbol: SQLParamData
Submitted: 2002-03-26 08:19 UTC Modified: 2002-05-21 23:31 UTC
From: gory at alphasoft-bg dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.1.2 OS: Slackware 7.1
Private report: No CVE-ID: None
 [2002-03-26 08:19 UTC] gory at alphasoft-bg dot com
I'm trying to compile php with custom odbc support (Sybase SQL Anywhere 8) and i get this :(((

Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: SQLParamData
------------------
CUSTOM_ODBC_LIBS="-l/usr/local/sybase/SYBSsa8/lib/libodbc.so -l/usr/local/sybase/SYBSsa8/lib/libodbcinst.so"
#CUSTOM_ODBC_LIBS="-llibodbc.so -llibodbcinst.so"  - tried also


export CUSTOM_ODBC_LIBS

CPPFLAGS="-DODBC_QNX -DSQLANY_BUG"
#CPPFLAGS="-DODBC_UNIX -DSQLANY_BUG" - tried also
#CPPFLAGS="-DODBC_UNIX" - tried also
#CPPFLAGS="-DODBC_QNX" - tried also

export CPPFLAGS
------------------
make clean
rm config.cache
./configure \
	--with-apxs=/usr/local/apache/bin/apxs  \
	--with-mysql=/usr/local/mysql \
        --with-iodbc=/usr/local \
	--with-custom-odbc=/usr/local/sybase/SYBSsa8 \
	--with-zlib \
	--with-gd=/usr/local \
		--with-png-dir=/usr/local/lib \
		--with-freetype-dir=/usr/local/lib \
		--with-jpeg-dir=/usr/local
make 
make install
------------------
ldd /usr/local/apache/libexec/libphp4.so
        libdl.so.2 => /lib/libdl.so.2 (0x40186000)
        libz.so.1 => /usr/local/lib/libz.so.1 (0x40189000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40197000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x401c4000)
        libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x401d2000)
        libpng.so.3 => /usr/local/lib/libpng.so.3 (0x4020b000)
        libjpeg.so.62 => /usr/local/lib/libjpeg.so.62 (0x4024a000)
        libm.so.6 => /lib/libm.so.6 (0x40269000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40285000)
        libc.so.6 => /lib/libc.so.6 (0x4029a000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
------------------
I'm not sure is this a bug or lack of documetation induce me to wrong way.

--with-custom-odbc[=DIR]
Include a user defined ODBC support. The DIR is ODBC install base directory, which defaults to /usr/local. Make sure to define CUSTOM_ODBC_LIBS and have some odbc.h in your include dirs. E.g., you should define following for Sybase SQL Anywhere 5.5.00 on QNX, prior to run configure script: CPPFLAGS="-DODBC_QNX -DSQLANY_BUG" LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc". 




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-26 15:24 UTC] sniper@php.net
reclassified
 [2002-03-27 10:24 UTC] gory at alphasoft-bg dot com
also try with
CUSTOM_ODBC_LIBS="-llibdblib8.so -llibdbodbc8.so"
but same thing
 [2002-03-28 10:52 UTC] otmar dot suessbauer at t-online dot de
I had the same problem with PHP 4.1.2, SuSE 7.3 
   and SQLAnywhere 8 and Apache 1.3.24

What I did:
ASANY=/opt/sybase/SYBSsa8
 

1) /etc/ld.so.config 
   append new line with /opt/sybase/SYBSsa8/lib
   run ldconfig

2) ln -s $ASANY/lib/libdblib8.so.1 /usr/lib/libdblib.so.1
   ln -s $ASANY/lib/dbodbc8.so.1 /usr/lib/libdbodbc.so.1
   ln -s $ASANY/lib/dbodbc8.so.1 /usr/lib/libdbodbcinst.so.1
   (actually I did some more links e.g. libdbtasks8 etc.,
    so I'm not sure what's all needed. With SQLAnywhere 5.5
    these links had to be done)

3) Set environment, load asa_config.sh !!!
   export CFLAGS or CPPFLAGS="-DODBC_UNIX"
   export CUSTOM_ODBC_LIBS="-ldblib -lodbc"

4) First test sybase sample odbc.c in $ASANY/samples/asa/c
   worked fine with running asademo.db
   ldd of odbc sample showed:

   libdblib8.so.1 => /opt/sybase/SYBSsa8/lib/libdblib8.so.1 (0x40016000)
   libdbtools8.so.1 => /opt/sybase/SYBSsa8/lib/libdbtools8.so.1 (0x400ac000)
   dbodbc8.so.1 => /opt/sybase/SYBSsa8/lib/dbodbc8.so.1 (0x40209000)
   libc.so.6 => /lib/libc.so.6 (0x402cf000)
   libdbtasks8.so.1 => /opt/sybase/SYBSsa8/lib/libdbtasks8.so.1 (0x403f5000)
   libdl.so.2 => /lib/libdl.so.2 (0x40400000)
   libm.so.6 => /lib/libm.so.6 (0x40405000)
   /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)


5) Simple PHP configuration:
   ./configure --with-apxs=/usr/local/apache/bin/apxs \
      --with-custom-odbc=/opt/sybase/SYBSsa8 \

   In last step of make while linking I missed -ldblib and -lodbc
   and had a look in ext/odbc/config.m4, rules seemed ok for 
   CUSTOM_ODBC_LIBS. But definitely this libs missed at the end.
   ldd of libphp4.so didn't show any odbc libs and
   apachectl start crashed with error SQLParamData.

   As I had no idea how to get config.m4 work
   I simply cut and paste the last step of make and appended both libs,
   because I hoped, ext/odbc/php_odbc.lo was compiled correctly:

/bin/sh /work/php-4.1.2/libtool --silent --mode=link gcc  -I. -I/work/php-4.1.2/ -I/work/php-4.1.2/main -I/work/php-4.1.2 -I/usr/local/apache/include -I/work/php-4.1.2/Zend -I/work/php-4.1.2/ext/mysql/libmysql -I/opt/sybase/SYBSsa8/include -I/work/php-4.1.2/ext/xml/expat  -DODBC_UNIX -DLINUX=22 -DUSE_HSREGEX -I/work/php-4.1.2/TSRM -DODBC_UNIX -prefer-pic   -o libphp4.la -rpath /work/php-4.1.2/libs -avoid-version   stub.lo  Zend/libZend.la sapi/apache/libsapi.la main/libmain.la regex/libregex.la ext/mysql/libmysql.la ext/odbc/libodbc.la ext/pcre/libpcre.la ext/posix/libposix.la ext/session/libsession.la ext/standard/libstandard.la ext/xml/libxml.la TSRM/libtsrm.la -lpam -ldl -lcrypt -lresolv -lm -ldl -lnsl -lresolv -lcrypt -lodbc -ldblib

   After that ldd of libphp4.so looked like this:
        libdl.so.2 => /lib/libdl.so.2 (0x4018a000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4018e000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x401bb000)
        libpam.so.0 => /lib/libpam.so.0 (0x401cd000)
        libm.so.6 => /lib/libm.so.6 (0x401d7000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x401f9000)
        dbodbc8.so.1 => /opt/sybase/SYBSsa8/lib/dbodbc8.so.1 (0x4020f000)
        libdblib8.so.1 => /opt/sybase/SYBSsa8/lib/libdblib8.so.1 (0x402c4000)
        libc.so.6 => /lib/libc.so.6 (0x4035a000)
        libdbtasks8.so.1 => /opt/sybase/SYBSsa8/lib/libdbtasks8.so.1 (0x40480000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
  
   and apache started without errors.
   Remember LD_LIBRARY_PATH (asa_config.sh) has to be set before starting apache, otherwise
   it's producing seg faults...

   a little test finally worked:

   <html><head><title>Example 1</title></head><body>
   <?
   $con = odbc_connect("asademo","dba","sql");
   if ( $con == 0 ) { echo "Error! No ODBC-Connection"; }
   else {
      $result = odbc_exec($con, "sa_conn_info" );
      $count = odbc_result_all($result);
      odbc_close($con);
   }
   ?>
   </body></html>

   ~/.odbc.ini looks like:
   [asademo]
   ENG=asademo
   UID=dba
   PWD=sql

   and the Anywhere Server was started like:
   dbsrv8 asademo.db -ud -n asademo


So at the end it seems to me that making the correct rules in ext/odbc doesn't work.
Hope this helps

Kind regards
Otmar Suessbauer
 [2002-03-29 03:59 UTC] gory at alphasoft-bg dot com
Re [28 Mar 10:52am] otmar.suessbauer@t-online.de 
   As I had no idea how to get config.m4 work
   I simply cut and paste the last step of make and appended both libs,
   because I hoped, ext/odbc/php_odbc.lo was compile
d correctly:

I solved my problem compiling --with-iodbc only
but while trying diferent combinations i have strange side effects. when i set 
CUSTOM_ODBC_LIBS="-llibdblib8 -llibdbodbc8"
and compile without
 --with-custom-odbc=/usr/local/sybase/SYBSsa8 \

php_info() says ODBC custom not iodbc ???
 [2002-04-07 13:04 UTC] otmar dot suessbauer at t-online dot de
29 Mar 3:59am] gory@alphasoft-bg.com 

sorry, I was on holyday for some days.

>I solved my problem compiling --with-iodbc only

I never used IODBC for SQL Anywhere because it ships with its own ODBC libs. I think it should have the best performance (!?). But maybe IODBC works fine.

Important is: the managed odbc in $ASANY/drivers is only for MOBYLINK and has not to be mixed up with the non managed version in $ASANY/lib for ASA. In asa_config.sh they append $ASANY/drivers/lib to $LD_LIBRARY_PATH. This path could cause problems with -lodbc, because there is a libodbc.so you can't use for ASA !

>but while trying diferent combinations i have strange side
>effects. when i set CUSTOM_ODBC_LIBS="-llibdblib8 -
>llibdbodbc8" and compile without
> --with-custom-odbc=/usr/local/sybase/SYBSsa8 \

I think, you can't mix it up. --with-iodbc and --with-custom-odbc are two completely different driver families and the environment variable CUSTOM_ODBC_LIBS refers to the custom_odbc way. And this recommends 2 libs with standard names (preferable in /usr/lib I suppose), so the custom odbc libs have to be symlinked (I had some experience on another new machine, so I'm quite sure, it works):
ln -s /opt/sybase/SYBSsa8/lib/libdblib8.so.1 \
  /usr/lib/libdblib.so
ln -s /opt/sybase/SYBSsa8/lib/libdblib8.so.1 \
  /usr/lib/libdblib.so.1
ln -s /opt/sybase/SYBSsa8/lib/dbodbc8.so.1 \
  /usr/lib/libodbc.so
ln -s /opt/sybase/SYBSsa8/lib/dbodbc8.so.1 \
  /usr/lib/libodbc.so.1
otherwise -lodbc -ldblib won't work.

Still I had to append "-lodbc -ldblib" to the final make step of php 4.1.2 because it was missing.
 [2002-05-21 23:31 UTC] kalowsky@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

Not really fixed, but can you please try a more recent CVS snapshot?  The build system was drastically changed, and I'm not sure if this was fixed or not.

If it was great, if not, please re-open the bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 21:01:30 2024 UTC