anonlink icon indicating copy to clipboard operation
anonlink copied to clipboard

linux/arm64 wheel errors out with type error: ValueError: Buffer dtype mismatch, expected 'const char' but got 'signed char'

Open snazzer opened this issue 2 years ago • 0 comments

Building the library for use on arm64 on linux through docker raises a type error.

To reproduce, build the given Dockerfile in both amd64 and arm64 platforms

FROM python:3.9-slim-buster

RUN apt update -y
RUN apt install gcc g++ git -y

RUN git clone --branch v0.15.2 https://github.com/data61/anonlink.git

WORKDIR anonlink

RUN pip install -r requirements.txt && \
   pip install -e .

e.g. (I did this on an M1 mac)

$ docker build --platform=linux/amd64 -t anonlink-testcase:amd64 .
$ docker build --platform=linux/arm64 -t anonlink-testcase:arm64 .

Then running amd64 test

$ docker run --rm anonlink-testcase:amd64 pytest tests/test_popcount.py::test_popcnt_array
# passes

But with arm64

$ docker run --rm anonlink-testcase:arm64 pytest tests/test_popcount.py::test_popcnt_array
.....
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_popcount.py:29: in test_popcnt_array
    output_counts = _dice.popcount_arrays(carr, array_size)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   cpdef unsigned int[::1] popcount_arrays(const char[::1] input_data, unsigned int array_bytes = 128):
E   ValueError: Buffer dtype mismatch, expected 'const char' but got 'signed char'

anonlink/similarities/_dice.pyx:13: ValueError
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_popcnt_array(
    data=data(...), num_bytes=2048,
)
....

Would appreciate some guidance for a fix.

snazzer avatar Mar 28 '23 02:03 snazzer