Closed liam-ly closed 1 year ago
Expected vs actual behavior
Since there are no binaries for the Apple silicon or linux arm64 architectures, pip will install from sdist.
Building from sdist results in errors about missing header files
#5 622.8 crosshair/_tracers.c:18:10: fatal error: _tracers_pycompat.h: No such file or directory #5 622.8 18 | #include "_tracers_pycompat.h" #5 622.8 | ^~~~~~~~~~~~~~~~~~~~~
The repo is missing a MANIFEST.in or appropriate setup.py instructions that copies the header files to the sdist.
MANIFEST.in
setup.py
To Reproduce
Here is a multi-stage dockerfile that repros the issue (on arm64/aarch64 hardware, at least).
# arm64 fails to install from pypi FROM python:3.8 AS fail1 RUN pip3 install crosshair-tool # arm64 fails to build from source FROM python:3.8 AS fail2 WORKDIR /root RUN git clone https://github.com/pschanely/CrossHair.git \ && cd CrossHair \ && python3 setup.py sdist \ && mkdir -p /root/crosshair-tool \ && tar xvf /root/CrossHair/dist/crosshair-tool-*.tar.gz -C /root/crosshair-tool --strip=1 WORKDIR /root/crosshair-tool RUN python3 setup.py bdist_wheel && pip3 install dist/*.whl # arm64 succeeds with MANIFEST.in file included FROM python:3.8 AS success WORKDIR /root RUN git clone https://github.com/pschanely/CrossHair.git \ && cd CrossHair \ && echo "graft crosshair" > MANIFEST.in \ && python3 setup.py sdist \ && mkdir -p /root/crosshair-tool \ && tar xvf /root/CrossHair/dist/crosshair-tool-*.tar.gz -C /root/crosshair-tool --strip=1 WORKDIR /root/crosshair-tool RUN python3 setup.py bdist_wheel && pip3 install dist/*.whl # Successfully built wheel installs FROM python:3.8 AS install_wheel COPY --from=success /root/crosshair-tool/dist/crosshair_tool-0.0.36-cp38-cp38-linux_aarch64.whl /crosshair_tool-0.0.36-cp38-cp38-linux_aarch64.whl RUN pip3 install /crosshair_tool-0.0.36-cp38-cp38-linux_aarch64.whl
Summary of outcomes
% docker build . --target fail1 --platform linux/arm64 -t crosshair ... #5 622.8 running build_ext #5 622.8 building '_crosshair_tracers' extension #5 622.8 creating build/temp.linux-aarch64-3.8 #5 622.8 creating build/temp.linux-aarch64-3.8/crosshair #5 622.8 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c crosshair/_tracers.c -o build/temp.linux-aarch64-3.8/crosshair/_tracers.o #5 622.8 crosshair/_tracers.c:18:10: fatal error: _tracers_pycompat.h: No such file or directory #5 622.8 18 | #include "_tracers_pycompat.h" #5 622.8 | ^~~~~~~~~~~~~~~~~~~~~ #5 622.8 compilation terminated. #5 622.8 error: command 'gcc' failed with exit status 1 #5 622.8 [end of output] ...
% docker build . --target fail2 --platform linux/arm64 # In `python3 setup.py sdist` step ... #8 0.485 running build_ext #8 0.488 building '_crosshair_tracers' extension #8 0.488 creating build/temp.linux-aarch64-3.8 #8 0.488 creating build/temp.linux-aarch64-3.8/crosshair #8 0.488 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.8 -c crosshair/_tracers.c -o build/temp.linux-aarch64-3.8/crosshair/_tracers.o #8 0.544 crosshair/_tracers.c:18:10: fatal error: _tracers_pycompat.h: No such file or directory #8 0.544 18 | #include "_tracers_pycompat.h" #8 0.544 | ^~~~~~~~~~~~~~~~~~~~~ #8 0.544 compilation terminated. #8 0.549 error: command 'gcc' failed with exit status 1 ...
% docker build . --target success --platform linux/arm64 # ... succeeds ... % docker run --rm -it crosshair find dist dist dist/crosshair_tool-0.0.36-cp38-cp38-linux_aarch64.whl
% docker build . --target install_wheel --platform linux/arm64 # ... succeeds ...
The simplest solution would be to add a MANIFEST.in file containing the single line
graft crosshair
Thank you for this detailed report!
I have a fix in v0.0.37 (and now perform build of the sdist on CI to prevent regression). Please do re-open this if it doesn't work for you!
Hope to hear more from you about how CrossHair does (or does not!) work for your use case 😄
Expected vs actual behavior
Since there are no binaries for the Apple silicon or linux arm64 architectures, pip will install from sdist.
Building from sdist results in errors about missing header files
The repo is missing a
MANIFEST.in
or appropriatesetup.py
instructions that copies the header files to the sdist.To Reproduce
Here is a multi-stage dockerfile that repros the issue (on arm64/aarch64 hardware, at least).
Summary of outcomes
The simplest solution would be to add a
MANIFEST.in
file containing the single line