ocrd_segment
ocrd_segment copied to clipboard
Build fails for MacOS (ocrd-fork-pycocotools)
Running make all for ocrd_all or pip install . for ocrd_segment fails on MacOS with Homebrew:
Compiling pycocotools/_mask.pyx because it changed.
[1/1] Cythonizing pycocotools/_mask.pyx
/private/var/folders/wf/g2hmm5bd72v2r_p0r1smct_00000gn/T/pip-install-0xp4jh31/ocrd-fork-pycocotools_7b0159a305264f708a622a0e4daa80bd/.eggs/Cython-3.0.0a11-py3.9.egg/Cython/Compiler/Main.py:345: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /private/var/folders/wf/g2hmm5bd72v2r_p0r1smct_00000gn/T/pip-install-0xp4jh31/ocrd-fork-pycocotools_7b0159a305264f708a622a0e4daa80bd/pycocotools/_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
creating build/common
creating build/temp.macosx-12-arm64-cpython-39
creating build/temp.macosx-12-arm64-cpython-39/common
creating build/temp.macosx-12-arm64-cpython-39/pycocotools
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/OCR-D/venv-20221112/lib/python3.9/site-packages/numpy/core/include -I./common -I/OCR-D/venv-20221112/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c ../common/maskApi.c -o build/temp.macosx-12-arm64-cpython-39/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
clang: error: no such file or directory: '../common/maskApi.c'
clang: error: no input files
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ocrd-fork-pycocotools
No idea. Note that ocrd-fork-pycocotools is https://github.com/bertsky/cocoapi – I only added a few fixes.
Meanwhile, I have merged from upstream. Please try again now (I have made a release 2.0.6.post1).
If it does not work, please try out upstream https://github.com/ppwwyyxx/cocoapi directly (make -C PythonAPI), and perhaps open an issue there.
python -m pip install --use-feature=in-tree-build does not work there. Just python -m pip install . is fine.
I don't know what in-tree-build is.
So you are saying that MacOS works if you install manually? Or that you can pip install from the new src tarball on PyPI?
The failing command is here and is also wrong in upstream.
Ah, got it. Hard to tell from here. But could you try python setup.py build_ext install (which is in upstream's upstream)?
Another thing you could try: setting ARCHFLAGS="-arch x86_64" during compilation.
Why? I don't want to build for x86_64 on my M1.