Skip to content

crypt module might need libcrypt #98895

@moubctez

Description

@moubctez

Bug report

On some platforms, e.g. NetBSD, building _crypt module needs linking against libcrypt. It semms like libcrypt detection has been removed from Python 3.11.0's setup.py, while still present in Python 3.10.8.

Your environment

  • CPython versions tested on: 3.11.0
  • Operating system and architecture: NetBSD 9.2, NetBSD-current

Fix

I copied the appropriate section of setup.py from Python 3.10.8, and now the building works correctly.

--- setup.py.orig       2022-10-24 17:35:39.000000000 +0000
+++ setup.py
@@ -1176,7 +1194,11 @@ class PyBuildExt(build_ext):
             self.missing.append('_curses_panel')
 
     def detect_crypt(self):
-        self.addext(Extension('_crypt', ['_cryptmodule.c']))
+        if self.compiler.find_library_file(self.lib_dirs, 'crypt'):
+            libs = ['crypt']
+        else:
+            libs = []
+        self.addext(Extension('_crypt', ['_cryptmodule.c'], libraries=libs))
 
     def detect_dbm_gdbm(self):
         # Modules that provide persistent dictionary-like semantics.  You will

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions