Discussion:
[PHP-INSTALL] why does php compile looks for wrong curl
Christine Ross
2010-11-04 22:31:11 UTC
Permalink
My server is Solaris 10 Sparc and I'm using Suns cc compilers.



I have curl compiled into /usr/local/lib and compiled again native
Solaris 10 openssl. I installed another version into
/usr/local/curl-7.19.5 and compiled against a different openssl. Then I
compiled php using that later curl verion (see below). Today I did an
ldd against php shows it is using /usr/local/lib. I don't believe I
specify the lib directory on the php --with-curl line. Doesn't my
LD_RUN_PATH specify where to find the library files? Both versions are
7.19.5 but I need one compiled against the native libraries.



What is even stranger is that if I run php -i it will show php compiled
against the 2nd curl installation (libcurl/7.19.5 OpenSSL/0.9.8h
zlib/1.2.3) but phpinfo on a web browser shows the curl info from
/usr/local/lib (libcurl/7.19.5 OpenSSL/0.9.7d zlib/1.2.3).



Why isn't php compiling against the correct curl?

Thanks for any help.

# ldd /usr/local/bin/php | grep curl
libcurl.so.4 => /usr/local/lib/libcurl.so.4
#

# more ConfigurePHP
#!/bin/sh

PATH=/opt/SUNWspro/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/sfw/bin
:/usr/dt/bin:/usr/openwin/bin:/usr/sbin; export PATH
LD_RUN_PATH=/usr/local/curl-7.19.5/lib:/usr/sfw/lib:/usr/local/lib;
export LD_RUN_PATH

env CC=cc CXX=CC \
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-pear \
--with-libxml-dir=/usr \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mbstring \
--with-curl=/usr/local/curl-7.19.5 \
--with-gd \
--with-jpeg \
--with-jpeg-dir=/usr/lib

#!/end
#

# php -i | grep curl
Configure Command => './configure'
'--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-mysql=/usr/local/mysql' '--with-pear' '--with-libxml-dir=/usr'
'--with-mysqli=/usr/local/mysql/bin/mysql_config' '--enable-mbstring'
'--with-curl=/usr/local/curl-7.19.5' '--with-gd' '--with-jpeg'
'--with-jpeg-dir=/usr/lib'



Sincerely,
Christine Ross
HCCS - Experts in Healthcare Learning
(516)478-4100, x108
***@hccs.com <mailto:***@hccs.com>

Announcing COI-SMART! - A new solution for tracking & managing
Conflicts of Interest.

HCCS is the leading provider of effective online training courses and
learning management systems to healthcare facilities. HCCS has
provided over 2.5 million hours of compliance and competency training
courseware to hospitals, teaching facilities, medical schools, health
plans and other health care entities. The HCCS Compliance Learning
Library contains expert training content in the areas of Medicare,
Medicaid, HIPAA, Harassment, Research, Patient Safety and Quality
Improvement Compliance. The HCCS Healthcare Learning Platform (HLP) is
a healthcare specific Learning and Competency Management System.
http://www.hccs.com <http://www.hccs.com/> (516) 478-4100 or (877)
933-hccs.

This email message is for the sole use of the intended recipient(s) and
contains confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is strictly prohibited. If you
are not the intended recipient or have received this communication in
error please contact the sender by reply e-mail and destroy all copies
of the original message. Thank you.
Kenneth Svee
2010-11-05 10:25:21 UTC
Permalink
[ Christine Ross ]
My server is Solaris 10 Sparc and I’m using Suns cc compilers.
I have curl compiled into /usr/local/lib and compiled again native
Solaris 10 openssl. I installed another version into
/usr/local/curl-7.19.5 and compiled against a different openssl.
Then I compiled php using that later curl verion (see below). Today
I did an ldd against php shows it is using /usr/local/lib. I don’t
believe I specify the lib directory on the php --with-curl line.
Doesn’t my LD_RUN_PATH specify where to find the library files? Both
versions are 7.19.5 but I need one compiled against the native
libraries.
What is even stranger is that if I run php –i it will show php
compiled against the 2^nd curl installation (libcurl/7.19.5
OpenSSL/0.9.8h zlib/1.2.3) but phpinfo on a web browser shows the
curl info from /usr/local/lib (libcurl/7.19.5 OpenSSL/0.9.7d
zlib/1.2.3).
Do an 'ldd' on the PHP binary using the same (clean) shell environment
you use when starting Apache, making sure you have no LD_* variables
set in your env. Does it still come up with the "libcurl/7.19.5"-path?
Why isn’t php compiling against the correct curl?
Thanks for any help.
# ldd /usr/local/bin/php | grep curl
libcurl.so.4 => /usr/local/lib/libcurl.so.4
#
This tells you which library the binary has linked to, i.e. which
RUN_PATH the binary is built with. You can override this using things
like LD_LIBRARY_PATH in your shell environment, but it doesn't change
the RUN_PATH in the binary.
# more ConfigurePHP
#!/bin/sh
PATH=/opt/SUNWspro/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/sfw/bin:/usr/dt/bin:/usr/openwin/
bin:/usr/sbin; export PATH
LD_RUN_PATH=/usr/local/curl-7.19.5/lib:/usr/sfw/lib:/usr/local/lib; export LD_RUN_PATH
Try adding CFLAGS including your curl to your build, e.g.

