Bug #16478 HP-UX 11.11: configure should not check for libcrypt
Submitted: 13 Jan 2006 10:59 Modified: 7 May 2006 3:12
Reporter: François Laupretre Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.0.18 OS:HP/UX (HP-UX 11.11)
Assigned to: Kent Boortz CPU Architecture:Any

[13 Jan 2006 10:59] François Laupretre
Description:
In HP-UX 11.11, the crypt() function is in libc. But HP had the very bad idea to put an empty library file, named libcrypt.a in /usr/lib. And no corresponding empty libcrypt.sl.

What happens ? configure attempts to look for 'crypt in -lcrypt' :
checking for crypt in -lcrypt... yes
checking for crypt... yes

Actually, it doesn't find it in -lcrypt, but it wouldn't be a problem if there was a corresponding shared lib (libcrypt.sl). Actually, the problem does not show off in using mysql directly, as everything compiles and installs well (using the empty libcrypt.a archive library). The problem is with the '-lcrypt' which gets recorded in mysql_config and in the '.la' files :

When I compile PHP, I want to build some shared modules for mysql, mysqli, and pdo_mysql. PHP uses mysql_config and adds '-lcrypt' to its compile command for these modules. And, as there is no shared version for '-lcrypt', it refuses to build these modules as shared. It is right from its point of view because mysql says that it depends on a libcrypt library and there is no shared version of it on the system.

Workaround : after install stage, remove '-lcrypt' from bin/mysql_config and from lib/mysql/*.la.

How to repeat:
configure on HP-UX 11.11

Suggested fix:
If configure attempted to find crypt in libc before checking for a libcrypt library, it would be fine for me. But maybe it is the logic you want, to use libcrypt first when the function is defined in different places...

Another approach would be to really check for a defined crypt function in -lcrypt. I don't know how to do it and ensure that the function you get in the executable file does not come from the default libc, in a portable way.
[13 Jan 2006 16:43] François Laupretre
postgres' configure is using a macro which seems perfect to detect wether we need '-lcrypt' to get crypt(). It is an autoconf standard macro :

AC_SEARCH_LIBS(crypt,crypt)
[21 Jan 2006 16:57] Valeriy Kravchuk
Thank you for the detailed bug report. Verified just as described on our hpux11. 

In particular:

1. Extract 5.0.18 and cd into the root directory
2. run ./configure
3. Then:

mysql-5.0.18> grep -n 'checking for crypt' config.log
2125:configure:23596: checking for crypt.h
3308:configure:24692: checking for crypt in -lcrypt
3317:configure:24765: checking for crypt
mysql-5.0.18> uname -a
HP-UX hpux11 B.11.11 U 9000/800 807910656 unlimited-user license

4. make, make install and check.
[21 Jan 2006 17:01] Valeriy Kravchuk
Changed category to a more appropriate one. Thank you for a valuable suggestion also!
[5 Apr 2006 22:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4529
[7 May 2006 3:12] Kent Boortz
This is corrected in 4.1.19, and will be in 5.0.22 and 5.1.10