Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

I have been beating myself up for weeks trying to get this to compile, I'm hoping to get some assistance. Could somebody help me troubleshoot and compile this?

https://pastebin.com/DA2wdQug
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

What LDAP library do you have installed (OpenLDAP?) and what version?
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

Hi requinix, I have installed the following Solaris packages:

Code: Select all

$ pkg list | ggrep ldap
library/apr-util-15/apr-ldap                      1.5.4-0.175.3.0.0.30.0     i--
library/openldap                                  2.4.30-0.175.3.20.0.3.0    i--
naming/ldap                                       0.5.11-0.175.3.0.0.30.0    i--
You can find more specific details (and what files are distributed) about these packages are here:
http://pkg.oracle.com/solaris/release/e ... ion=Search

I just recently started working with Solaris (about a year ago) -- I have extensive Linux experience, but this is a different animal.

I can compile PHP fine (without LDAP) But I really need ldap to work.
Thank you for helping me through this!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

Take a look at your ldap.h and see how it compares to the version I have from Ubuntu.
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

Ok, so I removed the 'ldap' package so now the only thing I have is 'openldap'.

There are two different ldap.h - one at /usr/include/ldap.h and one at /usr/include/openldap/ldap.h. Here are the diffs for that, the /usr/include/ldap.h is not even close.

(Your file is on the left)
/usr/include/ldap.h

/usr/include/openldap/ldap.h

I tried changing the configure script to --with-ldap=/usr/include/openldap but it complains that it can't find ldap.h.

Edit: Your file is on the left, not the right.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

So the OpenLDAP one looks better. In fact it seems like PHP doesn't even support the Solaris version (PHP and Solaris don't always work well together as it is...).

Unfortunately PHP's configure script isn't terribly flexible when it comes to stuff like this. The way forward I'm looking at is to put all the OpenLDAP files into one central location, with a /lib for libraries and /include for headers. You could compile OpenLDAP yourself, or create a temporary directory with symlinks to the appropriate locations

Code: Select all

/foo/lib -> /usr/lib/??? (maybe openldap or $arch/openldap or similar)
/foo/include -> /usr/include/openldap
then configure --with-ldap=/foo.

When this is all working you could also create a bug report for supporting building ext/ldap against OpenLDAP on Solaris explaining what you've found.
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

I built BerkeleyDB.5.0 without hitch, and now it's in /usr/local/BerkeleyDB.5.0

Now, trying to build OpenLDAP (again, I tried doing this weeks ago but now I'm determined to get this going), I'm running into a problem (which is probably outside of the scope of this forum) but I can't compile it.

LDFLAGS="-L/usr/local/BerkeleyDB.5.0/lib" CPPFLAGS="-I/usr/local/BerkeleyDB.5.0/include" LD_LIBRARY_PATH="/usr/local/BerkeleyDB.5.0/lib" ../configure


checking db.h usability... yes
checking db.h presence... yes
checking for db.h... yes
checking for Berkeley DB major version... configure: error: Unknown Berkeley DB major version

config.log shows

Code: Select all

configure:27233: result: 7
configure:27265: checking db.h usability
configure:27277: gcc -c -g -O2 -I/usr/local/BerkeleyDB.5.0/include conftest.c >&5
configure:27283: $? = 0
configure:27287: test -z 
			 || test ! -s conftest.err
configure:27290: $? = 0
configure:27293: test -s conftest.o
configure:27296: $? = 0
configure:27306: result: yes
configure:27310: checking db.h presence
configure:27320: gcc -E -I/usr/local/BerkeleyDB.5.0/include conftest.c
configure:27326: $? = 0
configure:27346: result: yes
configure:27381: checking for db.h
configure:27388: result: yes
configure:27404: checking for Berkeley DB major version
configure:27517: error: Unknown Berkeley DB major version
If this is something I need to go to the OpenLDAP mailing list I'll do that, I really need this working and I will create a 'blog' about it somewhere.

PS: It's not that I am a sadomasochist, I have to use Solaris for work purposes.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

I have no idea. You'd have to look at ./configure to see what it's trying to do to test the version number.

You could skip building it and try the symlink approach...
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

That isn't working, I symlinked /lib to ../ and it found ldap.h, but now it says

configure: error: Cannot find ldap libraries in /usr/include/openldap.

And the file it looks like it's looking for "libldap30." doesn't exist. I think compiling OpenLDAP is the way to go so now I'm off down that rabbit hole.

I'll let you know what happens.
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

Ok, after compiling an older version of Berkeley DB (4.6.21), openldap compiled fine, and now PHP compiles with LDAP!

Now it's off to configuring that mess... But hey requinix, I want to thank you for slowing me down in order to take the time to figure it out... Panic and rushing is the worst thing for a programmer, and you just have to slow down and work methodically.

Plus hey, I'm new to the forum so I look forward to helping other people out.
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

I think I spoke too soon, I am now getting some error that doesn't make any sense to me:

...
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... no
checking for 3 arg ldap_set_rebind_proc... yes
checking for ldap_parse_result... no
checking for ldap_parse_reference... no
checking for ldap_start_tls_s... no
checking for ldap_control_find... no
checking for ldap_bind_s... no
configure: error: LDAP build check failed. Please check config.log for more info rmation.
...

Code: Select all

configure:49539: checking for ldap_bind_s
configure:49539: gcc -o conftest -I/usr/include -std=gnu99 -m64 -fvisibility=hidden -I/usr/local/openldap/include -D_POSIX_PTHREAD_SEMANTICS -I/usr/include -L/usr/lib -L/usr/local/openldap/lib -R/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0 -L/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0 conftest.c -lldap -llber -lpng -lz -lcurl -lz -lrt -lm -lnsl -lsocket  -lgcc -lxml2 -lssl -lcrypto -lcurl -lidn -lssh2 -lssh2 -lnsl -lsocket -lssl -lcrypto -lssl -lcrypto -lgss -llber-2.4 -lldap_r-2.4 -lz -lsocket -lnsl -lxml2 -lssl -lcrypto  >&5
ld: fatal: recording name conflict: file '/usr/local/openldap/lib/liblber.so' and file '/usr/lib/amd64/liblber-2.4.so' provide identical dependency names: liblber-2.4.so.2
ld: warning: symbol 'ldap_int_global_options' has differing sizes:
	(file /usr/local/openldap/lib/libldap.so value=0x140; file /usr/lib/amd64/libldap_r-2.4.so value=0x180);
	/usr/local/openldap/lib/libldap.so definition taken
collect2: error: ld returned 1 exit status
What is this?..
ld: fatal: recording name conflict: file '/usr/local/openldap/lib/liblber.so' and file '/usr/lib/amd64/liblber-2.4.so' provide identical dependency names: liblber-2.4.so.2
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

The error basically means that you're linking against two different libraries for the same purpose. When building, it should be trying to link with either OpenLDAP's liblber.so or your existing liblber-2.4.so - not both. Since -llber will be the former, and the one you want, you need to deal with whatever is adding the -llber-2.4. Uninstalling whatever provided /usr/lib/amd64/liblber-2.4.so may take care of it.

You might have the same problem with -lldap and -lldap_r-2.4 - I'm not sure what the libldap_r one is but a quick search suggests there will be conflicts with libldap.
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

Back from a long weekend - Thanks for explaining that. It doesn't look like its going to be easy 'pkg uninstall openldap' because of other dependencies.

What I am going to do is spin up a fresh server and compile the libraries myself - (and I'll have to write the documentation to go with it ugh) -- I will let you know how it goes!
jphustman
Forum Newbie
Posts: 10
Joined: Tue Aug 29, 2017 4:20 pm
Location: Juneau, AK

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by jphustman »

Ok, so I finally did get it to compile, I built 'cURL' from source and it seemed to work, but now when I run the phpldap example script, php errors out with:

/var/apache/log/error_log:

[Tue Sep 05 14:12:37.221792 2017] [core:notice] [pid 25599] AH00052: child pid 25601 exit signal Segmentation fault (11)'

It does this on 'ldap_connect()' - - I feel I'm right there.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Trouble Compiling PHP 7.1.8 w/ LDAP on Solaris

Post by requinix »

You'll have to get a backtrace to (hopefully) locate the source of the problem.
Post Reply