php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3615 Compile failure with Openlink
Submitted: 2000-02-24 19:26 UTC Modified: 2000-08-20 01:51 UTC
From: ebs at nersp dot nerdc dot ufl dot edu Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.0 Beta 4 Patch Level 1 OS: AIX 4.2 & RedHat Linux 6.1 (Kern
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ebs at nersp dot nerdc dot ufl dot edu
New email:
PHP Version: OS:

 

 [2000-02-24 19:26 UTC] ebs at nersp dot nerdc dot ufl dot edu
I am having problems compiling php4b4pl1 on AIX 4.2 with the following configure:

./configure --program-suffix="4"       --with-config-file-path=/etc/httpd/conf       --enable-discard-path       --with-zlib       --with-gdbm       --with-ndbm       --with-db2=/usr/local       --with-openlink=/usr/local/openlink --disable-nls --enable-debug --with-regex=system --with-xml

I have no problems with configure but when I do a make I get the following errors:

/bin/sh ./libtool --mode=link gcc -O2 -g -Wall   -o php -export-dynamic  stub.lo libphp4.la
gcc -O2 -g -Wall -o php stub.o -L.libs -lphp4 -L/usr/local/lib -L/usr/local/openlink/odbcsdk/lib -liodbc -ldl -lz -ldl -ldb -lc -lgdbm -lbind -lm -lnsl -liodbc -ldl -lz -ldl -ldb -lc -lgdbm -lbind -lm -lnsl  -L/usr/local/lib -L/usr/local/lib
ld: 0711-317 ERROR: Undefined symbol: .SQL_SUCCEEDED
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status


After spending some time with the code (very well written might I add) I found what seems to be a resolution to my problem.  As you can see the error reported from gcc is that there is an unresolved problem with . So I looked in the ext/odbc tree and found the following in php_odbc.c:


(line 491)
#if !defined (HAVE_ADABAS)
        do {
#endif
                ret = SQLError(henv, conn, stmt, state,
                            &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
            if (func) {
	    php_error(E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
            } else {
                    php_error(E_WARNING, "SQL error: %s, SQL state %s",
                                    errormsg, state);
            }
#if !defined (HAVE_ADABAS)
        } while (SQL_SUCCEEDED(ret));
#endif
}

I also saw that SQL_SUCCEEDED was only defined in php_odbc.h if HAVE_ADABAS or HAVE_IODBC were defined. So I changed the above to:

#if defined (HAVE_ADABAS)
        do {
#endif
                ret = SQLError(henv, conn, stmt, state,
                            &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
            if (func) {
	    php_error(E_WARNING, "SQL error: %s, SQL state %s in %s", errormsg, state, func);
            } else {
                    php_error(E_WARNING, "SQL error: %s, SQL state %s",
                                    errormsg, state);
            }
#if defined (HAVE_ADABAS)
        } while (SQL_SUCCEEDED(ret));
#endif
}

and did a make clean in ext/odbc and then did a make and then a make again at the top level and all is good. php4 seems to work after that. Attached is the diff I made.

*** php_odbc.c	Wed Feb 23 18:09:33 2000
--- php-4.0b4pl1/ext/odbc/php_odbc.c	Sat Feb 19 18:41:17 2000
*************** void ODBC_SQL_ERROR(HENV henv, HDBC conn
*** 488,494 ****
  	RETCODE ret;
  	ODBCLS_FETCH();
  
! #if defined (HAVE_ADABAS) 
  	do {
  #endif
  		ret = SQLError(henv, conn, stmt, state,
--- 488,494 ----
  	RETCODE ret;
  	ODBCLS_FETCH();
  
! #if !defined (HAVE_ADABAS)
  	do {
  #endif
  		ret = SQLError(henv, conn, stmt, state,
*************** void ODBC_SQL_ERROR(HENV henv, HDBC conn
*** 500,506 ****
  		    php_error(E_WARNING, "SQL error: %s, SQL state %s",
  				    errormsg, state);
  	    }
! #if defined (HAVE_ADABAS)
  	} while (SQL_SUCCEEDED(ret));
  #endif
  }
--- 500,506 ----
  		    php_error(E_WARNING, "SQL error: %s, SQL state %s",
  				    errormsg, state);
  	    }
! #if !defined (HAVE_ADABAS)
  	} while (SQL_SUCCEEDED(ret));
  #endif
  }

I am wondering if this was the right thing to do. I had the same problem under both AIX 4.2 and RedHat Linux 6.1 and this was the only way to get PHP to compile with Openlink..

The reason that I ask is because I am having problems making an ODBC connection. PHP4 segfaults all the time but it only happens in AIX but not in Linux even though the odbctest program that came with Openlink works for both architectures.

Here is the stack trace using gdb under AIX :

shell> gdb --directory ~/cvs/php4 
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-ibm-aix4.2.1.0".
(gdb) file php
Reading symbols from php...done.
(gdb) run ~/odbctest.php3
Starting program: /tmp_mnt/u/ebs/ebs/cvs/php4/php ~/odbctest.php3

Program received signal SIGSEGV, Segmentation fault.
0xd06619e4 in pthread_mutex_lock ()
(gdb) bt
#0  0xd06619e4 in pthread_mutex_lock ()
#1  0xd0661978 in pthread_mutex_lock ()
#2  0xd062ad08 in CallODBC ()
#3  0xd06434f8 in SQLAllocEnv ()
#4  0xd0618238 in _iodbcdm_driverload ()
#5  0xd0619284 in SQLDriverConnect ()
#6  0x100b13f0 in odbc_sqlconnect (conn=0x2ff22070, db=0x20046b70 "DSN=testfoo", uid=0x0, pwd=0x10000000 "\001?", cur_opt=537572896, 
    persistent=0) at php_odbc.c:1594
#7  0x100b1cac in odbc_do_connect (ht=537572904, return_value=0x20046ca0, this_ptr=0x0, return_value_used=268435456, persistent=39)
    at php_odbc.c:1828
#8  0x100b12a4 in php_if_odbc_connect (ht=537572904, return_value=0x10000000, this_ptr=0x0, return_value_used=268435456) at php_odbc.c:1564
#9  0x1002eb54 in execute (op_array=0x2004b130) at zend_execute.c:1598
#10 0x1000fdbc in php_execute_script (primary_file=0x2ff22918) at main.c:1130
#11 0x10001024 in main (argc=2, argv=0x2ff229d0) at cgi_main.c:587

and here is the script odbctest.php3:

#!/usr/local/bin/php3
<? 
    putenv("ODBCINI=/usr/local/openlink/bin/odbc.ini");
    putenv("ODBCINST=/usr/local/openlink/bin/odbcinst.ini");
    putenv("LD_LIBRARY_PATH=/usr/local/openlink/odbsdk/lib:/usr/local/openlink/lib");

$dsn="DSN=testfoo";
$usr="user";
$password="pass";
$sql="select * from chem.student";

/* directly execute mode            */
if ($conn_id=odbc_connect("$dsn","$usr","$password")){
    echo "connected to DSN: $dsn<br><br>\n";
    if($result=odbc_do($conn_id, $sql)) {
        echo "executing '$sql'<br><br>";
        $num_rows=odbc_num_rows($result);
        echo "$num_rows rows returned, fetching a row<BR><br>";
        odbc_fetch_row($result,&$row);
        echo "row number : $row<BR><BR>";
        echo "Results:<BR>";
        odbc_result_all($result);
        echo "freeing result<br><br>";
        odbc_free_result($result);
    }else{
        echo "can not execute '$sql'<BR><BR>";
    }
    echo "closing connection $conn_id";
    odbc_close($conn_id);
}else{
    echo "can not connect to DSN: $dsn<br><br>\n";
}

?>

As you can tell this might not be a php4 problem it might be an Openlink problem. It seems like the library calls are what is making it segfault. 

The same thing happens with PHP 3.0.14. Here is how I compiled:

./configure --disable-nls \
                 --program-suffix="3" \
                 --with-config-file-path=/etc/httpd/conf \
                 --enable-discard-path \
                 --with-system-regex \
	   --with-zlib="/usr/local" \
                 --with-gdbm \
                 --with-ndbm \
	   --with-openlink=/usr/local/openlink \
	   --enable-debug

and here is the stack trace:

shell> gdb --directory ~/php-3.0.14
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-ibm-aix4.2.1.0".
(gdb) file php
Reading symbols from php...done.
(gdb) run < ~/odbctest.php3
Starting program: /tmp_mnt/u/ebs/ebs/php-3.0.14/php < ~/odbctest.php3
X-Powered-By: PHP/3.0.14
Content-type: text/html

#!/usr/local/bin/php3

Program received signal SIGSEGV, Segmentation fault.
0xd06619e4 in pthread_mutex_lock ()
(gdb) bt
#0  0xd06619e4 in pthread_mutex_lock ()
#1  0xd0661978 in pthread_mutex_lock ()
#2  0xd062ad08 in CallODBC ()
#3  0xd06434f8 in SQLAllocEnv ()
#4  0xd0677238 in _iodbcdm_driverload ()
#5  0xd0678284 in SQLDriverConnect ()
#6  0x1005c82c in php3i_odbc__do_connect (ht=0x200c4628, return_value=0x20021eb0, list=0x20023050, plist=0x200230b0, persistent=537015104)
    at unified_odbc.c:1775
#7  0x1005c484 in php3_odbc_connect (ht=0x200c4628, return_value=0x10000000, list=0x0, plist=0x10000000) at unified_odbc.c:1625
#8  0x100103bc in phpparse () at control_structures_inline.h:929
#9  0x10002784 in php3_parse (yyin=0x200c4628) at main.c:1538
#10 0x100030fc in main (argc=1, argv=0x2ff229ec) at main.c:1829

Thank You

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-01 23:28 UTC] waldschrott@php.net
Please verify that it?s still happening using the latest version of PHP (release 4.0.1pl2 or CVS).
 [2000-08-20 01:51 UTC] sniper@php.net
No feedback from user.

--Jani
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 20:03:33 2021 UTC