php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13151 /usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage
Submitted: 2001-09-05 10:26 UTC Modified: 2003-01-17 22:08 UTC
Votes:5
Avg. Score:4.2 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:4 (100.0%)
From: matteo dot redaelli at pirelli dot com Assigned:
Status: No Feedback Package: OCI8 related
PHP Version: 4.0.6 OS: HP-11
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: matteo dot redaelli at pirelli dot com
New email:
PHP Version: OS:

 

 [2001-09-05 10:26 UTC] matteo dot redaelli at pirelli dot com
Cannot start apache 1.3.20 & php 4.0.6 with --with-oci8 enabled:

bonnie.root./apps/WEB/sw $ /www/bin/apachectl start
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libcl.2
/usr/lib/dld.sl: Exec format error
Syntax error on line 205 of /apps/WEB/apache/conf/httpd.conf:
Cannot load /apps/WEB/apache/libexec/libphp4.sl into server: Exec format error


my configure options are:

CC=/opt/gcc/bin/gcc ./configure --prefix=/apps/WEB/php --with-iconv=/opt/libicon
v --with-apxs=/apps/WEB/apache/bin/apxs --with-gd=shared --with-gd=/opt/gd --wit
h-zlib-dir=/opt/zlib --with-ttf=/opt/freetype --without-mysql --with-xpm-dir=/op
t/xpm --with-png-dir=/opt/libpng  --with-gettext=/opt/gettext  --with-jpeg-dir=/
opt/jpeg-6 --enable-gd-native-ttf  --with-oci8=/oracle/PIRELLI/app/oracle/produc
t/8.0.5 --enable-sigchild

-------------------------


without oci8, GD libs are compiled successfully....


Matteo

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-12 06:05 UTC] cn at pinck dot ch
I have the same Message when compiling
PHP 4.1.2 on HPUX 11.00 with 

./configure --enable-libgcc
   --with-apxs=/opt/apache/bin/apxs       --with-oci8=/ora_ovo/software/OraHome1
   --enable-track-vars

The funny thing is that if I compile ADDITIONALLY with mysql support  

(--with-mysql=/opt/mysql)

libphp4.so is about 2MByte SMALLER than without and fails to load as well.

Compiling and starting Apache with MYSQL Support only works fine!
 [2002-09-19 05:35 UTC] fred at fred dot net dot nz
had this problem on HP-UX 11.0. try compiling with '-lcl' option, or running apache with 'export LD_PRELOAD="/usr/lib/libpthread.sl:/
usr/contrib/oracle/lib/libjava.sl" ' in apachectl script.

Share and Enjoy! Fred
 [2003-01-02 18:27 UTC] nicos@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2003-01-17 22:08 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2006-01-13 14:25 UTC] flconseil at yahoo dot fr
I don't know if it can be considered as a bug. fred is right when it says that it must be compiled with -lcl. Here is the explanation from the HP ITRC site :

The other restriction is that if a library containing TLS is listed as a
dependancy of library that a program tries to shl_load it will fail to load
unless the library with TLS has been linked against the program. The man page
for shl_load(3) in the warnings section says:

      Use caution when building shared libraries with external library
      dependencies.  Any library that contains Thread Local Storage (TLS)
      should not be used as a dependency.  If a dependent library contains
      TLS, and it is not loaded during program startup (that is, not linked
      against the executable), the dynamic loader fails to perform the
      operation.

The workaround to not being able to shl_load a shared library containing TLS
can be seen in the following example:

#include <stdio.h>
#include <dl.h>
#include <errno.h>

main()
{
        shl_load("/usr/lib/libcl.2", BIND_DEFERRED, NULL);
        printf("errno is %i\n", errno);
}

$ cc testing.c -o testing
$ ./testing
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local
Storage: /usr/lib/libcl.2
/usr/lib/dld.sl: Exec format error
errno is 8
$ cc testing.c -o testing -lcl
$ ./testing
errno is 0

The program does not produce an error when libcl.sl (-lcl) has been linked
directly against the program. This method does not require any changes to
the code only to the compilation flags (or makefile) as shl_load will ignore
any request to load a library that is already loaded.
<end of explanation>

The problem shows off because the Oracle client library (libclntsh) has a reference to libcl.sl, which uses thread local storage. The best workaround is to compile the apache httpd binary and the PHP CLI executable with -lcl. The easiest way to do that is to set LDFLAGS='-lcl' before configuring apache and php.

Another workaround, if you cannot relink your executables files, is to set an environment variable LD_PRELOAD=/usr/lib/libcl.sl before starting apache or PHP/CLI. It is less clean and should be reserved to the case where you cannot rebuild your packages.

I am currently writing a step by step tutorial describing how to compile Apache, PHP, and many extensions on HP-UX, in order to create an alternative to the HP HPWS package. When it is ready, I post a comment on the PHP doc site in the 'HP-UX specific installation notes' section.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 03:01:32 2024 UTC