CFLAGS='-L/usr/local/curl-7.19.5/lib -R/usr/local/curl-7.19.5/lib'; export CFLAGS

I've used it with success before on both Solaris8 and 10 (sparc,
SunCC) to get a proper RUN_PATH in the binary.

Failing all else, you might try use a nifty little tool called
'chrpath' to brute-force a new RPATH in your binary:

http://linux.die.net/man/1/chrpath

Caveat: I've only used it on linux x86; don't know if it'll work on SPARC.



~ksvee
Christine Ross
2010-11-06 20:04:02 UTC
Permalink
Thank you for the ideas. I was able to get the correct LDD after setting ldflags and ld_library_path.




-----Original Message-----
From: Kenneth Svee [mailto:***@usit.uio.no]
Sent: Fri 11/5/2010 6:25 AM
To: php-***@lists.php.net
Subject: Re: [PHP-INSTALL] why does php compile looks for wrong curl

[ Christine Ross ]
Post by Christine Ross
My server is Solaris 10 Sparc and I'm using Suns cc compilers.
I have curl compiled into /usr/local/lib and compiled again native
Solaris 10 openssl. I installed another version into
/usr/local/curl-7.19.5 and compiled against a different openssl.
Then I compiled php using that later curl verion (see below). Today
I did an ldd against php shows it is using /usr/local/lib. I don't
believe I specify the lib directory on the php --with-curl line.
Doesn't my LD_RUN_PATH specify where to find the library files? Both
versions are 7.19.5 but I need one compiled against the native
libraries.
What is even stranger is that if I run php -i it will show php
compiled against the 2^nd curl installation (libcurl/7.19.5
OpenSSL/0.9.8h zlib/1.2.3) but phpinfo on a web browser shows the
curl info from /usr/local/lib (libcurl/7.19.5 OpenSSL/0.9.7d
zlib/1.2.3).
Do an 'ldd' on the PHP binary using the same (clean) shell environment
you use when starting Apache, making sure you have no LD_* variables
set in your env. Does it still come up with the "libcurl/7.19.5"-path?
Post by Christine Ross
Why isn't php compiling against the correct curl?
Thanks for any help.
# ldd /usr/local/bin/php | grep curl
libcurl.so.4 => /usr/local/lib/libcurl.so.4
#
This tells you which library the binary has linked to, i.e. which
RUN_PATH the binary is built with. You can override this using things
like LD_LIBRARY_PATH in your shell environment, but it doesn't change
the RUN_PATH in the binary.
Post by Christine Ross
# more ConfigurePHP
#!/bin/sh
PATH=/opt/SUNWspro/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/sfw/bin:/usr/dt/bin:/usr/openwin/
bin:/usr/sbin; export PATH
LD_RUN_PATH=/usr/local/curl-7.19.5/lib:/usr/sfw/lib:/usr/local/lib; export LD_RUN_PATH
Try adding CFLAGS including your curl to your build, e.g.

CFLAGS='-L/usr/local/curl-7.19.5/lib -R/usr/local/curl-7.19.5/lib'; export CFLAGS

I've used it with success before on both Solaris8 and 10 (sparc,
SunCC) to get a proper RUN_PATH in the binary.

Failing all else, you might try use a nifty little tool called
'chrpath' to brute-force a new RPATH in your binary:

http://linux.die.net/man/1/chrpath

Caveat: I've only used it on linux x86; don't know if it'll work on SPARC.



~ksvee

Loading...