Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 212679 - dev-lang/php-5.2.6_rc1: build fails with USE=ldap-sasl and LDFLAGS=--as-needed
Summary: dev-lang/php-5.2.6_rc1: build fails with USE=ldap-sasl and LDFLAGS=--as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2008-03-08 08:17 UTC by Peter Volkov (RETIRED)
Modified: 2008-06-26 00:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,3.37 KB, text/plain)
2008-03-08 08:17 UTC, Peter Volkov (RETIRED)
Details
config.log (config.log,326.41 KB, text/plain)
2008-03-08 08:19 UTC, Peter Volkov (RETIRED)
Details
php-5.2.6-ldap-sasl--as-needed.patch (php-5.2.6-ldap-sasl--as-needed.patch,435 bytes, patch)
2008-05-05 19:54 UTC, Peter Volkov (RETIRED)
Details | Diff
my --as-needed patch (php-5.2.6-as-needed.patch,5.92 KB, patch)
2008-05-05 22:03 UTC, Rafał Mużyło
Details | Diff
corrected patch (php-5.2.6-as-needed.patch,3.57 KB, patch)
2008-05-19 11:31 UTC, Rafał Mużyło
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Volkov (RETIRED) gentoo-dev 2008-03-08 08:17:07 UTC
The following build:

USE="-readline -gdbm apache2 bcmath bzip2 exif gd ldap pic posix soap snmp xml cgi zip truetype mysql calendar cdb cjk concurrentmodphp ctype curl curlwrappers -db2 dbase discard-path doc fastbuild filter flatfile force-cgi-redirect ftp gmp hash imap inifile -interbase iodbc json kerberos ldap-sasl libedit mcve mhash -msql mssql mysqli odbc pcntl pdo postgres qdbm -recode -sapdb sharedext -sharedmem simplexml sockets spell sqlite suhosin sysvipc threads tidy tokenizer wddx xmlreader xmlrpc xmlwriter xpm xsl yaz" emerge -va php

fails with:

checking for sasl_version in -lldap... no
configure: error: LDAP SASL check failed. Please check config.log for more information.

It succeeds if I disable LDFLAGS=--as-needed

Just for record:
[ebuild   R   ] net-nds/openldap-2.3.39-r2  USE="berkdb crypt gdbm ipv6 perl ssl tcpd -debug -kerberos -minimal -odbc -overlays -samba -sasl (-selinux) -slp -smbkrb5passwd" 0 kB
[ebuild   R   ] dev-libs/cyrus-sasl-2.1.22-r2  USE="berkdb crypt gdbm pam ssl -authdaemond -java -kerberos -ldap -mysql -ntlm_unsupported_patch -postgres -sample -srp -urandom" 0 kB

I've tried to rebuild openldap with sasl but that didn't helped. Same error, same reason in config.log:

configure:67667: x86_64-pc-linux-gnu-gcc -o conftest -I/usr/include -O2 -pipe -march=athlon64 -mtune=athlon64 -msse3 -fomit-frame-pointer -pthread  -D_REENTRANT -I/usr/include -L/usr/lib64 -Wl,--as-needed -Wl,--version-script=/usr/portage/dev-lang/php/files/php5-ldvs -lldap -llber -lsasl2 conftest.c -lldap  -lt1 -lfreetype -lX11 -lXpm -lpng -lz -ljpeg -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -ldl -lxml2 -lz -lm -lldap -llber  >&5                                              /var/tmp/portage/dev-lang/php-5.2.6_rc1-r1/temp/ccWGjULo.o: In function `main':                            conftest.c:(.text+0x7): undefined reference to `sasl_version'                                              collect2: ld returned 1 exit status   

BTW, if I change the order of libs (put -lsasl2 to the end) conftest.c compiles without any problems.
Comment 1 Peter Volkov (RETIRED) gentoo-dev 2008-03-08 08:17:53 UTC
Created attachment 145528 [details]
emerge --info
Comment 2 Peter Volkov (RETIRED) gentoo-dev 2008-03-08 08:19:59 UTC
Created attachment 145530 [details]
config.log
Comment 3 Christian Hoffmann (RETIRED) gentoo-dev 2008-05-01 15:03:49 UTC
I guess that's still reproducible with 5.2.6 (final; I just committed it)?
Was this a regression, i.e. did it work before 5.2.6_rc1?
Comment 4 Peter Volkov (RETIRED) gentoo-dev 2008-05-05 19:12:18 UTC
(In reply to comment #3)
> I guess that's still reproducible with 5.2.6 (final; I just committed it)?

Yes, it is.

> Was this a regression, i.e. did it work before 5.2.6_rc1?

Actually never tried...

Comment 5 Peter Volkov (RETIRED) gentoo-dev 2008-05-05 19:54:25 UTC
Created attachment 151975 [details, diff]
php-5.2.6-ldap-sasl--as-needed.patch

Well, I've found the problem. The checks inside ext/ldap/config.m4 does not update LIBS variable with -lsasl (or whatever necessary) before ldap sasl checks, that's why PHP_CHECK_LIBRARY(ldap, sasl_version... check fails. Attached patch fixes the issue.
Comment 6 Christian Hoffmann (RETIRED) gentoo-dev 2008-05-05 20:07:43 UTC
Thanks for the analysis and the fix, I'll commit it in -r1 to the tree tomorrow (I'm trusting you on this as I cannot test it -- the patch looks good to me nevertheless).
Comment 7 Christian Hoffmann (RETIRED) gentoo-dev 2008-05-05 21:01:26 UTC
I would have forgotten to do it tomorrow, so I did it now. :p
-r1 in the tree, have fun and thanks for the patch. =)
Comment 8 Rafał Mużyło 2008-05-05 22:00:03 UTC
Well, though this bug is marked as RESOLVED FIXED, so I'm a bit late, I'll still add my 2c.
The whole problem of this bug comes actually from the fact that PHP_CHECK_LIBRARY, which is built around AC_CHECK_LIB, updates LDFLAGS, instead of LIBS.
In my own overlay, I had for quite a while now a fix for the --as-needed issue based on fixing that macro.
Comment 9 Rafał Mużyło 2008-05-05 22:03:09 UTC
Created attachment 152021 [details, diff]
my --as-needed patch

Probably nobody is interested in it by now, but I will drop here the patch I'm applying. Maybe somebody will still care to review it.
Comment 10 Christian Hoffmann (RETIRED) gentoo-dev 2008-05-05 22:05:56 UTC
I *am* still intersted. :)
I'll keep the bug marked as FIXED though, as the reported problem is (hopefully) fixed, just not the best way it seems.
I'll see about asking some guys about the preferred solution tomorrow, we can always replace the current patch by yours in a new revision/version.
Comment 11 Peter Volkov (RETIRED) gentoo-dev 2008-05-06 06:16:00 UTC
I am interested too. :)

Rafał, seems that your patch fixes some other things I have not experienced here too... And I like your patch more as it fixes the problem in the first place. Actually I was about to submit patch here to change LDFLAGS->LIBS inside PHP_CHECK_LIB, but this change, although better, affects to many things and IMO should go upstream. Some questions:

1. In sapi/apache/config.m4 and sapi/apache_hooks/config.m4:

-  APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
+  APXS_LIBS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"

Why don't you leave *_LFLAGS in APXS_LDFLAGS? Seems it's better and should not do any harm as we AC_SUBST(APXS_LDFLAGS) too. 

2. seems that $(EXTRA_LDFLAGS) could be dropped in the following line:

+      link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -Wl,-G -o '$3'/$1.la -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) $(EXTRA_LIBS) && mv -f '$3'/.libs/$1.so '$3'/$1.so'

Isn't it?
Comment 12 Rafał Mużyło 2008-05-06 13:55:29 UTC
Well, the catch is that I wrote this patch so long ago, that I no longer remember the reason for most of the changes. Also, I wrote it when I understood libtool much less the I do now.
This patch is simply something that had `worked for me` since then, when I build php with useflags:
USE="apache2 bcmath berkdb bzip2 calendar cgi cjk cli crypt ctype curl curlwrappers doc exif fastbuild filter flatfile force-cgi-redirect ftp gd-external gdbm gmp hash iconv imap inifile ipv6 json kerberos ldap ldap-sasl mhash mysql mysqli ncurses nls odbc pcntl pcre pdo pic posix postgres readline reflection session sharedext simplexml snmp soap sockets spell spl sqlite ssl suhosin sysvipc threads tidy tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip-external zlib -adabas -birdstep -cdb -concurrentmodphp -db2 -dbase -dbmaker -debug -discard-path -empress -empress-bcs -esoob -fdftk -firebird -frontbase -gd -interbase -iodbc (-java-external) -kolab -libedit -mcve -msql -mssql -oci8 -oci8-instant-client -qdbm -recode -sapdb -sharedmem -solid -sybase -sybase-ct -wddx -xpm -yaz -zip"

On 1 from c11: you're probably right.
On 2: actually it looks like the whole second block for acinclude.m4 in not needed (as I said, this was written long ago)
Comment 13 Rafał Mużyło 2008-05-19 11:31:34 UTC
Created attachment 153653 [details, diff]
corrected patch

Just for reference, patch with unneded section removed.
It seems that the most important part is that change 
to PHP_CHECK_LIBRARY. Is that macro an upstream bug or was that actually needed
in older autotools releases ?