8000 Porting to Allegro CL 11 / MacOS 14 / Apple silicon (M2) · Issue #13 · digikar99/py4cl2-cffi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Porting to Allegro CL 11 / MacOS 14 / Apple silicon (M2) #13
Open
@LEHunter

Description

@LEHunter

As a happy user of py4cl2 who wants to move some large arrays around, I thought I might try porting py4cl2-cffi to Allegro CL 11 / MacOS 14 / Apple silicon (M2). I've made some progress, but also hit a dead end. I'm trying to install via quicklisp.

First issue was this error:

While file-compiling #'"An Anonymous Function"
in
#P"/Users/hunter/quicklisp/dists/quicklisp/software/py4cl2-cffi-20231021-git/src/numpy-installed-p.lisp"
; between file character positions 0 (inclusively) and 3 (exclusively):
Error: Package "CL" not found.

The file just contains "CL:T". ACL doesn't define CL, and T is defined in every package. I'm using a case sensitive lisp, so I just replaced the contents of the file with "t". Works, although I'm not sure how that file gets created, so can't completely fix things.

Next up was

Subprocess with command "gcc -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -I'/Users/hunter/quicklisp/dists/quicklisp/software/py4cl2-cffi-20231021-git/src/' -c -Wall -Werror -fpic py4cl-utils.c && gcc -shared -o libpy4cl-utils.so py4cl-utils.o"
exited with error code 1

Not sure what configuration changes would be necessary to run this in the correct directory, but compiling manually after substituting the full pathname "~/quicklisp/dists/quicklisp/software/py4cl2-cffi-20231021-git/src/py4cl-utils.c" worked.

Next problem was that modern MacOS doesn't provide endian.h So, following https://stackoverflow.com/questions/20813028/endian-h-not-found-on-mac-osx/52904079#52904079 I put https://gist.github.com/dendisuhubdy/19482135d26da86cdcf442b3724e0728 into /usr/local/include/endian.h and that worked.

Next problem was that the includes of numpy/ndarraytypes.h and numpy/arrayobject.h in py4cl-utils.c failed. I used (py4cl2:raw-pyeval "np.get_include()") to discover that the files were in ~/mambaforge/lib/python3.10/site-packages/numpy/core/include" so I could fix that manually, but didn't actually fix the configuration issue.

Finally, the linker complained about a bunch of missing symbols for the arm64 architecture, and here I am out of my depth. Error is below, any suggestions much appreciated.

gcc -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -I/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12 -I'/Users/hunter/quicklisp/dists/quicklisp/software/py4cl2-cffi-20231021-git/src/' -c -Wall -Werror -fpic py4cl-utils.c && gcc -shared -o libpy4cl-utils.so py4cl-utils.o
Undefined symbols for architecture arm64:
"_PyCapsule_GetPointer", referenced from:
__import_array in py4cl-utils.o
"_PyCapsule_Type", referenced from:
__import_array in py4cl-utils.o
"_PyErr_Format", referenced from:
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
"_PyErr_Print", referenced from:
_import_numpy in py4cl-utils.o
"_PyErr_SetString", referenced from:
_import_numpy in py4cl-utils.o
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
"_PyExc_AttributeError", referenced from:
__import_array in py4cl-utils.o
"_PyExc_ImportError", referenced from:
_import_numpy in py4cl-utils.o
"_PyExc_RuntimeError", referenced from:
__import_array in py4cl-utils.o
"_PyImport_ImportModule", referenced from:
__import_array in py4cl-utils.o
"_PyObject_GetAttrString", referenced from:
__import_array in py4cl-utils.o
"__Py_Dealloc", referenced from:
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
__import_array in py4cl-utils.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
src %

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0