CTranslate2: Errors in compiling Python Wrapper on Raspberry Pi 4 - Implicit narrowing is not permitted

Hello,
I followed the guide from Installation — CTranslate2 3.24.0 documentation .

For sure it is my fault, but I am not a big expert of Python/c++ compilers.

I am using a RaspberryPi 4 with os Raspbian 64 bit

Linux myhost 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

The C++ library compiled fine, but I have an error on one file of the python wrapper: here the full output of python setup:


python setup.py bdist_wheel
running bdist_wheel
running build
running build_py
copying ctranslate2/extensions.py → build/lib.linux-aarch64-cpython-39/ctranslate2
copying ctranslate2/logging.py → build/lib.linux-aarch64-cpython-39/ctranslate2
copying ctranslate2/version.py → build/lib.linux-aarch64-cpython-39/ctranslate2
copying ctranslate2/init.py → build/lib.linux-aarch64-cpython-39/ctranslate2
copying ctranslate2/converters/opus_mt.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/openai_gpt2.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/opennmt_tf.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/converter.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/transformers.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/marian.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/utils.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/opennmt_py.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/init.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/converters/fairseq.py → build/lib.linux-aarch64-cpython-39/ctranslate2/converters
copying ctranslate2/specs/model_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/wav2vec2_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/attention_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/common_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/whisper_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/transformer_spec.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/specs/init.py → build/lib.linux-aarch64-cpython-39/ctranslate2/specs
copying ctranslate2/models/init.py → build/lib.linux-aarch64-cpython-39/ctranslate2/models
running build_ext
building ‘ctranslate2._ext’ extension
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/execution_stats.cc -o build/temp.linux-aarch64-cpython-39/cpp/execution_stats.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/encoder.cc -o build/temp.linux-aarch64-cpython-39/cpp/encoder.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/generation_result.cc -o build/temp.linux-aarch64-cpython-39/cpp/generation_result.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/generator.cc -o build/temp.linux-aarch64-cpython-39/cpp/generator.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/logging.cc -o build/temp.linux-aarch64-cpython-39/cpp/logging.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/module.cc -o build/temp.linux-aarch64-cpython-39/cpp/module.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/scoring_result.cc -o build/temp.linux-aarch64-cpython-39/cpp/scoring_result.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/storage_view.cc -o build/temp.linux-aarch64-cpython-39/cpp/storage_view.o -std=c++17 -fvisibility=hidden
^[[A^[[AIn file included from /home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/detail/…/attr.h:13,
from /home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/detail/class.h:12,
from /home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:13,
from cpp/module.h:3,
from cpp/storage_view.cc:1:
/home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/detail/…/detail/common.h: In instantiation of ‘pybind11::ssize_t pybind11::ssize_t_cast(const IntType&) [with IntType = long long int; pybind11::ssize_t = int]’:
/home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/detail/…/detail/…/pytypes.h:2041:70: required from ‘pybind11::tuple::tuple(SzType) [with SzType = long long int; typename std::enable_if<std::is_integral<_Tp>::value, int>::type = 0]’
cpp/storage_view.cc:88:34: required from here
/home/pi/.local/lib/python3.9/site-packages/pybind11/include/pybind11/detail/…/detail/common.h:480:35: error: static assertion failed: Implicit narrowing is not permitted.
480 | static_assert(sizeof(IntType) <= sizeof(ssize_t), “Implicit narrowing is not permitted.”);
| ^~
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/translation_result.cc -o build/temp.linux-aarch64-cpython-39/cpp/translation_result.o -std=c++17 -fvisibility=hidden
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/.local/lib/python3.9/site-packages/pybind11/include -I/usr/include/python3.9 -c cpp/translator.cc -o build/temp.linux-aarch64-cpython-39/cpp/translator.o -std=c++17 -fvisibility=hidden
error: command ‘/usr/bin/arm-linux-gnueabihf-gcc’ failed with exit code 1


Do you have any hint? May depends by how I compiled the c++? Why only this file fails?

Thank you
Riccardo