Bug 1536881 - FTBFS with libxcrypt
Summary: FTBFS with libxcrypt
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: community-mysql
Version: rawhide
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Michal Schorm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1534789 1535520
TreeView+ depends on / blocked
 
Reported: 2018-01-21 22:24 UTC by Michal Schorm
Modified: 2018-01-22 15:32 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-01-22 15:32:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch 1 (1.17 KB, patch)
2018-01-22 01:10 UTC, Michal Schorm
no flags Details | Diff

Description Michal Schorm 2018-01-21 22:24:54 UTC
FTBFS

/builddir/build/BUILD/mysql-5.7.21/sql/item_strfunc.cc:2276:14: error: 'crypt' was not declared in this scope
   char *tmp= crypt(res->c_ptr_safe(),salt_ptr);
              ^~~~~

---

Cause:
  https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt

---

Build Logs to examine:
  https://koji.fedoraproject.org/koji/taskinfo?taskID=24346348
  https://koji.fedoraproject.org/koji/taskinfo?taskID=24330771

Comment 1 Michal Schorm 2018-01-21 22:29:01 UTC
Is that expected?
  (Is the function known for not being provided by libxcrypt header files?)

What's the suggested process?

Comment 2 Björn 'besser82' Esser 2018-01-21 23:01:34 UTC
(In reply to Michal Schorm from comment #1)
> Is that expected?
>   (Is the function known for not being provided by libxcrypt header files?)
> 
> What's the suggested process?

Well, no…  It is the `crypt()` function well supported by libxcrypt.  All files using this function should not make the blind assumption it will be declared in <unistd.h>. One can only rely on having it declared in that header file, if `_XOPEN_CRYPT` is defined *after* including it…

Putting this in the affected file after importing all other header files will fix that particular problem:

#if defined(__GLIBC__) && !defined(_XOPEN_CRYPT)
#include <crypt.h>
#endif

Do you want to provide a patch and upstream it, or shall I provide an upstreamable one?

Comment 3 Björn 'besser82' Esser 2018-01-21 23:04:00 UTC
Another option would be to have CMake check for `crypt.h` being present and define a macro like `HAVE_CRYPT_H`; then add this in the affected files:

#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif

Comment 4 Michal Schorm 2018-01-22 01:09:02 UTC
You also rebuilt MariaDB, but no problem was there. So I checked, how MariaDB does it.

It uses:

 mariadb-10.2.12/libmariadb/cmake/CheckIncludeFiles.cmake
   CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H)

 mariadb-10.2.12/include/my_global.h:
   #if defined(HAVE_CRYPT_H)
   #include <crypt.h>
   #endif

So they check the crypt.h library file directly.

---

MySQL uses the same system, so I'd stick to it and use the "CHECK_INCLUDE_FILES" cmake function.

Comment 5 Michal Schorm 2018-01-22 01:10:27 UTC
Created attachment 1384165 [details]
patch 1

Looking at MariaDB, I think this patch should get the stuff done.

Comment 6 Michal Schorm 2018-01-22 01:12:19 UTC
Do you agree?

Comment 7 Michal Schorm 2018-01-22 01:48:44 UTC
Test build with the patch:
  https://koji.fedoraproject.org/koji/taskinfo?taskID=24358755

Comment 8 Björn 'besser82' Esser 2018-01-22 05:17:54 UTC
(In reply to Michal Schorm from comment #6)
> Do you agree?

LGTM.  =)

Comment 9 Michal Schorm 2018-01-22 15:32:07 UTC
Very well then.

Built:
https://koji.fedoraproject.org/koji/taskinfo?taskID=24369733


Note You need to log in before you can comment on or make changes to this bug.