text:
How to adapt Pyfhel to install in macOS?

% python3 setup.py build_clib
Traceback (most recent call last):
  File "/Users/devharsh/Downloads/Pyfhel/setup.py", line 37, in <module>
    raise SystemError("Pyfhel is not supported in MacOS (see issue #59)."
SystemError: Pyfhel is not supported in MacOS (see issue #59).Please use a Linux VM or Docker.

Let's make Pyfhel available in MacOS!
As a first step, comment out the if clause around line 37 of the setup.py to attempt actual compilation, then run again.

Commented Line # 36-38 in setup.py:
#if platform_system == 'Darwin': # MacOS
    #raise SystemError("Pyfhel is not supported in MacOS (see issue #59)."
                      #"Please use a Linux VM or Docker.")

Tried to compile with % python3 setup.py build_clib
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.pyx because it changed.
[1/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx

Error:
Pyfhel/PyCtxt.pyx:642:17: 'AfsealCtxt' is not a type identifier
Traceback (most recent call last):
  File "/Users/devharsh/Downloads/Pyfhel/setup.py", line 630, in <module>
    ext_modules=cythonize(
  File "/usr/local/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1127, in cythonize
    cythonize_one(*args)
  File "/usr/local/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1250, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx

% python3 setup.py build_clib
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.pyx because it changed.
[1/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx

Error compiling Cython file:
------------------------------------------------------------
...
from numpy cimport int64_t, uint64_t

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport istream, ostream, ifstream, ofstream, ostringstream, stringstream, binary

from Pyfhel.Afhel.Afhel cimport *
^
------------------------------------------------------------

Pyfhel/Pyfhel.pxd:18:0: 'Pyfhel/Afhel/Afhel.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import Plaintext class, original from SEAL
from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/AfPtxt.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import Plaintext class, original from SEAL
from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/AfsealPtxt.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import Plaintext class, original from SEAL
from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/scheme_t.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import Plaintext class, original from SEAL
from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t
^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:16:0: 'Pyfhel/Afhel/Afhel/backend_t.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from Pyfhel.Afhel.Afhel cimport AfPtxt, AfsealPtxt, scheme_t, backend_t

# ------------------------------- DECLARATION ---------------------------------

cdef class PyPtxt:
    cdef AfPtxt* _ptr_ptxt
        ^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:21:9: 'AfPtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
# ------------------------------- DECLARATION ---------------------------------

cdef class PyPtxt:
    cdef AfPtxt* _ptr_ptxt
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
        ^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:23:9: 'scheme_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

cdef class PyPtxt:
    cdef AfPtxt* _ptr_ptxt
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
        ^
------------------------------------------------------------

Pyfhel/PyPtxt.pxd:24:9: 'backend_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import AfsealPoly class
from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/AfPoly.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import AfsealPoly class
from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/AfsealPoly.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Import our own wrapper for iostream classes, used for I/O ops
from Pyfhel.utils.iostream cimport ifstream, ofstream, ostringstream, stringstream, binary

# Import AfsealPoly class
from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex
^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:17:0: 'Pyfhel/Afhel/Afhel/cy_complex.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from Pyfhel.Afhel.Afhel cimport AfPoly, AfsealPoly, scheme_t, backend_t, cy_complex

# ------------------------------- DECLARATION ---------------------------------

cdef class PyPoly:
    cdef AfsealPoly* _afpoly
        ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:22:9: 'AfsealPoly' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
# ------------------------------- DECLARATION ---------------------------------

cdef class PyPoly:
    cdef AfsealPoly* _afpoly
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
        ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:24:9: 'scheme_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

cdef class PyPoly:
    cdef AfsealPoly* _afpoly
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
        ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:25:9: 'backend_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
cdef class PyPoly:
    cdef AfsealPoly* _afpoly
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
    cpdef vector[cy_complex] to_coeff_list(self)
                          ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:26:27: unknown type in template argument

Error compiling Cython file:
------------------------------------------------------------
...
    cdef AfsealPoly* _afpoly
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
    cpdef vector[cy_complex] to_coeff_list(self)
    cpdef cy_complex get_coeff(self, size_t i)
         ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:27:10: 'cy_complex' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
    cpdef vector[cy_complex] to_coeff_list(self)
    cpdef cy_complex get_coeff(self, size_t i)
    cpdef void set_coeff(self, cy_complex&val, size_t i)
                              ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:28:31: 'cy_complex' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef backend_t _backend
    cpdef vector[cy_complex] to_coeff_list(self)
    cpdef cy_complex get_coeff(self, size_t i)
    cpdef void set_coeff(self, cy_complex&val, size_t i)
    cpdef void check_afpoly(self)
    cpdef void from_coeff_list(self, vector[cy_complex] coeff_list, PyCtxt ref)
                                                     ^
------------------------------------------------------------

Pyfhel/PyPoly.pxd:30:54: unknown type in template argument

Error compiling Cython file:
------------------------------------------------------------
...
from Pyfhel.PyCtxt cimport PyCtxt
from Pyfhel.PyPoly cimport PyPoly

# ---------------------------- CYTHON DECLARATION ------------------------------
cdef class Pyfhel:
    cdef Afhel* afseal           # The C++ methods are accessed via a pointer
        ^
------------------------------------------------------------

Pyfhel/Pyfhel.pxd:27:9: 'Afhel' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # GETTERS
    cpdef bool batchEnabled(self)
    cpdef int get_nSlots(self)
    cpdef uint64_t get_plain_modulus(self)
    cpdef size_t get_poly_modulus_degree(self)
    cpdef scheme_t get_scheme(self)
         ^
------------------------------------------------------------

Pyfhel/Pyfhel.pxd:151:10: 'scheme_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

    # ============================ POLYNOMIAL =================================
    cpdef PyPoly empty_poly(self, PyCtxt ref)
    cpdef PyPoly poly_from_ciphertext(self, PyCtxt ctxt, size_t i)
    cpdef PyPoly poly_from_plaintext(self, PyCtxt ref, PyPtxt ptxt)
    cpdef PyPoly poly_from_coeff_vector(self, vector[cy_complex] coeff_vector, PyCtxt ref)
                                                              ^
------------------------------------------------------------

Pyfhel/Pyfhel.pxd:163:63: unknown type in template argument

Error compiling Cython file:
------------------------------------------------------------
...
# Import Abstract Ciphertext class
from Pyfhel.Afhel.Afhel cimport *

# ---------------------------- CYTHON DECLARATION ------------------------------
cdef class PyCtxt:
    cdef AfCtxt* _ptr_ctxt
        ^
------------------------------------------------------------

Pyfhel/PyCtxt.pxd:21:9: 'AfCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

# ---------------------------- CYTHON DECLARATION ------------------------------
cdef class PyCtxt:
    cdef AfCtxt* _ptr_ctxt
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
        ^
------------------------------------------------------------

Pyfhel/PyCtxt.pxd:23:9: 'scheme_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
# ---------------------------- CYTHON DECLARATION ------------------------------
cdef class PyCtxt:
    cdef AfCtxt* _ptr_ctxt
    cdef Pyfhel _pyfhel
    cdef scheme_t _scheme
    cdef backend_t _backend
        ^
------------------------------------------------------------

Pyfhel/PyCtxt.pxd:24:9: 'backend_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
                  Pyfhel pyfhel=None,
                  fileName=None,
                  bytestring=None,
                  scheme=None):
        self._mod_level = 0
        self._scheme = scheme_t.none
                      ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:33:23: undeclared name not builtin: scheme_t

Error compiling Cython file:
------------------------------------------------------------
...
                  bytestring=None,
                  scheme=None):
        self._mod_level = 0
        self._scheme = scheme_t.none
        if copy_ctxt: # If there is a PyCtxt to copy, override other args
            self._ptr_ctxt = new AfsealCtxt(deref(<AfsealCtxt*>copy_ctxt._ptr_ctxt))
                                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:35:33: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
                  bytestring=None,
                  scheme=None):
        self._mod_level = 0
        self._scheme = scheme_t.none
        if copy_ctxt: # If there is a PyCtxt to copy, override other args
            self._ptr_ctxt = new AfsealCtxt(deref(<AfsealCtxt*>copy_ctxt._ptr_ctxt))
                                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:35:33: new operator can only be applied to a C++ class

Error compiling Cython file:
------------------------------------------------------------
...
                  bytestring=None,
                  scheme=None):
        self._mod_level = 0
        self._scheme = scheme_t.none
        if copy_ctxt: # If there is a PyCtxt to copy, override other args
            self._ptr_ctxt = new AfsealCtxt(deref(<AfsealCtxt*>copy_ctxt._ptr_ctxt))
                                                  ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:35:51: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            self._scheme = copy_ctxt._scheme
            if (copy_ctxt._pyfhel):
                self._pyfhel = copy_ctxt._pyfhel

        else:
            self._ptr_ctxt = new AfsealCtxt()
                                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:42:33: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            self._scheme = copy_ctxt._scheme
            if (copy_ctxt._pyfhel):
                self._pyfhel = copy_ctxt._pyfhel

        else:
            self._ptr_ctxt = new AfsealCtxt()
                                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:42:33: new operator can only be applied to a C++ class

Error compiling Cython file:
------------------------------------------------------------
...
                    raise TypeError("<Pyfhel ERROR> PyCtxt initialization from bytestring requires valid scheme")
                self.from_bytes(bytestring)

    def __dealloc__(self):
        if self._ptr_ctxt != NULL:
            del self._ptr_ctxt
                   ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:59:20: Deletion of non-Python, non-C++ object

Error compiling Cython file:
------------------------------------------------------------
...
    cpdef int size(self):
        """Current size of the ciphertext.

        Return:
            int: size of this ciphertext"""
        return (<AfsealCtxt*>(self._ptr_ctxt)).size()
                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:136:17: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        return (<AfsealCtxt*>(self._ptr_ctxt)).size()

    @property
    def capacity(self):
        """int: Maximum size the ciphertext can hold."""
        return (<AfsealCtxt*>(self._ptr_ctxt)).size_capacity()
                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:141:17: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        return (<AfsealCtxt*>(self._ptr_ctxt)).size_capacity()

    @property
    def size(self):
        """int: Actual size of the ciphertext."""
        return (<AfsealCtxt*>(self._ptr_ctxt)).size()
                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:146:17: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        return (<AfsealCtxt*>(self._ptr_ctxt)).size()

    @property
    def scale(self):
        """double: multiplying factor to encode values in ckks."""
        return (<AfsealCtxt*>(self._ptr_ctxt)).scale()
                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:151:17: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self.set_scale(new_scale)

    @property
    def scale_bits(self):
        """int: number of bits in scale to encode values in ckks"""
        return <int>np.log2( (<AfsealCtxt*>(self._ptr_ctxt)).scale() )
                              ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:159:31: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        Sets the scale of the ciphertext.

        Args:
            scale (double): new scale of the ciphertext.
        """
        (<AfsealCtxt*>(self._ptr_ctxt)).set_scale(new_scale)
         ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:181:10: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cpdef void round_scale(self):
        """round_scale()

        Rounds the scale of the ciphertext to the nearest power of 2.
        """
        self.set_scale( pow(2, <int>np.round(np.log2( (<AfsealCtxt*>(self._ptr_ctxt)).scale() ))) )
                                                       ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:188:56: 'AfsealCtxt' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        cdef ofstream* outputter
        cdef string bFileName = _to_valid_file_str(fileName).encode('utf8')
        cdef string bcompr_mode = compr_mode.lower().encode('utf8')
        outputter = new ofstream(bFileName, binary)
        try:
            self._pyfhel.afseal.save_ciphertext(deref(outputter), bcompr_mode, deref(self._ptr_ctxt))
                                               ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:222:48: Cannot convert 'ofstream' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
        """
        if self._pyfhel is None:
            raise ValueError("<Pyfhel ERROR> ciphertext serializing requires a Pyfhel instance")
        cdef ostringstream outputter
        cdef string bcompr_mode = compr_mode.encode('utf8')
        self._pyfhel.afseal.save_ciphertext(outputter, bcompr_mode, deref(self._ptr_ctxt))
                                           ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:241:44: Cannot convert 'ostringstream' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
            raise ValueError("<Pyfhel ERROR> ciphertext loading requires a Pyfhel instance")
        cdef ifstream* inputter
        cdef string bFileName = _to_valid_file_str(fileName, check=True).encode('utf8')
        inputter = new ifstream(bFileName, binary)
        try:
            self._pyfhel.afseal.load_ciphertext(deref(inputter), deref(self._ptr_ctxt))
                                               ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:268:48: Cannot convert 'ifstream' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
        """
        if self._pyfhel is None:
            raise ValueError("<Pyfhel ERROR> ciphertext loading requires a Pyfhel instance")
        cdef stringstream inputter
        inputter.write(content,len(content))
        self._pyfhel.afseal.load_ciphertext(inputter, deref(self._ptr_ctxt))
                                           ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:296:44: Cannot convert 'stringstream' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
        Return the current size of the ciphertext.

        See Also:
            :func:`~Pyfhel.PyCtxt.size`
        """
        return (<AfsealCtxt*>(self._ptr_ctxt)).size()
                ^
------------------------------------------------------------

Pyfhel/PyCtxt.pyx:642:17: 'AfsealCtxt' is not a type identifier
Traceback (most recent call last):
  File "/Users/devharsh/Downloads/Pyfhel/setup.py", line 630, in <module>
    ext_modules=cythonize(
  File "/usr/local/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1127, in cythonize
    cythonize_one(*args)
  File "/usr/local/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1250, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx

Did a re-clone with git clone --recursive and checked the Pyfhel/backend/SEAL folder is not empty. Getting the same error.

What version of cython are you running? it should be cython==3.0.0a9 (the install requirements are parsed by pip while installing, but maybe they don't get parsed when invoking python setup.py directly)

This is what I had:
% cython --version
Cython version 0.29.30

Reinstalled Cython using pip:
% pip install cython==3.0.0a9
% cython --version
Cython version 3.0.0a9

Error dump:
% python3 setup.py build_clib
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.pyx because it changed.
Compiling /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.pyx because it changed.
[1/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.pyx
[2/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.pyx
[3/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.pyx
[4/4] Cythonizing /Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.pyx
/usr/local/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:102: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
  warnings.warn(msg, _ExperimentalProjectMetadata)
configuration error: `project` must not contain {'platforms'} properties
DESCRIPTION:
    Data structure for the **project** table inside ``pyproject.toml`` (as
    initially defined in :pep:`621`)

GIVEN VALUE:
    {
        "name": "Pyfhel",
        "version": "3.1.4",
        "description": "Python for Homomorphic Encryption Libraries",
        "readme": "README.md",
        "requires-python": ">=3.7",
        "license": {
            "text": "GNU GPLv3"
        },
        "keywords": [
            "homomorphic",
            "encryption",
            "cython",
            "cryptography"
        ],
        "authors": [
            {
                "name": "Alberto Ibarrondo",
                "email": "ibarrond@eurecom.fr"
            },
            {
                "name": "Alexander Viand",
                "email": "alexander.viand@inf.ethz.ch"
            }
        ],
        "classifiers": [
            "Programming Language :: C++",
            "Programming Language :: Cython",
            "Programming Language :: Python :: 3",
            "Programming Language :: Python :: 3.7",
            "Programming Language :: Python :: 3.8",
            "Programming Language :: Python :: 3.9",
            "Programming Language :: Python :: 3.10",
            "Programming Language :: Python :: Implementation :: CPython",
            "Development Status :: 5 - Production/Stable",
            "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
            "Operating System :: Unix",
            "Operating System :: POSIX",
            "Operating System :: Microsoft :: Windows",
            "Topic :: Security",
            "Topic :: Security :: Cryptography"
        ],
        "dependencies": [
            "numpy>=1.20"
        ],
        "platforms": [
            "Linux",
            "Windows"
        ],
        "optional-dependencies": {
            "test": [
                "pytest >= 6.0.0"
            ]
        },
        "urls": {
            "homepage": "https://pyfhel.readthedocs.io",
            "documentation": "https://pyfhel.readthedocs.io",
            "repository": "https://github.com/ibarrond/github"
        }
    }

OFFENDING RULE: 'additionalProperties'

DEFINITION:
    {
        "$schema": "http://json-schema.org/draft-07/schema",
        "$id": "https://packaging.python.org/en/latest/specifications/declaring-project-metadata/",
        "title": "Package metadata stored in the ``project`` table",
        "type": "object",
        "properties": {
            "name": {
                "type": "string",
                "description": "The name (primary identifier) of the project. MUST be statically defined.",
                "format": "pep508-identifier"
            },
            "version": {
                "type": "string",
                "description": "The version of the project as supported by :pep:`440`.",
                "format": "pep440"
            },
            "description": {
                "type": "string",
                "$$description": [
                    "The `summary description of the project",
                    "<https://packaging.python.org/specifications/core-metadata/#summary>`_"
                ]
            },
            "readme": {
                "$$description": [
                    "`Full/detailed description of the project in the form of a README",
                    "<https://www.python.org/dev/peps/pep-0621/#readme>`_",
                    "with meaning similar to the one defined in `core metadata's Description",
                    "<https://packaging.python.org/specifications/core-metadata/#description>`_"
                ],
                "oneOf": [
                    {
                        "type": "string",
                        "$$description": [
                            "Relative path to a text file (UTF-8) containing the full description",
                            "of the project. If the file path ends in case-insensitive ``.md`` or",
                            "``.rst`` suffixes, then the content-type is respectively",
                            "``text/markdown`` or ``text/x-rst``"
                        ]
                    },
                    {
                        "type": "object",
                        "allOf": [
                            {
                                "anyOf": [
                                    {
                                        "properties": {
                                            "file": {
                                                "type": "string",
                                                "$$description": [
                                                    "Relative path to a text file containing the full description",
                                                    "of the project."
                                                ]
                                            }
                                        },
                                        "required": [
                                            "file"
                                        ]
                                    },
                                    {
                                        "properties": {
                                            "text": {
                                                "type": "string",
                                                "description": "Full text describing the project."
                                            }
                                        },
                                        "required": [
                                            "text"
                                        ]
                                    }
                                ]
                            },
                            {
                                "properties": {
                                    "content-type": {
                                        "type": "string",
                                        "$$description": [
                                            "Content-type (:rfc:`1341`) of the full description",
                                            "(e.g. ``text/markdown``). The ``charset`` parameter is assumed",
                                            "UTF-8 when not present."
                                        ],
                                        "$comment": "TODO: add regex pattern or format?"
                                    }
                                },
                                "required": [
                                    "content-type"
                                ]
                            }
                        ]
                    }
                ]
            },
            "requires-python": {
                "type": "string",
                "format": "pep508-versionspec",
                "$$description": [
                    "`The Python version requirements of the project",
                    "<https://packaging.python.org/specifications/core-metadata/#requires-python>`_."
                ]
            },
            "license": {
                "description": "`Project license <https://www.python.org/dev/peps/pep-0621/#license>`_.",
                "oneOf": [
                    {
                        "properties": {
                            "file": {
                                "type": "string",
                                "$$description": [
                                    "Relative path to the file (UTF-8) which contains the license for the",
                                    "project."
                                ]
                            }
                        },
                        "required": [
                            "file"
                        ]
                    },
                    {
                        "properties": {
                            "text": {
                                "type": "string",
                                "$$description": [
                                    "The license of the project whose meaning is that of the",
                                    "`License field from the core metadata",
                                    "<https://packaging.python.org/specifications/core-metadata/#license>`_."
                                ]
                            }
                        },
                        "required": [
                            "text"
                        ]
                    }
                ]
            },
            "authors": {
                "type": "array",
                "items": {
                    "$id": "#/definitions/author",
                    "title": "Author or Maintainer",
                    "$comment": "https://www.python.org/dev/peps/pep-0621/#authors-maintainers",
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "string",
                            "$$description": [
                                "MUST be a valid email name, i.e. whatever can be put as a name, before an",
                                "email, in :rfc:`822`."
                            ]
                        },
                        "email": {
                            "type": "string",
                            "format": "idn-email",
                            "description": "MUST be a valid email address"
                        }
                    }
                },
                "$$description": [
                    "The people or organizations considered to be the 'authors' of the project.",
                    "The exact meaning is open to interpretation (e.g. original or primary authors,",
                    "current maintainers, or owners of the package)."
                ]
            },
            "maintainers": {
                "type": "array",
                "items": {
                    "$id": "#/definitions/author",
                    "title": "Author or Maintainer",
                    "$comment": "https://www.python.org/dev/peps/pep-0621/#authors-maintainers",
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "string",
                            "$$description": [
                                "MUST be a valid email name, i.e. whatever can be put as a name, before an",
                                "email, in :rfc:`822`."
                            ]
                        },
                        "email": {
                            "type": "string",
                            "format": "idn-email",
                            "description": "MUST be a valid email address"
                        }
                    }
                },
                "$$description": [
                    "The people or organizations considered to be the 'maintainers' of the project.",
                    "Similarly to ``authors``, the exact meaning is open to interpretation."
                ]
            },
            "keywords": {
                "type": "array",
                "items": {
                    "type": "string"
                },
                "description": "List of keywords to assist searching for the distribution in a larger catalog."
            },
            "classifiers": {
                "type": "array",
                "items": {
                    "type": "string",
                    "format": "trove-classifier",
                    "description": "`PyPI classifier <https://pypi.org/classifiers/>`_."
                },
                "$$description": [
                    "`Trove classifiers <https://pypi.org/classifiers/>`_",
                    "which apply to the project."
                ]
            },
            "urls": {
                "type": "object",
                "description": "URLs associated with the project in the form ``label => value``.",
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "type": "string",
                        "format": "url"
                    }
                }
            },
            "scripts": {
                "$id": "#/definitions/entry-point-group",
                "title": "Entry-points",
                "type": "object",
                "$$description": [
                    "Entry-points are grouped together to indicate what sort of capabilities they",
                    "provide.",
                    "See the `packaging guides",
                    "<https://packaging.python.org/specifications/entry-points/>`_",
                    "and `setuptools docs",
                    "<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_",
                    "for more information."
                ],
                "propertyNames": {
                    "format": "python-entrypoint-name"
                },
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "type": "string",
                        "$$description": [
                            "Reference to a Python object. It is either in the form",
                            "``importable.module``, or ``importable.module:object.attr``."
                        ],
                        "format": "python-entrypoint-reference",
                        "$comment": "https://packaging.python.org/specifications/entry-points/"
                    }
                }
            },
            "gui-scripts": {
                "$id": "#/definitions/entry-point-group",
                "title": "Entry-points",
                "type": "object",
                "$$description": [
                    "Entry-points are grouped together to indicate what sort of capabilities they",
                    "provide.",
                    "See the `packaging guides",
                    "<https://packaging.python.org/specifications/entry-points/>`_",
                    "and `setuptools docs",
                    "<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_",
                    "for more information."
                ],
                "propertyNames": {
                    "format": "python-entrypoint-name"
                },
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "type": "string",
                        "$$description": [
                            "Reference to a Python object. It is either in the form",
                            "``importable.module``, or ``importable.module:object.attr``."
                        ],
                        "format": "python-entrypoint-reference",
                        "$comment": "https://packaging.python.org/specifications/entry-points/"
                    }
                }
            },
            "entry-points": {
                "$$description": [
                    "Instruct the installer to expose the given modules/functions via",
                    "``entry-point`` discovery mechanism (useful for plugins).",
                    "More information available in the `Python packaging guide",
                    "<https://packaging.python.org/specifications/entry-points/>`_."
                ],
                "propertyNames": {
                    "format": "python-entrypoint-group"
                },
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "$id": "#/definitions/entry-point-group",
                        "title": "Entry-points",
                        "type": "object",
                        "$$description": [
                            "Entry-points are grouped together to indicate what sort of capabilities they",
                            "provide.",
                            "See the `packaging guides",
                            "<https://packaging.python.org/specifications/entry-points/>`_",
                            "and `setuptools docs",
                            "<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_",
                            "for more information."
                        ],
                        "propertyNames": {
                            "format": "python-entrypoint-name"
                        },
                        "additionalProperties": false,
                        "patternProperties": {
                            "^.+$": {
                                "type": "string",
                                "$$description": [
                                    "Reference to a Python object. It is either in the form",
                                    "``importable.module``, or ``importable.module:object.attr``."
                                ],
                                "format": "python-entrypoint-reference",
                                "$comment": "https://packaging.python.org/specifications/entry-points/"
                            }
                        }
                    }
                }
            },
            "dependencies": {
                "type": "array",
                "description": "Project (mandatory) dependencies.",
                "items": {
                    "$id": "#/definitions/dependency",
                    "title": "Dependency",
                    "type": "string",
                    "description": "Project dependency specification according to PEP 508",
                    "format": "pep508"
                }
            },
            "optional-dependencies": {
                "type": "object",
                "description": "Optional dependency for the project",
                "propertyNames": {
                    "format": "pep508-identifier"
                },
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "type": "array",
                        "items": {
                            "$id": "#/definitions/dependency",
                            "title": "Dependency",
                            "type": "string",
                            "description": "Project dependency specification according to PEP 508",
                            "format": "pep508"
                        }
                    }
                }
            },
            "dynamic": {
                "type": "array",
                "$$description": [
                    "Specifies which fields are intentionally unspecified and expected to be",
                    "dynamically provided by build tools"
                ],
                "items": {
                    "enum": [
                        "version",
                        "description",
                        "readme",
                        "requires-python",
                        "license",
                        "authors",
                        "maintainers",
                        "keywords",
                        "classifiers",
                        "urls",
                        "scripts",
                        "gui-scripts",
                        "entry-points",
                        "dependencies",
                        "optional-dependencies"
                    ]
                }
            }
        },
        "required": [
            "name"
        ],
        "additionalProperties": false,
        "if": {
            "not": {
                "required": [
                    "dynamic"
                ],
                "properties": {
                    "dynamic": {
                        "contains": {
                            "const": "version"
                        },
                        "$$description": [
                            "version is listed in ``dynamic``"
                        ]
                    }
                }
            },
            "$$comment": [
                "According to :pep:`621`:",
                "    If the core metadata specification lists a field as \"Required\", then",
                "    the metadata MUST specify the field statically or list it in dynamic",
                "In turn, `core metadata`_ defines:",
                "    The required fields are: Metadata-Version, Name, Version.",
                "    All the other fields are optional.",
                "Since ``Metadata-Version`` is defined by the build back-end, ``name`` and",
                "``version`` are the only mandatory information in ``pyproject.toml``.",
                ".. _core metadata: https://packaging.python.org/specifications/core-metadata/"
            ]
        },
        "then": {
            "required": [
                "version"
            ],
            "$$description": [
                "version should be statically defined in the ``version`` field"
            ]
        },
        "definitions": {
            "author": {
                "$id": "#/definitions/author",
                "title": "Author or Maintainer",
                "$comment": "https://www.python.org/dev/peps/pep-0621/#authors-maintainers",
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "$$description": [
                            "MUST be a valid email name, i.e. whatever can be put as a name, before an",
                            "email, in :rfc:`822`."
                        ]
                    },
                    "email": {
                        "type": "string",
                        "format": "idn-email",
                        "description": "MUST be a valid email address"
                    }
                }
            },
            "entry-point-group": {
                "$id": "#/definitions/entry-point-group",
                "title": "Entry-points",
                "type": "object",
                "$$description": [
                    "Entry-points are grouped together to indicate what sort of capabilities they",
                    "provide.",
                    "See the `packaging guides",
                    "<https://packaging.python.org/specifications/entry-points/>`_",
                    "and `setuptools docs",
                    "<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_",
                    "for more information."
                ],
                "propertyNames": {
                    "format": "python-entrypoint-name"
                },
                "additionalProperties": false,
                "patternProperties": {
                    "^.+$": {
                        "type": "string",
                        "$$description": [
                            "Reference to a Python object. It is either in the form",
                            "``importable.module``, or ``importable.module:object.attr``."
                        ],
                        "format": "python-entrypoint-reference",
                        "$comment": "https://packaging.python.org/specifications/entry-points/"
                    }
                }
            },
            "dependency": {
                "$id": "#/definitions/dependency",
                "title": "Dependency",
                "type": "string",
                "description": "Project dependency specification according to PEP 508",
                "format": "pep508"
            }
        }
    }
