Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 456928

Summary: dev-lang/php-5.4.8[imap] hardened - ./conftest: symbol lookup error: /usr/lib64/libc-client.so.1: undefined symbol: crypt
Product: Gentoo Linux Reporter: Marcin Mirosław <bug>
Component: Current packagesAssignee: PHP Bugs <php-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: frp.bissey, martin, net-mail+disabled
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=545086
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 372079    
Attachments: config.log

Description Marcin Mirosław 2013-02-12 13:01:13 UTC
I've got system compiled using bfd linker. Now I have switched linker to gold and I'm trying to compile php with imap support. It fails at:
checking for SSL_CTX_set_ssl_version in -lssl... (cached) yes
checking whether rfc822_output_address_list function present... no
checking whether build with IMAP works... no
configure: error: build test failed. Please check the config.log for details.

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/dev-lang/php-5.4.8/work/sapis-build/cli/config.log

configure fails on:
configure:51865: ./conftest
./conftest: symbol lookup error: /usr/lib64/libc-client.so.1: undefined symbol: crypt
configure:51865: $? = 127
configure: program exited with status 127

# emerge --info
Portage 2.1.11.31 (hardened/linux/amd64, gcc-4.6.3, glibc-2.15-r3, 3.7.0-hardened x86_64)
=================================================================
System uname: Linux-3.7.0-hardened-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7700_@_2.40GHz-with-gentoo-2.1
Timestamp of tree: Tue, 12 Feb 2013 05:15:01 +0000
ld GNU gold (GNU Binutils 2.22) 1.11
ccache version 3.1.8 [enabled]
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/ccache:          3.1.8
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.69
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3, 4.7.2
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -frecord-gcc-switches   -fno-unwind-tables -fno-asynchronous-unwind-tables -fpeel-loops         -ftracer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/
php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/ter
minfo"
CXXFLAGS="-O2 -pipe -march=native -frecord-gcc-switches         -fno-unwind-tables -fno-asynchronous-unwind-tables -fpeel-loops         -ftracer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetc
h preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="pl_PL.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="-O --inplace"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://gentoo-mirror.in.cibet.pl/gentoo-portage/"
USE="acl acpi amd64 bash-completion caps cli cracklib crypt cxx dri gpm hardened iconv idn ipv6 justify mmx mmxext modules mudflap multilib ncurses nls nptl openmp pax_kernel pcre readline session sse sse2 sse3 ssse3 threads unicode urandom vhosts vim-syntax xattr" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authz_host dir mime unique_id" APACHE2_MPMS="itk" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NGINX_MODULES_HTTP="access auth_basic browser charset fastcgi gzip gzip_static headers_more limit_conn limit_req proxy realip referer rewrite userid" PHP_TARGETS="php5-3 php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON
Comment 1 Marcin Mirosław 2013-02-12 13:02:15 UTC
Created attachment 338692 [details]
config.log
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2013-04-01 17:19:15 UTC
Cannot reproduce this. Can I have your useflags for php, as well as which c-client you are using?
Comment 3 Marcin Mirosław 2013-04-03 09:43:44 UTC
Sure, useflags for php are:
[ebuild  NS    ] dev-lang/php-5.4.13:5.4 [5.3.18:5.3] USE="apache2 bcmath cli crypt ctype exif fileinfo filter gd iconv imap ipv6 json mysql mysqli nls pdo postgres readline session sockets spell sqlite ssl unicode xml xmlrpc zlib -berkdb -bzip2 -calendar -cdb -cgi -cjk -curl -curlwrappers -debug -doc -embed -enchant -firebird -flatfile -fpm (-frontbase) -ftp -gdbm -gmp -hash -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -mhash -mssql -mysqlnd -oci8-instant-client -odbc -pcntl -phar -posix -qdbm -recode (-selinux) -sharedmem -simplexml -snmp -soap (-sybase-ct) -sysvipc -threads -tidy -tokenizer -truetype -wddx -xmlreader -xmlwriter -xpm -xsl -zip"

net-libs/c-client-2007f-r4 was built with the following:
USE="ipv6 (multilib) ssl -chappa -doc -kerberos -pam -static-libs -topal" ABI_X86="64"
CFLAGS="-march=native -O2 -fexpensive-optimizations -fpeel-loops -fgraphite-identity -floop-interchange -ftree-loop-linear -floop-block -floop-strip-mine -fira-loop-pressure -fpredictive-commoning -freorder-blocks-and-partition -ftracer -ftree-vectorize -frecord-gcc-switches -fno-unwind-tables -fno-asynchronous-unwind-tables -pipe -Wdisabled-optimization -Wstack-protector -fPIC"
CXXFLAGS="-march=native -O2 -fexpensive-optimizations -fpeel-loops -fgraphite-identity -floop-interchange -ftree-loop-linear -floop-block -floop-strip-mine -fira-loop-pressure -fpredictive-commoning -freorder-blocks-and-partition -ftracer -ftree-vectorize -frecord-gcc-switches -fno-unwind-tables -fno-asynchronous-unwind-tables -pipe -Wdisabled-optimization -Wstack-protector -fPIC"

Jus to be sure, did you change linker to gold?
Mine is:
# ld -v
GNU gold (GNU Binutils 2.23.1) 1.11
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2013-04-03 10:27:28 UTC
(In reply to comment #3)
> Sure, useflags for php are:
> [ebuild  NS    ] dev-lang/php-5.4.13:5.4 [5.3.18:5.3] USE="apache2 bcmath
> cli crypt ctype exif fileinfo filter gd iconv imap ipv6 json mysql mysqli
> nls pdo postgres readline session sockets spell sqlite ssl unicode xml
> xmlrpc zlib -berkdb -bzip2 -calendar -cdb -cgi -cjk -curl -curlwrappers
> -debug -doc -embed -enchant -firebird -flatfile -fpm (-frontbase) -ftp -gdbm
> -gmp -hash -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -mhash
> -mssql -mysqlnd -oci8-instant-client -odbc -pcntl -phar -posix -qdbm -recode
> (-selinux) -sharedmem -simplexml -snmp -soap (-sybase-ct) -sysvipc -threads
> -tidy -tokenizer -truetype -wddx -xmlreader -xmlwriter -xpm -xsl -zip"
> 
> net-libs/c-client-2007f-r4 was built with the following:
> USE="ipv6 (multilib) ssl -chappa -doc -kerberos -pam -static-libs -topal"
> ABI_X86="64"
> CFLAGS="-march=native -O2 -fexpensive-optimizations -fpeel-loops
> -fgraphite-identity -floop-interchange -ftree-loop-linear -floop-block
> -floop-strip-mine -fira-loop-pressure -fpredictive-commoning
> -freorder-blocks-and-partition -ftracer -ftree-vectorize
> -frecord-gcc-switches -fno-unwind-tables -fno-asynchronous-unwind-tables
> -pipe -Wdisabled-optimization -Wstack-protector -fPIC"
> CXXFLAGS="-march=native -O2 -fexpensive-optimizations -fpeel-loops
> -fgraphite-identity -floop-interchange -ftree-loop-linear -floop-block
> -floop-strip-mine -fira-loop-pressure -fpredictive-commoning
> -freorder-blocks-and-partition -ftracer -ftree-vectorize
> -frecord-gcc-switches -fno-unwind-tables -fno-asynchronous-unwind-tables
> -pipe -Wdisabled-optimization -Wstack-protector -fPIC"
> 

That exact setup works for me ... And I cannot really spot any specific difference either ...

Can you test with 5.5 too?

> Jus to be sure, did you change linker to gold?
> Mine is:
> # ld -v
> GNU gold (GNU Binutils 2.23.1) 1.11

Sure:

# ld -v
GNU gold (GNU Binutils 2.23.2) 1.11
Comment 5 Marcin Mirosław 2013-04-03 12:09:06 UTC
The same problem with php:5.5 :
configure:51879: checking whether build with IMAP works
configure:51923: x86_64-pc-linux-gnu-gcc -o conftest -I/usr/include -march=native -O2 -fexpensive-optimizations -fpeel-loops -fgraphite-identity -floop-interchange -ftree-loop-linear -floop-block -floop-strip-mine -fira-loop-pressure -fpredictive-commoning -freorder-blocks-and-partition -ftracer -ftree-vectorize -frecord-gcc-switches -fno-unwind-tables -fno-asynchronous-unwind-tables --param l2-cache-size=128 --param l1-cache-size=16 --param l1-cache-line-size=32 -pipe -Wdisabled-optimization -Wstack-protector  -L/usr/lib64 -Wl,-O1 -Wl,--as-needed -Wl,--sort-common conftest.c -lc-client   -lcrypto -lssl -lcrypto -lcrypt -lpam -lpng -lz -ljpeg -lz -lsqlite3 -lpcre -lcrypto -lssl -lcrypto -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl >&5
configure:51923: $? = 0
configure:51923: ./conftest
./conftest: symbol lookup error: /usr/lib64/libc-client.so.1: undefined symbol: crypt
configure:51923: $? = 127
configure: program exited with status 127

Shouldn't be libraries passed in diffrent order? Like that:
 -lcrypto -lssl -lcrypto -lcrypt  -lc-client  -lpam -lpng -lz -ljpeg -lz -lsqlite3 -lpcre -lcrypto -lssl -lcrypto -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl 

I can even reproduce problem with USE="-* cli imap ssl".
As for now I can reproduce problem only on hardened profile. But I'm not sure if this is only one reason that triggers error.
Comment 6 Martin Väth 2013-04-22 13:06:14 UTC
I get the same error when trying to build mail-client/alpine-2.00-r5
(alpine-2.00-r4 worked fine).

It seems that net-libs/c-client is underlinked:
Adding -lcrypt to LDFLAGS when building c-client solves the issue.
Comment 7 François Bissey 2014-03-28 08:47:42 UTC
Got the same problem trying to install alpine. Merging c-client with LDFLAGS="-lcrypt" did solve the problem indeed.
Comment 8 Michael Orlitzky gentoo-dev 2017-02-04 16:19:37 UTC
When building net-libs/c-client, there are a number of different "targets" listed in its Makefile. The one we wind up using is "lnx":

  if use kernel_linux ; then
    use pam && target=lnp passwdtype=pam || target=lnx passwdtype=std

However, "lnx" is...

  lnx:	# Linux non-shadow passwords

and that's clearly not us. In the "lnx" target, "-lcrypt" does not get appended to LDFLAGS. This looks a lot more promising:

  slx:	# Secure Linux
  ...
  BASELDFLAGS="-lcrypt"

I would suggest that net-mail@ change "lnx" to "slx" in the c-client ebuild. That should add "-lcrypt" to LDFLAGS and fix the issue.
Comment 9 Michael Orlitzky gentoo-dev 2017-02-18 16:18:33 UTC
commit 3524b85eb813d017c7fa32843a3949d065ab2d6b
Author: Michael Orlitzky <mjo@gentoo.org>
Date:   Sat Feb 18 10:27:51 2017 -0500

    net-libs/c-client: new revision building the "slx" target with USE="-pam".

    The build system for c-client supports a few different targets. When
    USE=pam was not set, we were using the "lnx" target, which supposes
    that the crypt() function is available directly in libc. That is not
    the case in Gentoo, but things usually worked out when libcrypt was
    linked in transitively (by, say, PHP).

    However, the "gold" linker is more strict than "bfd" with regard to
    transitive dependencies. The gold linker treats them as superfluous
    and mercilessly prunes them; thus c-client could wind up with no
    crypt() function when the gold linker was used: c-client was not
    linking with -lcrypt itself, and even though consumers might be
    linking in c-client with -lcrypt, the crypt library appeared unused
    and would be omitted.

    By switching from the "lnx" target to "slx", we ensure that -lcrypt is
    passed to the linker when it links c-client itself. Thus the crypt()
    function is where it is expected to be, and the associated PHP build
    failure is resolved. I was unable to reproduce a related bug in
    mail-client/alpine.

    I added two (unrelated) missing "die" statements to the ebuild while I
    was at it.

    This non-maintainer commit was with permission from robbat2.

    Gentoo-Bug: 456928
    Gentoo-Bug: 545086

    Package-Manager: portage-2.3.3