Bug 15850 - Fails to build on macOS - fatal error: 'crypt.h' file not found
Summary: Fails to build on macOS - fatal error: 'crypt.h' file not found
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.22.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-17 12:49 UTC by Mohamed Akram
Modified: 2025-04-17 12:49 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Akram 2025-04-17 12:49:14 UTC
In configure:

Checking for header crypt.h                              : no
...
Checking for crypt                                                                : ok 
Checking for crypt_r                                                              : not found 
Checking for library crypt                                                        : no 
Checking for crypt_r                                                              : not found 
Checking for crypt_rn                                                             : not found 
Checking for library crypt                                                        : no 
Checking for crypt_rn                                                             : not found 

In build:

../../lib/util/util_crypt.c:5:10: fatal error: 'crypt.h' file not found
    5 | #include <crypt.h>
      |          ^~~~~~~~~
1 error generated.

Per POSIX, crypt() is defined in unistd.h

Potential patch:

--- lib/util/util_crypt.c.orig	2025-02-06 14:31:54
+++ lib/util/util_crypt.c	2025-04-17 10:33:52
@@ -2,7 +2,11 @@
 #include "data_blob.h"
 #include "discard.h"
 #include <talloc.h>
+#ifdef HAVE_CRYPT_H
 #include <crypt.h>
+#else
+#include <unistd.h>
+#endif
 #include "util_crypt.h"