Traceback (most recent call last):
  File "/Users/devharsh/Downloads/Pyfhel/setup.py", line 647, in <module>
    setup(
  File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 122, in setup
    dist.parse_config_files()
  File "/usr/local/lib/python3.9/site-packages/setuptools/dist.py", line 869, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/usr/local/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 54, in apply_configuration
    config = read_configuration(filepath, True, ignore_option_errors, dist)
  File "/usr/local/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 120, in read_configuration
    validate(subset, filepath)
  File "/usr/local/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py", line 43, in validate
    raise error from None
ValueError: invalid pyproject.toml config: `project`

One down! Seems like setuptools is not up-to-date this time. To be sure, install the following packages, listed in pyproject.toml (pip install . would do it for you if I'm not mistaken):
  "setuptools<=60.9",
  "wheel",
  "cython>=3.0.0a9",
  "numpy>=1.20",
  "cmake>=3.15",
  "toml>=0.10"

Downgraded setuptools from setuptools-62.3.2 to setuptools-60.9.0.
% python3 setup.py build_clib
running build_clib
building 'SEAL' cmake-based library
-- Build type (CMAKE_BUILD_TYPE): Release
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Microsoft SEAL debug mode: OFF
-- SEAL_USE_CXX17: ON
-- SEAL_BUILD_DEPS: ON
-- SEAL_USE_MSGSL: ON
-- Microsoft GSL: download ...
-- Found Git: /usr/local/bin/git (found version "2.37.0")
-- SEAL_USE_ZLIB: ON
-- ZLIB: download ...
CMake Deprecation Warning at thirdparty/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/thirdparty/zlib-src/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- SEAL_USE_ZSTD: ON
-- Zstandard: download ...
CMake Deprecation Warning at thirdparty/zstd-src/build/cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- ZSTD VERSION: 1.4.5
-- Performing Test CXX_FLAG_STD_CPLUSPLUS11
-- Performing Test CXX_FLAG_STD_CPLUSPLUS11 - Success
-- Performing Test C_FLAG_STD_C99
-- Performing Test C_FLAG_STD_C99 - Success
-- Performing Test C_FLAG_WALL
-- Performing Test C_FLAG_WALL - Success
-- Performing Test CXX_FLAG_WALL
-- Performing Test CXX_FLAG_WALL - Success
-- Performing Test C_FLAG_WEXTRA
-- Performing Test C_FLAG_WEXTRA - Success
-- Performing Test CXX_FLAG_WEXTRA
-- Performing Test CXX_FLAG_WEXTRA - Success
-- Performing Test C_FLAG_WUNDEF
-- Performing Test C_FLAG_WUNDEF - Success
-- Performing Test CXX_FLAG_WUNDEF
-- Performing Test CXX_FLAG_WUNDEF - Success
-- Performing Test C_FLAG_WSHADOW
-- Performing Test C_FLAG_WSHADOW - Success
-- Performing Test CXX_FLAG_WSHADOW
-- Performing Test CXX_FLAG_WSHADOW - Success
-- Performing Test C_FLAG_WCAST_ALIGN
-- Performing Test C_FLAG_WCAST_ALIGN - Success
-- Performing Test CXX_FLAG_WCAST_ALIGN
-- Performing Test CXX_FLAG_WCAST_ALIGN - Success
-- Performing Test C_FLAG_WCAST_QUAL
-- Performing Test C_FLAG_WCAST_QUAL - Success
-- Performing Test CXX_FLAG_WCAST_QUAL
-- Performing Test CXX_FLAG_WCAST_QUAL - Success
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES - Success
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- Performing Test SEAL_MEMSET_S_FOUND
-- Performing Test SEAL_MEMSET_S_FOUND - Success
-- Looking for explicit_bzero
-- Looking for explicit_bzero - not found
-- Looking for explicit_memset
-- Looking for explicit_memset - not found
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
[  2%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/debug.c.o
[  2%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/entropy_common.c.o
[  3%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/error_private.c.o
[  4%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/adler32.o
[  6%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/fse_decompress.c.o
[  7%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/pool.c.o
[  8%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/compress.o
[  9%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/crc32.o
[ 11%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/threading.c.o
[ 12%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/xxhash.c.o
[ 13%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/deflate.o
[ 14%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/zstd_common.c.o
[ 16%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzclose.o
[ 16%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/fse_compress.c.o
[ 17%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/hist.c.o
[ 17%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzlib.o
[ 18%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzread.o
[ 19%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/huf_compress.c.o
[ 20%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzwrite.o
[ 22%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inflate.o
[ 23%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/infback.o
[ 24%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress.c.o
[ 25%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inftrees.o
[ 27%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_literals.c.o
[ 28%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inffast.o
[ 29%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/trees.o
[ 30%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_sequences.c.o
[ 32%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_superblock.c.o
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/thirdparty/zstd-src/lib/compress/zstd_compress_superblock.c:412:12: warning: variable 'litLengthSum' set but not used [-Wunused-but-set-variable]
    size_t litLengthSum = 0;
           ^
[ 33%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/uncompr.o
[ 34%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_double_fast.c.o
1 warning generated.
[ 35%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/zutil.o
[ 37%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_fast.c.o
[ 38%] Linking C static library ../../lib/libz.a
[ 39%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_lazy.c.o
[ 39%] Built target zlibstatic
[ 40%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_ldm.c.o
[ 40%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_opt.c.o
[ 41%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstdmt_compress.c.o
[ 43%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/huf_decompress.c.o
[ 44%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_ddict.c.o
[ 45%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_decompress.c.o
[ 46%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_decompress_block.c.o
[ 48%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/cover.c.o
[ 49%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/divsufsort.c.o
[ 50%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/fastcover.c.o
[ 51%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/zdict.c.o
[ 53%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_common.c.o
[ 53%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_compress.c.o
[ 54%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_decompress.c.o
[ 55%] Linking C static library ../../../../../lib/libzstd.a
[ 55%] Built target libzstd_static
[ 56%] Building CXX object CMakeFiles/seal.dir/native/src/seal/batchencoder.cpp.o
[ 59%] Building CXX object CMakeFiles/seal.dir/native/src/seal/ckks.cpp.o
[ 59%] Building CXX object CMakeFiles/seal.dir/native/src/seal/ciphertext.cpp.o
[ 60%] Building CXX object CMakeFiles/seal.dir/native/src/seal/context.cpp.o
[ 61%] Building CXX object CMakeFiles/seal.dir/native/src/seal/decryptor.cpp.o
[ 62%] Building CXX object CMakeFiles/seal.dir/native/src/seal/encryptionparams.cpp.o
[ 62%] Building CXX object CMakeFiles/seal.dir/native/src/seal/encryptor.cpp.o
[ 64%] Building CXX object CMakeFiles/seal.dir/native/src/seal/evaluator.cpp.o
[ 65%] Building CXX object CMakeFiles/seal.dir/native/src/seal/keygenerator.cpp.o
[ 66%] Building CXX object CMakeFiles/seal.dir/native/src/seal/kswitchkeys.cpp.o
[ 67%] Building CXX object CMakeFiles/seal.dir/native/src/seal/memorymanager.cpp.o
[ 69%] Building CXX object CMakeFiles/seal.dir/native/src/seal/modulus.cpp.o
[ 70%] Building CXX object CMakeFiles/seal.dir/native/src/seal/plaintext.cpp.o
[ 71%] Building CXX object CMakeFiles/seal.dir/native/src/seal/randomgen.cpp.o
[ 72%] Building CXX object CMakeFiles/seal.dir/native/src/seal/serialization.cpp.o
[ 74%] Building CXX object CMakeFiles/seal.dir/native/src/seal/valcheck.cpp.o
[ 75%] Building C object CMakeFiles/seal.dir/native/src/seal/util/blake2b.c.o
[ 75%] Building C object CMakeFiles/seal.dir/native/src/seal/util/blake2xb.c.o
[ 76%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/clipnormal.cpp.o
[ 77%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/common.cpp.o
[ 79%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/croots.cpp.o
[ 80%] Building C object CMakeFiles/seal.dir/native/src/seal/util/fips202.c.o
[ 81%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/globals.cpp.o
[ 82%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/galois.cpp.o
[ 83%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/hash.cpp.o
[ 85%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/iterator.cpp.o
[ 86%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/mempool.cpp.o
[ 87%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/numth.cpp.o
[ 87%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/polyarithsmallmod.cpp.o
[ 88%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/rlwe.cpp.o
[ 90%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/rns.cpp.o
[ 91%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/scalingvariant.cpp.o
[ 92%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/ntt.cpp.o
[ 93%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/streambuf.cpp.o
[ 95%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarith.cpp.o
[ 96%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarithmod.cpp.o
[ 97%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarithsmallmod.cpp.o
[ 98%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintcore.cpp.o
[100%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/ztools.cpp.o
[100%] Linking CXX static library lib/libseal-3.7.a
[100%] Built target seal
building 'Afhel' shared library
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.cpp:32:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.h:46:
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:20:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class scheme_t : std::uint8_t{
     ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:29:52: error: expected ';' after top level declarator
static std::map<scheme_t, std::string> scheme_t_str {
                                                   ^
                                                   ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:34:52: error: expected ';' after top level declarator
static std::map<std::string, scheme_t> scheme_t_map {
                                                   ^
                                                   ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:41:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class backend_t : std::uint8_t{
     ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:49:54: error: expected ';' after top level declarator
static std::map<backend_t, std::string> backend_t_str {
                                                     ^
                                                     ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:54:54: error: expected ';' after top level declarator
static std::map<std::string, backend_t> backend_t_map {
                                                     ^
                                                     ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:100:56: error: a space is required between consecutive right angle brackets (use '> >')
  virtual void encode_c(std::vector<std::complex<double>> &values, double scale, AfPtxt &plainVOut) = 0;
                                                       ^~
                                                       > >
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:107:72: error: a space is required between consecutive right angle brackets (use '> >')
  virtual void decode_c(AfPtxt &plain1, std::vector<std::complex<double>> &valueVOut) = 0;
                                                                       ^~
                                                                       > >
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:206:42: error: a space is required between consecutive right angle brackets (use '> >')
  virtual std::vector<std::complex<double>> to_coeff_list(AfPoly& poly) = 0;
                                         ^~
                                         > >
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:76:36: error: expected expression
    int sec, std::vector<int> qs = {}) = 0;
                                   ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afhel.h:238:42: error: a space is required between consecutive right angle brackets (use '> >')
  virtual std::vector<std::complex<double>> to_coeff_list(Afhel &afhel) = 0;
                                         ^~
                                         > >
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.cpp:32:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.h:47:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/dynarray.h:6:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/memorymanager.h:6:
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/defines.h:123:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using seal_byte = std::byte;
                      ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/defines.h:123:28: error: no type named 'byte' in namespace 'std'
    using seal_byte = std::byte;
                      ~~~~~^
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.cpp:32:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.h:47:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/dynarray.h:6:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/memorymanager.h:7:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:6:
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/hestdparms.h:19:9: error: expected expression
        SEAL_NODISCARD constexpr int seal_he_std_parms_128_tc(std::size_t poly_modulus_degree) noexcept
        ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/defines.h:155:25: note: expanded from macro 'SEAL_NODISCARD'
#define SEAL_NODISCARD [[nodiscard]]
                        ^
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.cpp:32:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.h:47:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/dynarray.h:6:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/memorymanager.h:7:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:6:
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/hestdparms.h:19:24: error: C++ requires a type specifier for all declarations
        SEAL_NODISCARD constexpr int seal_he_std_parms_128_tc(std::size_t poly_modulus_degree) noexcept
                       ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/hestdparms.h:19:33: error: expected ';' after top level declarator
        SEAL_NODISCARD constexpr int seal_he_std_parms_128_tc(std::size_t poly_modulus_degree) noexcept
                                ^
                                ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/hestdparms.h:19:96: error: expected function body after function declarator
        SEAL_NODISCARD constexpr int seal_he_std_parms_128_tc(std::size_t poly_modulus_degree) noexcept
                                                                                ^
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.cpp:32:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Afhel/Afseal.h:47:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/dynarray.h:6:
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/memorymanager.h:7:
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:31:20: error: unknown type name 'thread_local'
            extern thread_local std::shared_ptr<MemoryPool> const tls_memory_pool;
                   ^
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:31:38: error: template specialization requires 'template<>'
            extern thread_local std::shared_ptr<MemoryPool> const tls_memory_pool;
                                     ^         ~~~~~~~~~~~~
            template<>
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:31:38: error: no variable template matches specialization
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:31:60: error: expected ';' after top level declarator
            extern thread_local std::shared_ptr<MemoryPool> const tls_memory_pool;
                                                           ^
                                                           ;
/Users/devharsh/Downloads/Pyfhel/Pyfhel/backend/SEAL/native/src/seal/util/globals.h:31:67: error: C++ requires a type specifier for all declarations
            extern thread_local std::shared_ptr<MemoryPool> const tls_memory_pool;
                                                            ~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
error: command '/usr/bin/clang' failed with exit code 1

It seems we're missing a compiler flag to say that we want to use C++17. What compiler (and version) are you using? Just execute python3 and check the first printed line. If it's gcc or clang, adding a compiler flag -std=c++17 should do the trick. To add compiler directives for MacOS, you can add a line like this in all the extra_compile_args fields of pyptoject.toml (both for the extensions and for the cpplibraries):
 {Darwin = ["-std=c++17","-O3","-fopenmp"]},

Edited file pyproject.toml by adding lines {Darwin = ["-std=c++17","-O3","-fopenmp"]},
Tried to build using gcc-12 and clang-14 compilers by modifying setup.py as Apple clang version 13.1.6 (clang-1316.0.21.2.5) does not support option -fopenmp
Posting error dumps for both in the following comments

For GCC@12:
% python3 setup.py build_clib
running build_clib
building 'SEAL' cmake-based library
-- Build type (CMAKE_BUILD_TYPE): Release
-- Microsoft SEAL debug mode: OFF
-- SEAL_USE_CXX17: ON
-- SEAL_BUILD_DEPS: ON
-- SEAL_USE_MSGSL: ON
-- Microsoft GSL: download ...
-- SEAL_USE_ZLIB: ON
-- ZLIB: download ...
CMake Deprecation Warning at thirdparty/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- SEAL_USE_ZSTD: ON
-- Zstandard: download ...
CMake Deprecation Warning at thirdparty/zstd-src/build/cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- ZSTD VERSION: 1.4.5
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
Consolidate compiler generated dependencies of target zlibstatic
Consolidate compiler generated dependencies of target libzstd_static
[ 18%] Built target zlibstatic
[ 55%] Built target libzstd_static
Consolidate compiler generated dependencies of target seal
[100%] Built target seal
building 'Afhel' shared library
devharsh@Devharshs-MBP Pyfhel % python3 setup.py build_clib
running build_clib
building 'SEAL' cmake-based library
-- Build type (CMAKE_BUILD_TYPE): Release
-- Microsoft SEAL debug mode: OFF
-- SEAL_USE_CXX17: ON
-- SEAL_BUILD_DEPS: ON
-- SEAL_USE_MSGSL: ON
-- Microsoft GSL: download ...
-- SEAL_USE_ZLIB: ON
-- ZLIB: download ...
CMake Deprecation Warning at thirdparty/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- SEAL_USE_ZSTD: ON
-- Zstandard: download ...
CMake Deprecation Warning at thirdparty/zstd-src/build/cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- ZSTD VERSION: 1.4.5
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
Consolidate compiler generated dependencies of target zlibstatic
Consolidate compiler generated dependencies of target libzstd_static
[ 18%] Built target zlibstatic
[ 55%] Built target libzstd_static
Consolidate compiler generated dependencies of target seal
[100%] Built target seal
building 'Afhel' shared library
devharsh@Devharshs-MBP Pyfhel % python3 setup.py build
running build
running build_py
running build_clib
building 'SEAL' cmake-based library
-- Build type (CMAKE_BUILD_TYPE): Release
-- Microsoft SEAL debug mode: OFF
-- SEAL_USE_CXX17: ON
-- SEAL_BUILD_DEPS: ON
-- SEAL_USE_MSGSL: ON
-- Microsoft GSL: download ...
-- SEAL_USE_ZLIB: ON
-- ZLIB: download ...
CMake Deprecation Warning at thirdparty/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- SEAL_USE_ZSTD: ON
-- Zstandard: download ...
CMake Deprecation Warning at thirdparty/zstd-src/build/cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- ZSTD VERSION: 1.4.5
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
Consolidate compiler generated dependencies of target zlibstatic
Consolidate compiler generated dependencies of target libzstd_static
[ 19%] Built target zlibstatic
[ 55%] Built target libzstd_static
Consolidate compiler generated dependencies of target seal
[100%] Built target seal
building 'Afhel' shared library
running build_ext
cimporting numpy version '1.21.2'
building 'Pyfhel.Pyfhel' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_vec_to_array_i(std::vector<long int>, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:8880:33: warning: comparison of integer expressions of different signedness: '__pyx_t_5numpy_int64_t' {aka 'long int'} and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
 8880 |   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_vec_to_array_f(std::vector<double>, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:9138:33: warning: comparison of integer expressions of different signedness: '__pyx_t_5numpy_int64_t' {aka 'long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
 9138 |   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function '__pyx_obj_6Pyfhel_6PyCtxt_PyCtxt* __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_encryptInt(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, __Pyx_memviewslice, int, __pyx_opt_args_6Pyfhel_6Pyfhel_6Pyfhel_encryptInt*)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:14420:36: error: cannot convert 'std::vector<long int>' to 'std::vector<long long int>&'
14420 |     __pyx_v_self->afseal->encode_i(__pyx_v_vec, __pyx_v_ptxt);
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    std::vector<long int>
In file included from /Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:878:
Pyfhel/Afhel/Afhel.h:97:47: note:   initializing argument 1 of 'virtual void Afhel::encode_i(std::vector<long long int>&, AfPtxt&)'
   97 |   virtual void encode_i(std::vector<int64_t> &values, AfPtxt &plainOut) = 0;
      |                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_decryptInt(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, __pyx_obj_6Pyfhel_6PyCtxt_PyCtxt*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:17407:50: error: cannot convert 'std::vector<long int>' to 'std::vector<long long int>&'
17407 |     __pyx_v_self->afseal->decode_i(__pyx_v_ptxt, __pyx_v_vec);
      |                                                  ^~~~~~~~~~~
      |                                                  |
      |                                                  std::vector<long int>
Pyfhel/Afhel/Afhel.h:104:63: note:   initializing argument 2 of 'virtual void Afhel::decode_i(AfPtxt&, std::vector<long long int>&)'
  104 |   virtual void decode_i(AfPtxt &plain1, std::vector<int64_t> &valueVOut) = 0;
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function '__pyx_obj_6Pyfhel_6PyPtxt_PyPtxt* __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_encodeInt(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, __Pyx_memviewslice, int, __pyx_opt_args_6Pyfhel_6Pyfhel_6Pyfhel_encodeInt*)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:20422:36: error: cannot convert 'std::vector<long int>' to 'std::vector<long long int>&'
20422 |     __pyx_v_self->afseal->encode_i(__pyx_v_vec, (*__pyx_v_ptxt->_ptr_ptxt));
      |                                    ^~~~~~~~~~~
      |                                    |
      |                                    std::vector<long int>
Pyfhel/Afhel/Afhel.h:97:47: note:   initializing argument 1 of 'virtual void Afhel::encode_i(std::vector<long long int>&, AfPtxt&)'
   97 |   virtual void encode_i(std::vector<int64_t> &values, AfPtxt &plainOut) = 0;
      |                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_decodeInt(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, __pyx_obj_6Pyfhel_6PyPtxt_PyPtxt*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:23421:64: error: cannot convert 'std::vector<long int>' to 'std::vector<long long int>&'
23421 |     __pyx_v_self->afseal->decode_i((*__pyx_v_ptxt->_ptr_ptxt), __pyx_v_output_vector);
      |                                                                ^~~~~~~~~~~~~~~~~~~~~
      |                                                                |
      |                                                                std::vector<long int>
Pyfhel/Afhel/Afhel.h:104:63: note:   initializing argument 2 of 'virtual void Afhel::decode_i(AfPtxt&, std::vector<long long int>&)'
  104 |   virtual void decode_i(AfPtxt &plain1, std::vector<int64_t> &valueVOut) = 0;
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function '__pyx_obj_6Pyfhel_6PyCtxt_PyCtxt* __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_power(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, __pyx_obj_6Pyfhel_6PyCtxt_PyCtxt*, __pyx_t_5numpy_uint64_t, int, __pyx_opt_args_6Pyfhel_6Pyfhel_6Pyfhel_power*)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:28477:74: error: cannot bind non-const lvalue reference of type 'uint64_t&' {aka 'long long unsigned int&'} to a value of type '__pyx_t_5numpy_uint64_t' {aka 'long unsigned int'}
28477 |       __pyx_v_self->afseal->exponentiate((*__pyx_v_new_ctxt->_ptr_ctxt), __pyx_v_expon);
      |                                                                          ^~~~~~~~~~~~~
Pyfhel/Afhel/Afhel.h:145:56: note:   initializing argument 2 of 'virtual void Afhel::exponentiate(AfCtxt&, uint64_t&)'
  145 |   virtual void exponentiate(AfCtxt &cipher1, uint64_t &expon) = 0;
      |                                              ~~~~~~~~~~^~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:28513:70: error: cannot bind non-const lvalue reference of type 'uint64_t&' {aka 'long long unsigned int&'} to a value of type '__pyx_t_5numpy_uint64_t' {aka 'long unsigned int'}
28513 |       __pyx_v_self->afseal->exponentiate((*__pyx_v_ctxt->_ptr_ctxt), __pyx_v_expon);
      |                                                                      ^~~~~~~~~~~~~
Pyfhel/Afhel/Afhel.h:145:56: note:   initializing argument 2 of 'virtual void Afhel::exponentiate(AfCtxt&, uint64_t&)'
  145 |   virtual void exponentiate(AfCtxt &cipher1, uint64_t &expon) = 0;
      |                                              ~~~~~~~~~~^~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py_int(const std::vector<int>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:42940:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
42940 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py___pyx_t_5numpy_int64_t(const std::vector<long int>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43268:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43268 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py_double(const std::vector<double>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43399:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43399 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py___pyx_t_6Pyfhel_5Afhel_5Afhel_cy_complex(const std::vector<std::complex<double> >&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43604:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43604 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __Pyx_Import(PyObject*, PyObject*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:67415:31: warning: comparing the result of pointer addition '(((const char*)"Pyfhel.Pyfhel") + 6)' and NULL [-Waddress]
67415 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
error: command '/usr/local/Cellar/gcc@12/12.1.0_1/bin/gcc-12' failed with exit code 1

For clang, it seems there is an issue with the numeric types offered by numpy. To try to fix it, replace the  from numpy cimport int64_t, uint64_t, uint8_t line in Pyfhel/Afhel/Afhel.pxd file by:
ctypedef long long int64_t
ctypedef unsigned long long uint64_t
ctypedef unsigned char uint8_t

Similarly, replace from numpy cimport int64_t, uint64_t in Pyfhel/Pyfhel.pxd with:
ctypedef long long int64_t
ctypedef unsigned long long uint64_t

And gcc? Apply the same patch

Same error with gcc:
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file 'build/temp.macosx-12-x86_64-3.9/libAfhel.so'
collect2: error: ld returned 1 exit status
error: command '/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12' failed with exit code 1

The issue lies in .so shared object, macOS doesn't work with bundles, it requires a dynamic library .dylib [refer to this SO answer]
Essentially we need a third library build option in setup.py for macOS:
# Auxiliary methods
def get_lib_suffix(lib_type: str) -> str:
    if lib_type == 'static':
        if platform_system == 'Windows':
            return '.lib'
        else:
            return '.a'
    else:  # shared object (bundle)
        if platform_system == 'Windows':
            return '.dll'
        elif platform_system == 'Darwin':
            return '.dylib'
        else:
            return '.so'

Nice point! Does it solve the issue?

I tried the following:
Edited extra_link_args in pyproject.toml by adding {Darwin = ["-fopenmp","-dynamiclib"]},
In setup.py
Edited function build_shared_lib with
vars = sysconfig.get_config_vars()
sysconfig.get_config_vars()['BLDSHARED'] = vars['BLDSHARED'].replace('-bundle', '-dynamiclib')
sysconfig.get_config_vars()['LDCXXSHARED'] = vars['LDCXXSHARED'].replace('-bundle', '-dynamiclib')
sysconfig.get_config_vars()['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-dynamiclib')
sysconfig.get_config_vars()['CCSHARED'] = "-dynamiclib"
sysconfig.get_config_vars()['SO'] = ".dylib"
self.compiler.executables['linker_so'] = ['cc']
os.environ["LDSHARED"] = sysconfig.get_config_vars()['LDSHARED']

Edited function get_lib_suffix with
else:  # shared
        if platform_system == 'Windows':
            return '.dll'
        elif platform_system == 'Darwin':
        	return '.dylib'
        else:
            return '.so'

Despite all the changes I am stuck on this error:
-- ZSTD VERSION: 1.4.5
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
Consolidate compiler generated dependencies of target zlibstatic
Consolidate compiler generated dependencies of target libzstd_static
[ 18%] Built target zlibstatic
[ 55%] Built target libzstd_static
Consolidate compiler generated dependencies of target seal
[100%] Built target seal
building 'Afhel' shared library
g++-12: error: -bundle not allowed with -dynamiclib
error: command '/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12' failed with exit code 1

Not sure how to get rid of the "extra" -bundle linker option

Can you execute python setup.py build -v? this way we should see the entire compilation command, and maybe understand where is this bundle added. You can skip everything before the [100%] Built target seal, since it seems SEAL is compiling correctly.

Not getting any extra information with verbose argument.

python setup.py -v build? wrong order in the -v!

Delete the build directory before running and try again

Yup tried it, no luck!
Regards,
Devharsh.
On Jul 11, 2022, at 12:17 PM, Alberto Ibarrondo @.@.>> wrote:
Delete the build directory before running and try again
—
Reply to this email directly, view it on GitHubhttps://github.com/ibarrond/Pyfhel/issues/131#issuecomment-1180608046, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AATLUPV7OBLVV7PQDLKJ6ULVTRCKPANCNFSM52PI4QTQ.
You are receiving this because you authored the thread.Message ID: @.***>

Mmmmm, we're stuck without proper compiler info. Maybe try running python setup.py -v build_ext, or create a virtualenv and install Pyfhel locally with pip install -v .

No luck :/
Is there any other way to print the arguments before and during the execution of self.compiler.compile() function in setup.py?

Mmmmm, what I did for the Windows installation is to debug the python setup.py build command. I personally use VS Code, thus I created a Run configuration in launch.json, making sure I unticked the "only debug my files" box somewhere.

An alternative would be to reuse the technique used for Windows: mock a cmake-based project to build Afhel.

% python3 setup.py build_ext --inplace
running build_ext
cimporting numpy version '1.21.2'
building 'Pyfhel.Pyfhel' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:885:10: fatal error: seal/plaintext.h: No such file or directory
  885 | #include "seal/plaintext.h"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/local/Cellar/gcc@12/12.1.0_1/bin/gcc-12' failed with exit code 1

% python3 setup.py build_ext --inplace
running build_ext
cimporting numpy version '1.21.2'
building 'Pyfhel.Pyfhel' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:885:10: fatal error: 'seal/plaintext.h' file not found
#include "seal/plaintext.h"
         ^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

What changed to solve the -dynamiclib issue?
Is the SEAL folder empty?
If not, I'm afraid you may have to run the full python setup.py build to get all the headers.
Could you run python setup.py -h or something like it to find the proper command for verbose output?

I've deleted that comment. I was just trying out workarounds.
No, the -dynamiclib issue is not solved.
The verbose command is invoked with -v by default.
% python3 setup.py -v
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
devharsh@Devharshs-MBP Pyfhel % python3 setup.py -h
Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)      run verbosely (default)
  --quiet (-q)        run quietly (turns verbosity off)
  --dry-run (-n)      don't actually do anything
  --help (-h)         show detailed help message
  --no-user-cfg       ignore pydistutils.cfg in your home directory
  --command-packages  list of packages that provide distutils commands

Information display options (just display information, ignore any commands)
  --help-commands     list all available commands
  --name              print package name
  --version (-V)      print package version
  --fullname          print <package name>-<version>
  --author            print the author's name
  --author-email      print the author's email address
  --maintainer        print the maintainer's name
  --maintainer-email  print the maintainer's email address
  --contact           print the maintainer's name if known, else the author's
  --contact-email     print the maintainer's email address if known, else the
                      author's
  --url               print the URL for this package
  --license           print the license of the package
  --licence           alias for --license
  --description       print the package description
  --long-description  print the long package description
  --platforms         print the list of platforms
  --classifiers       print the list of classifiers
  --keywords          print the list of keywords
  --provides          print the list of packages/modules provided
  --requires          print the list of packages/modules required
  --obsoletes         print the list of packages/modules made obsolete

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

I wrote a dummy setup.py and I could get rid of -bundle argument. Not sure why this doesn't work for Pyfhel.
Without modifications:
% python3 setup.py -v build_ext
running build_ext
creating build
creating build/temp.macosx-12-x86_64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c hello.c -o build/temp.macosx-12-x86_64-3.9/hello.o
creating build/lib.macosx-12-x86_64-3.9
clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk build/temp.macosx-12-x86_64-3.9/hello.o -o build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so

% file build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so
build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so: Mach-O 64-bit bundle x86_64

With modifications:
 % python3 setup.py -v build_ext --inplace
running build_ext
creating build
creating build/temp.macosx-12-x86_64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c hello.c -o build/temp.macosx-12-x86_64-3.9/hello.o
creating build/lib.macosx-12-x86_64-3.9
/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12 -Wl,-x -dynamiclib -undefined dynamic_lookup build/temp.macosx-12-x86_64-3.9/hello.o -o build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so

% file build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so
build/lib.macosx-12-x86_64-3.9/hello.cpython-39-darwin.so: Mach-O 64-bit dynamically linked shared library x86_64

My setup.py file:
from distutils.core import Extension, setup
from Cython.Build import cythonize

import os
import sysconfig

vars = sysconfig.get_config_vars()
sysconfig.get_config_vars()['BLDSHARED'] = vars['BLDSHARED'].replace('-bundle', '-dynamiclib')
sysconfig.get_config_vars()['LDCXXSHARED'] = vars['LDCXXSHARED'].replace('-bundle', '-dynamiclib')
sysconfig.get_config_vars()['LDSHARED'] = "/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12 -Wl,-x -dynamiclib -undefined dynamic_lookup"
sysconfig.get_config_vars()['CCSHARED'] = "-dynamiclib"
sysconfig.get_config_vars()['SO'] = ".dylib"
os.environ["LDSHARED"] = sysconfig.get_config_vars()['LDSHARED']

# define an extension that will be cythonized and compiled
ext = Extension(name="hello", sources=["hello.pyx"])
setup(ext_modules=cythonize(ext))

Why do you get the entire compiler command with the simple setup.py but not with Pyfhel's? I manage to get the output both in Windows and in Linux. Damm it.
Ok, it is a longshot, but I encourage you to try each of the modifications separately (just one environment variable at a time), to pinpoint which one is responsible for removing the -bundle from the compiler command.

sysconfig is useless.. os variable makes the changes os.environ["LDSHARED"] = "/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12 -Wl,-x -dynamiclib -undefined dynamic_lookup"

I may have solved the problem!!

% python3 setup.py build
running build
running build_py
running build_clib
building 'SEAL' cmake-based library
-- Build type (CMAKE_BUILD_TYPE): Release
-- The CXX compiler identification is GNU 12.1.0
-- The C compiler identification is GNU 12.1.0
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/Cellar/gcc@12/12.1.0_1/bin/gcc-12 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Microsoft SEAL debug mode: OFF
-- SEAL_USE_CXX17: ON
-- SEAL_BUILD_DEPS: ON
-- SEAL_USE_MSGSL: ON
-- Microsoft GSL: download ...
-- Found Git: /usr/local/bin/git (found version "2.37.1")
-- SEAL_USE_ZLIB: ON
-- ZLIB: download ...
CMake Deprecation Warning at thirdparty/zlib-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- SEAL_USE_ZSTD: ON
-- Zstandard: download ...
CMake Deprecation Warning at thirdparty/zstd-src/build/cmake/CMakeLists.txt:10 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- ZSTD VERSION: 1.4.5
-- Performing Test CXX_FLAG_STD_CPLUSPLUS11
-- Performing Test CXX_FLAG_STD_CPLUSPLUS11 - Success
-- Performing Test C_FLAG_STD_C99
-- Performing Test C_FLAG_STD_C99 - Success
-- Performing Test C_FLAG_WALL
-- Performing Test C_FLAG_WALL - Success
-- Performing Test CXX_FLAG_WALL
-- Performing Test CXX_FLAG_WALL - Success
-- Performing Test C_FLAG_WEXTRA
-- Performing Test C_FLAG_WEXTRA - Success
-- Performing Test CXX_FLAG_WEXTRA
-- Performing Test CXX_FLAG_WEXTRA - Success
-- Performing Test C_FLAG_WUNDEF
-- Performing Test C_FLAG_WUNDEF - Success
-- Performing Test CXX_FLAG_WUNDEF
-- Performing Test CXX_FLAG_WUNDEF - Success
-- Performing Test C_FLAG_WSHADOW
-- Performing Test C_FLAG_WSHADOW - Success
-- Performing Test CXX_FLAG_WSHADOW
-- Performing Test CXX_FLAG_WSHADOW - Success
-- Performing Test C_FLAG_WCAST_ALIGN
-- Performing Test C_FLAG_WCAST_ALIGN - Success
-- Performing Test CXX_FLAG_WCAST_ALIGN
-- Performing Test CXX_FLAG_WCAST_ALIGN - Success
-- Performing Test C_FLAG_WCAST_QUAL
-- Performing Test C_FLAG_WCAST_QUAL - Success
-- Performing Test CXX_FLAG_WCAST_QUAL
-- Performing Test CXX_FLAG_WCAST_QUAL - Success
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES
-- Performing Test C_FLAG_WSTRICT_PROTOTYPES - Success
-- CMAKE_INSTALL_PREFIX: /usr/local
-- CMAKE_INSTALL_LIBDIR: lib
-- ZSTD_LEGACY_SUPPORT not defined!
-- ZSTD_MULTITHREAD_SUPPORT is disabled
-- SEAL_USE_INTEL_HEXL: OFF
-- BUILD_SHARED_LIBS: OFF
-- SEAL_THROW_ON_TRANSPARENT_CIPHERTEXT: ON
-- SEAL_USE_GAUSSIAN_NOISE: OFF
-- SEAL_DEFAULT_PRNG: Blake2xb
-- x86intrin.h - found
-- SEAL_USE_INTRIN: ON
-- Performing Test SEAL_MEMSET_S_FOUND
-- Performing Test SEAL_MEMSET_S_FOUND - Success
-- Looking for explicit_bzero
-- Looking for explicit_bzero - not found
-- Looking for explicit_memset
-- Looking for explicit_memset - not found
-- SEAL_USE_MEMSET_S: ON
-- SEAL_USE_EXPLICIT_BZERO: OFF
-- SEAL_USE_EXPLICIT_MEMSET: OFF
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- SEAL_BUILD_SEAL_C: OFF
-- SEAL_BUILD_EXAMPLES: OFF
-- SEAL_BUILD_TESTS: OFF
-- SEAL_BUILD_BENCH: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devharsh/Downloads/Pyfhel/build/temp.macosx-12-x86_64-3.9/Pyfhel/SEAL
[  2%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/debug.c.o
[  2%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/adler32.o
[  3%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/compress.o
[  4%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/entropy_common.c.o
[  6%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/error_private.c.o
[  7%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/fse_decompress.c.o
[  8%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/crc32.o
[  9%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/deflate.o
[ 11%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzclose.o
[ 12%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/pool.c.o
[ 13%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/threading.c.o
[ 14%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/xxhash.c.o
[ 14%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzlib.o
[ 16%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzread.o
[ 17%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/common/zstd_common.c.o
[ 17%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/fse_compress.c.o
[ 18%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/gzwrite.o
[ 19%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/hist.c.o
[ 20%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inflate.o
[ 22%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/huf_compress.c.o
[ 23%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress.c.o
[ 24%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/infback.o
[ 25%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_literals.c.o
[ 27%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inftrees.o
[ 28%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_sequences.c.o
[ 29%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/inffast.o
[ 30%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_compress_superblock.c.o
[ 32%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/trees.o
[ 33%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_double_fast.c.o
[ 34%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/uncompr.o
[ 35%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_fast.c.o
[ 37%] Building C object thirdparty/zlib-src/CMakeFiles/zlibstatic.dir/zutil.o
[ 38%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_lazy.c.o
[ 39%] Linking C static library ../../lib/libz.a
[ 39%] Built target zlibstatic
[ 40%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_ldm.c.o
[ 40%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstd_opt.c.o
[ 41%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/compress/zstdmt_compress.c.o
[ 43%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/huf_decompress.c.o
[ 44%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_ddict.c.o
[ 45%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_decompress.c.o
[ 46%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/decompress/zstd_decompress_block.c.o
[ 48%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/cover.c.o
[ 49%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/divsufsort.c.o
[ 50%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/fastcover.c.o
[ 51%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/dictBuilder/zdict.c.o
[ 53%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_common.c.o
[ 53%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_compress.c.o
[ 54%] Building C object thirdparty/zstd-src/build/cmake/lib/CMakeFiles/libzstd_static.dir/__/__/__/lib/deprecated/zbuff_decompress.c.o
[ 55%] Linking C static library ../../../../../lib/libzstd.a
[ 55%] Built target libzstd_static
[ 58%] Building CXX object CMakeFiles/seal.dir/native/src/seal/batchencoder.cpp.o
[ 58%] Building CXX object CMakeFiles/seal.dir/native/src/seal/ciphertext.cpp.o
[ 59%] Building CXX object CMakeFiles/seal.dir/native/src/seal/ckks.cpp.o
[ 60%] Building CXX object CMakeFiles/seal.dir/native/src/seal/context.cpp.o
[ 61%] Building CXX object CMakeFiles/seal.dir/native/src/seal/decryptor.cpp.o
[ 62%] Building CXX object CMakeFiles/seal.dir/native/src/seal/encryptionparams.cpp.o
[ 62%] Building CXX object CMakeFiles/seal.dir/native/src/seal/encryptor.cpp.o
[ 64%] Building CXX object CMakeFiles/seal.dir/native/src/seal/evaluator.cpp.o
[ 65%] Building CXX object CMakeFiles/seal.dir/native/src/seal/keygenerator.cpp.o
[ 66%] Building CXX object CMakeFiles/seal.dir/native/src/seal/kswitchkeys.cpp.o
[ 67%] Building CXX object CMakeFiles/seal.dir/native/src/seal/memorymanager.cpp.o
[ 69%] Building CXX object CMakeFiles/seal.dir/native/src/seal/modulus.cpp.o
[ 70%] Building CXX object CMakeFiles/seal.dir/native/src/seal/plaintext.cpp.o
[ 71%] Building CXX object CMakeFiles/seal.dir/native/src/seal/randomgen.cpp.o
[ 72%] Building CXX object CMakeFiles/seal.dir/native/src/seal/serialization.cpp.o
[ 74%] Building CXX object CMakeFiles/seal.dir/native/src/seal/valcheck.cpp.o
[ 75%] Building C object CMakeFiles/seal.dir/native/src/seal/util/blake2b.c.o
[ 75%] Building C object CMakeFiles/seal.dir/native/src/seal/util/blake2xb.c.o
[ 76%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/clipnormal.cpp.o
[ 77%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/common.cpp.o
[ 79%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/croots.cpp.o
[ 80%] Building C object CMakeFiles/seal.dir/native/src/seal/util/fips202.c.o
[ 81%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/globals.cpp.o
[ 82%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/galois.cpp.o
[ 83%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/hash.cpp.o
[ 85%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/iterator.cpp.o
[ 86%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/mempool.cpp.o
[ 87%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/numth.cpp.o
[ 87%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/polyarithsmallmod.cpp.o
[ 88%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/rlwe.cpp.o
[ 90%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/rns.cpp.o
[ 91%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/scalingvariant.cpp.o
[ 92%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/ntt.cpp.o
[ 93%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/streambuf.cpp.o
[ 95%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarith.cpp.o
[ 96%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarithmod.cpp.o
[ 97%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintarithsmallmod.cpp.o
[ 98%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/uintcore.cpp.o
[100%] Building CXX object CMakeFiles/seal.dir/native/src/seal/util/ztools.cpp.o
[100%] Linking CXX static library lib/libseal-3.7.a
[100%] Built target seal
building 'Afhel' shared library
line 417
429
running build_ext
cimporting numpy version '1.21.2'
building 'Pyfhel.Pyfhel' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_vec_to_array_i(std::vector<long long int>, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:8935:33: warning: comparison of integer expressions of different signedness: '__pyx_t_6Pyfhel_5Afhel_5Afhel_int64_t' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
 8935 |   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyArrayObject* __pyx_f_6Pyfhel_6Pyfhel_vec_to_array_f(std::vector<double>, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:9193:33: warning: comparison of integer expressions of different signedness: '__pyx_t_6Pyfhel_5Afhel_5Afhel_int64_t' {aka 'long long int'} and 'std::vector<double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
 9193 |   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py_int(const std::vector<int>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:42995:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
42995 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py___pyx_t_6Pyfhel_5Afhel_5Afhel_int64_t(const std::vector<long long int>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43323:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43323 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py_double(const std::vector<double>&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43454:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43454 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __pyx_convert_vector_to_py___pyx_t_6Pyfhel_5Afhel_5Afhel_cy_complex(const std::vector<std::complex<double> >&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:43659:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
43659 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'PyObject* __Pyx_Import(PyObject*, PyObject*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:67470:31: warning: comparing the result of pointer addition '(((const char*)"Pyfhel.Pyfhel") + 6)' and NULL [-Waddress]
67470 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp: In function 'scheme_t __pyx_f_6Pyfhel_6Pyfhel_6Pyfhel_get_scheme(__pyx_obj_6Pyfhel_6Pyfhel_Pyfhel*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:37404:10: warning: '__pyx_r' may be used uninitialized [-Wmaybe-uninitialized]
37404 |   return __pyx_r;
      |          ^~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/Pyfhel.cpp:37301:34: note: '__pyx_r' was declared here
37301 |   __PYX_ENUM_CLASS_DECL scheme_t __pyx_r;
      |                                  ^~~~~~~
building 'Pyfhel.PyCtxt' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.cpp: In function 'PyObject* __Pyx_Import(PyObject*, PyObject*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyCtxt.cpp:36881:31: warning: comparing the result of pointer addition '(((const char*)"Pyfhel.PyCtxt") + 6)' and NULL [-Waddress]
36881 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
building 'Pyfhel.PyPtxt' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.cpp: In function 'PyObject* __Pyx_Import(PyObject*, PyObject*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPtxt.cpp:30264:31: warning: comparing the result of pointer addition '(((const char*)"Pyfhel.PyPtxt") + 6)' and NULL [-Waddress]
30264 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
building 'Pyfhel.PyPoly' extension
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.cpp: In function 'PyObject* __pyx_convert_vector_to_py___pyx_t_6Pyfhel_5Afhel_5Afhel_cy_complex(const std::vector<std::complex<double> >&)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.cpp:11991:33: warning: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
11991 |   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      |                       ~~~~~~~~~~^~~~~~~~~~~
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.cpp: In function 'PyObject* __Pyx_Import(PyObject*, PyObject*, int)':
/Users/devharsh/Downloads/Pyfhel/Pyfhel/PyPoly.cpp:30991:31: warning: comparing the result of pointer addition '(((const char*)"Pyfhel.PyPoly") + 6)' and NULL [-Waddress]
30991 |             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

% pip install .
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Processing /Users/devharsh/Downloads/Pyfhel
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.20 in /Users/devharsh/Library/Python/3.9/lib/python/site-packages (from Pyfhel==3.1.4) (1.21.2)
Building wheels for collected packages: Pyfhel
  Building wheel for Pyfhel (pyproject.toml) ... done
  Created wheel for Pyfhel: filename=Pyfhel-3.1.4-cp39-cp39-macosx_12_0_x86_64.whl size=3746175 sha256=be7a01d2de8c51078cf8d0f7e47385a44a5cd8dcae1a8de08a754d8de4d9b233
  Stored in directory: /private/var/folders/wh/tdg0ff9s1wl59234d5l27_gc0000gn/T/pip-ephem-wheel-cache-96869oqw/wheels/21/b6/ac/ae55455449e01c15c13ad01ce9fb783ae5042fe57bb57de828
Successfully built Pyfhel
Installing collected packages: Pyfhel
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed Pyfhel-3.1.4

Not sure how to import it though --
% ls ../build/lib.macosx-12-x86_64-3.9/Pyfhel/
PyCtxt.cpython-39-darwin.so	Pyfhel.cpython-39-darwin.so	libseal-3.7.a			test.py
PyPoly.cpython-39-darwin.so	__init__.py			libz.a				utils
PyPtxt.cpython-39-darwin.so	libAfhel.dylib			libzstd.a

% python3 Demo_1_HelloWorld.py
Traceback (most recent call last):
  File "/Users/devharsh/Downloads/Pyfhel/Demo_1_HelloWorld.py", line 18, in <module>
    from Pyfhel import Pyfhel
  File "/Users/devharsh/Downloads/Pyfhel/Pyfhel/__init__.py", line 1, in <module>
    from .Pyfhel import Pyfhel
ModuleNotFoundError: No module named 'Pyfhel.Pyfhel'

Amazing! What was it? I'm extremely curious! What a relentless job
For the missing copy (libAfhel.dylib), we may have to tweak something to make it automatic.
I'm currenty preparing a full battery of tests, but for the time being... could you run all the Demos? (alternatively, creating the docs will to it for you)

Everything seems OK!!
I did not want to debug and stop whatever service, so I would say 5bis is not fully tested!!
% python3 Demo_5bis_CS_Server.py
 * Serving Flask app 'Demo_5bis_CS_Server' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Address already in use
Port 5000 is in use by another program. Either identify and stop that program, or start the server with a different port.
On macOS, try disabling the 'AirPlay Receiver' service from System Preferences -> Sharing.

Tested on Intel-based (x86_64) MacBook, not tested on M1/M2 (ARM)
Apple Clang does not support -fopenmp and -libseal, use GCC or CLANG

% git clone --recursive https://github.com/ibarrond/Pyfhel

2.a) create requirements.txt file
  "setuptools<=60.9",
  "wheel",
  "cython>=3.0.0a9",
  "numpy>=1.20",
  "cmake>=3.15",
  "toml>=0.10"

2.b) % pip install -r requirements.txt

edit pyproject.toml

Line #111 [Afhel]
extra_compile_args

{Darwin = ["-std=c++17","-O3","-fopenmp"]},

extra_link_args

{Darwin = ["-fopenmp","-dynamiclib"]},

Repeat the above for [CYTHON EXTENSIONS]

edit Pyfhel/Afhel/Afhel.pxd

#from numpy cimport int64_t, uint64_t, uint8_t

ctypedef long long int64_t
ctypedef unsigned long long uint64_t
ctypedef unsigned char uint8_t

edit Pyfhel/Pyfhel.pxd

#from numpy cimport int64_t, uint64_t

ctypedef long long int64_t
ctypedef unsigned long long uint64_t

edit setup.py

add these lines immediately after imports
os.environ["CC"] = "/usr/local/Cellar/gcc@12/12.1.0_1/bin/gcc-12"
os.environ["CXX"] = "/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12"
os.environ["LDSHARED"] = "/usr/local/Cellar/gcc@12/12.1.0_1/bin/g++-12 -Wl,-x -dynamiclib -undefined dynamic_lookup"

Comment Line # 36-38 in setup.py:
#if platform_system == 'Darwin': # MacOS
    #raise SystemError("Pyfhel is not supported in MacOS (see issue #59)."
                      #"Please use a Linux VM or Docker.")

edit # Auxiliary methods
def get_lib_suffix(lib_type: str) -> str:
    if lib_type == 'static':
        if platform_system == 'Windows':
            return '.lib'
        else:
            return '.a'
    else:  # shared
        if platform_system == 'Windows':
            return '.dll'
        elif platform_system == 'Darwin':
        	return '.dylib'
        else:
            return '.so'

Build and install:
% python3 setup.py build
% pip install .
% cp ../build/lib.macosx-12-x86_64-3.9/Pyfhel/libAfhel.dylib /usr/local/lib/libAfhel.dylib

Oh, no worries about Demo_5bis, it is not meant to be run in isolation! (missing some docs on it).
Wonderful! I'll ask you to test a few more things to make sure we get to a pull request that is as generic as possible.

sure
Best,
Devharsh.
On Jul 16, 2022, at 6:33 PM, Alberto Ibarrondo @.***> wrote:

Oh, no worries about Demo_5bis, it is not meant to be run in isolation! (missing some docs on it).
Wonderful! I'll ask you to test a few more things to make sure we get to a pull request that is as generic as possible.
—
Reply to this email directly, view it on GitHubhttps://github.com/ibarrond/Pyfhel/issues/131#issuecomment-1186312296, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AATLUPRQJJCUJLKBHB47GN3VUM2EFANCNFSM52PI4QTQ.
You are receiving this because you authored the thread.Message ID: @.***>

@devharsh Here we are again! My current issue for MacOs is that I tried (and so far failed) to install llvm's CLANG in MacOs and set it as default compiler.
You did it on your side setting environment variables via Python using os.environ, but I am trying to configure the compiler outside of the setup.py, with the idea of adding a section in the README documenting the steps to install a compiler on suitable each platform. That being said, this is the current status:

You can find here the setup steps I added to try and install it in the VM:
https://github.com/ibarrond/Pyfhel/blob/becce6b9a3ffce17d507c0ee1ec1080af57ed419/.github/workflows/pytest-coverage.yml#L28-L35

You can find here the failed build:
https://github.com/ibarrond/Pyfhel/actions/runs/3594470328/jobs/6052770030

I believe it defaults to Apple Clang instead of LLVM Clang. The error is thrown for fopenmp. Apple Clang does not support -fopenmp and -libseal options. That's why I used GNU GCC / LLVM Clang.
Better set a variable like os.environ["gcc"] or os.environ["pyfhel-clang"] to point to your choice of compiler and use it inside setup.py. This works and is a better option as you change the "CC" variable for the session.
Installing GCC and LLVM is easy with Homebrew -- brew install gcc llvm.

Still struggling with LLVM Clang. The latest error I get is:
ld: symbol(s) not found for architecture x86_64

Did you manage to build Pyfhel with LLVM clang? or just with GCC?

Are you using the new M1/M2 (ARM) model? I have Intel (2019) model. It works for both LLVM and GCC.
Please see my comment -- https://github.com/ibarrond/Pyfhel/issues/131#issuecomment-1186272554

Honestly I don't know what I'm using, I'm just trying to build Pyfhel in the default macos-latest container provided by Github Actions. Any way we can make it work there?

It looks like you are on x86_64 platform (Ref. https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners)
Hardware specification for macOS virtual machines:

3-core CPU (x86_64)
14 GB of RAM
14 GB of SSD space

Regards,
Devharsh.
On Dec 15, 2022, at 3:40 AM, Alberto Ibarrondo @.***> wrote:
Honestly I don't know what I'm using, I'm just trying to build Pyfhel in the default macos-latest container provided by Github Actions. Any way we can make it work there?
—
Reply to this email directly, view it on GitHubhttps://github.com/ibarrond/Pyfhel/issues/131#issuecomment-1352726256, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AATLUPVIO54OGCAFWM46K4LWNLKP5ANCNFSM52PI4QTQ.
You are receiving this because you were mentioned.Message ID: @.***>

Great work!! Congratulations 🍾🎊
Sent from my iPad
On Feb 9, 2023, at 11:40 AM, Alberto Ibarrondo @.***> wrote:

It finally worked! 5c82163https://github.com/ibarrond/Pyfhel/commit/5c82163d20ba92f1e62035dd655c0c8939e76700
Closing!
—
Reply to this email directly, view it on GitHubhttps://github.com/ibarrond/Pyfhel/issues/131#issuecomment-1424487442, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AATLUPVDZBU5THOQCUREJ7DWWUMYNANCNFSM52PI4QTQ.
You are receiving this because you were mentioned.Message ID: @.***>

authors: devharsh ibarrond

repo: ibarrond/Pyfhel