InsightSoftwareConsortium / ITKPythonPackage

A setup script to generate ITK Python Wheels
https://itkpythonpackage.readthedocs.io
Apache License 2.0
64 stars 22 forks source link

Support for Linux glibc 2.27 aarch64 #270

Open john-bergelin opened 5 months ago

john-bergelin commented 5 months ago

The ITKPythonBuilds release 5.3.0 doesn't include a build for manylinux2014_aarch64. How would I go about if I wanted to build a module for an aarch64 system running Ubuntu 18.04 with glibc 2.7?

thewtex commented 5 months ago

Hi there @john-bergelin ,

There are manylinux2014 and musl Linux aarch64 images here:

https://quay.io/organization/pypa

Python packages built with these toolchains should work on an Ubuntu 18.04 system with glibc 2.7.

More specifics, directed towards the 5.4rc3 packages, on how the manylinux 2_28 aarch64 packages are built can be found here:

https://github.com/InsightSoftwareConsortium/ITK/pull/4566/files

john-bergelin commented 5 months ago

Hi @thewtex, Thanks for pointing me in the right direction!

I've tried building the python packages a couple of times now with these steps:

git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git
cd ITKPythonPackage
git reset --hard HEAD
git checkout release
git pull origin release
sudo git clean -fdx
sudo rm -rf ITK-source
git fetch origin manylinux2014
git cherry-pick origin/manylinux2014
docker run --privileged --rm tonistiigi/binfmt --install all
docker run -it -v $(pwd):/work/ quay.io/pypa/manylinux2014_aarch64:2024-03-25-9206bd9 bash
cd /work
pipx upgrade cmake
yum install sudo

./scripts/internal/manylinux-build-wheels.sh cp39

But it always fails when trying to generate iktFixedArrayPython with this message:

[2757/6010] Generating itkFixedArrayPython.cpp, ../../Generators/Python/itk/itkFixedArrayPython.py
FAILED: Wrapping/Modules/ITKCommon/itkFixedArrayPython.cpp Wrapping/Generators/Python/itk/itkFixedArrayPython.py /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Modules/ITKCommon/itkFixedArrayPython.cpp /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/Python/itk/itkFixedArrayPython.py
cd /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Typedefs/python && /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig -c++ -python -fastdispatch -fvirtual -features autodoc=2 -doxygen -Werror -w302 -w303 -w312 -w314 -w361 -w362 -w350 -w383 -w384 -w389 -w394 -w395 -w467 -w508 -w509 -o /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Modules/ITKCommon/itkFixedArrayPython.cpp -I/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/share/swig/4.3.0/python -I/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/share/swig/4.3.0 -I/work/ITK-source/ITK/Wrapping/Generators -I/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Typedefs/python -I/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Typedefs -outdir /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/Python/itk /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Typedefs/itkFixedArray.i
/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig)
/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig)
/work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /work/ITK-cp39-cp39-manylinux2014_aarch64/Wrapping/Generators/SwigInterface/swiglinux-arm64-2024-03-26-master/bin/swig)
[2770/6010] Run igenerator.py for ITKMesh
ninja: build stopped: subcommand failed.
+ exit 1

checking libstdc++.so.6 gives this:

[root@31d4c24ebed6 lib64]# strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

Any ideas on how I can add the other versions?

I've also tried without the "cp39" argument but it fails at the same spot. Or do you know if another image of manylinux2014 is better suited? I used the one from the same date as in the Release.md.

Cheers!

thewtex commented 5 months ago

Hi @john-bergelin,

A few pointers:

https://github.com/InsightSoftwareConsortium/ITK/blob/f383fe0a954620eccdaf69d649acf3fa5be8dc21/Wrapping/Generators/SwigInterface/CMakeLists.txt#L183-L231

A recent bison is also required. I had to build from source, if I recall correctly. You can get it from here: https://ftp.gnu.org/gnu/bison/. It is an old-school autotools build.

Please consider contributing the new swig binary if this is something you will want to update in the future.