From 047bd794239a04b16f0f72b3c5805aeb73fcaee9 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Thu, 19 Sep 2024 15:52:55 +0200 Subject: [PATCH] pymeshlab can be built on linux aarch64 architecture --- .devcontainer/Dockerfile_aarch64 | 77 +++++++++++++++++++ .../{Dockerfile => Dockerfile_x86_64} | 0 .../devcontainer.json | 20 +++++ .../devcontainer.json | 4 +- .../devcontainer.json | 20 +++++ .../devcontainer.json | 4 +- .../devcontainer.json | 20 +++++ .../devcontainer.json | 4 +- .../build_wheel_3_8_aarch64/devcontainer.json | 20 +++++ .../devcontainer.json | 4 +- .../build_wheel_3_9_aarch64/devcontainer.json | 20 +++++ .../devcontainer.json | 4 +- .../develop_aarch64/devcontainer.json | 33 ++++++++ .../devcontainer.json | 4 +- setup.py | 4 +- 15 files changed, 225 insertions(+), 13 deletions(-) create mode 100644 .devcontainer/Dockerfile_aarch64 rename .devcontainer/{Dockerfile => Dockerfile_x86_64} (100%) create mode 100644 .devcontainer/build_wheel_3_10_aarch64/devcontainer.json rename .devcontainer/{build_wheel_3_10 => build_wheel_3_10_x86_64}/devcontainer.json (82%) create mode 100644 .devcontainer/build_wheel_3_11_aarch64/devcontainer.json rename .devcontainer/{build_wheel_3_11 => build_wheel_3_11_x86_64}/devcontainer.json (82%) create mode 100644 .devcontainer/build_wheel_3_12_aarch64/devcontainer.json rename .devcontainer/{build_wheel_3_12 => build_wheel_3_12_x86_64}/devcontainer.json (82%) create mode 100644 .devcontainer/build_wheel_3_8_aarch64/devcontainer.json rename .devcontainer/{build_wheel_3_8 => build_wheel_3_8_x86_64}/devcontainer.json (82%) create mode 100644 .devcontainer/build_wheel_3_9_aarch64/devcontainer.json rename .devcontainer/{build_wheel_3_9 => build_wheel_3_9_x86_64}/devcontainer.json (82%) create mode 100644 .devcontainer/develop_aarch64/devcontainer.json rename .devcontainer/{develop => develop_x86_64}/devcontainer.json (90%) diff --git a/.devcontainer/Dockerfile_aarch64 b/.devcontainer/Dockerfile_aarch64 new file mode 100644 index 0000000..dcf5ef4 --- /dev/null +++ b/.devcontainer/Dockerfile_aarch64 @@ -0,0 +1,77 @@ +# must use ubuntu:22.04 for qt 5.15 +FROM --platform=linux/aarch64 ubuntu:22.04 + +ENV DEBIAN_FRONTEND=noninteractive + +ARG USERNAME=pymeshlab +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +ARG PYTHON_VERSION=3.11 + +ENV LD_LIBRARY_PATH=/workspaces/pymeshlab/pymeshlab/lib/ + +RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install \ + build-essential \ + fontconfig \ + fuse \ + gdb \ + git \ + kmod \ + libboost-dev \ + libdbus-1-3 \ + libegl-dev \ + libfuse2 \ + libgmp-dev \ + libglu1-mesa-dev \ + libmpfr-dev \ + libpulse-mainloop-glib0 \ + libtbb-dev \ + libxerces-c-dev \ + patchelf \ + qtbase5-dev \ + qt5-qmake \ + rsync \ + # to be removed + unzip \ + wget + +# install python +RUN apt-get -y install software-properties-common && \ + add-apt-repository ppa:deadsnakes/ppa -y && apt-get -y update && \ + apt-get -y install python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-distutils && \ + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 && \ + wget https://bootstrap.pypa.io/get-pip.py && \ + python${PYTHON_VERSION} get-pip.py && \ + rm get-pip.py && \ + pip install numpy + +# install latest cmake and embree +RUN apt-get -y purge --auto-remove cmake && \ + wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.3-Linux-aarch64.tar.gz" \ + | tar --strip-components=1 -xz -C /usr/local &&\ + # wget -qO- "https://github.com/embree/embree/releases/download/v4.3.2/embree-4.3.2.x86_64.linux.tar.gz" \ + # | tar -xz -C /usr/local && \ + # bash /usr/local/embree-vars.sh && \ + wget -q "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux-aarch64.zip" && \ + unzip -o ninja-linux-aarch64.zip -d /usr/bin/ && \ + rm ninja-linux-aarch64.zip && \ + chmod +x /usr/bin/ninja && \ + apt-get -y remove wget unzip && \ + apt-get -y autoremove && \ + apt-get -y clean && \ + rm -rf /var/lib/apt/lists/* + +# Generating a universally unique ID for the Container +RUN dbus-uuidgen > /etc/machine-id + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # [Optional] Add sudo support. + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile_x86_64 similarity index 100% rename from .devcontainer/Dockerfile rename to .devcontainer/Dockerfile_x86_64 diff --git a/.devcontainer/build_wheel_3_10_aarch64/devcontainer.json b/.devcontainer/build_wheel_3_10_aarch64/devcontainer.json new file mode 100644 index 0000000..927c205 --- /dev/null +++ b/.devcontainer/build_wheel_3_10_aarch64/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "PyMeshLab aarch64 wheel for Python 3.10", + + "build": { + "dockerfile": "../Dockerfile_x86_64", + "args": { + "PYTHON_VERSION": "3.10" + } + }, + "runArgs": [ + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined" + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + "postStartCommand": "bash scripts/Linux/make_wheel.sh" +} \ No newline at end of file diff --git a/.devcontainer/build_wheel_3_10/devcontainer.json b/.devcontainer/build_wheel_3_10_x86_64/devcontainer.json similarity index 82% rename from .devcontainer/build_wheel_3_10/devcontainer.json rename to .devcontainer/build_wheel_3_10_x86_64/devcontainer.json index a479fb5..e956f7b 100644 --- a/.devcontainer/build_wheel_3_10/devcontainer.json +++ b/.devcontainer/build_wheel_3_10_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "PyMeshLab wheel for Python 3.10", + "name": "PyMeshLab x86_64 wheel for Python 3.10", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.10" } diff --git a/.devcontainer/build_wheel_3_11_aarch64/devcontainer.json b/.devcontainer/build_wheel_3_11_aarch64/devcontainer.json new file mode 100644 index 0000000..7e41c81 --- /dev/null +++ b/.devcontainer/build_wheel_3_11_aarch64/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "PyMeshLab aarch64 wheel for Python 3.11", + + "build": { + "dockerfile": "../Dockerfile_x86_64", + "args": { + "PYTHON_VERSION": "3.11" + } + }, + "runArgs": [ + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined" + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + "postStartCommand": "bash scripts/Linux/make_wheel.sh" +} \ No newline at end of file diff --git a/.devcontainer/build_wheel_3_11/devcontainer.json b/.devcontainer/build_wheel_3_11_x86_64/devcontainer.json similarity index 82% rename from .devcontainer/build_wheel_3_11/devcontainer.json rename to .devcontainer/build_wheel_3_11_x86_64/devcontainer.json index ff99718..e081fc3 100644 --- a/.devcontainer/build_wheel_3_11/devcontainer.json +++ b/.devcontainer/build_wheel_3_11_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "PyMeshLab wheel for Python 3.11", + "name": "PyMeshLab x86_64 wheel for Python 3.11", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.11" } diff --git a/.devcontainer/build_wheel_3_12_aarch64/devcontainer.json b/.devcontainer/build_wheel_3_12_aarch64/devcontainer.json new file mode 100644 index 0000000..ed45da5 --- /dev/null +++ b/.devcontainer/build_wheel_3_12_aarch64/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "PyMeshLab aarch64 wheel for Python 3.12", + + "build": { + "dockerfile": "../Dockerfile_x86_64", + "args": { + "PYTHON_VERSION": "3.12" + } + }, + "runArgs": [ + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined" + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + "postStartCommand": "bash scripts/Linux/make_wheel.sh" +} \ No newline at end of file diff --git a/.devcontainer/build_wheel_3_12/devcontainer.json b/.devcontainer/build_wheel_3_12_x86_64/devcontainer.json similarity index 82% rename from .devcontainer/build_wheel_3_12/devcontainer.json rename to .devcontainer/build_wheel_3_12_x86_64/devcontainer.json index ab8f125..d70e50f 100644 --- a/.devcontainer/build_wheel_3_12/devcontainer.json +++ b/.devcontainer/build_wheel_3_12_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "PyMeshLab wheel for Python 3.12", + "name": "PyMeshLab x86_64 wheel for Python 3.12", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.12" } diff --git a/.devcontainer/build_wheel_3_8_aarch64/devcontainer.json b/.devcontainer/build_wheel_3_8_aarch64/devcontainer.json new file mode 100644 index 0000000..e156cfc --- /dev/null +++ b/.devcontainer/build_wheel_3_8_aarch64/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "PyMeshLab aarch64 wheel for Python 3.8", + + "build": { + "dockerfile": "../Dockerfile_x86_64", + "args": { + "PYTHON_VERSION": "3.8" + } + }, + "runArgs": [ + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined" + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + "postStartCommand": "bash scripts/Linux/make_wheel.sh" +} \ No newline at end of file diff --git a/.devcontainer/build_wheel_3_8/devcontainer.json b/.devcontainer/build_wheel_3_8_x86_64/devcontainer.json similarity index 82% rename from .devcontainer/build_wheel_3_8/devcontainer.json rename to .devcontainer/build_wheel_3_8_x86_64/devcontainer.json index a03f031..eedc8e1 100644 --- a/.devcontainer/build_wheel_3_8/devcontainer.json +++ b/.devcontainer/build_wheel_3_8_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "PyMeshLab wheel for Python 3.8", + "name": "PyMeshLab x86_64 wheel for Python 3.8", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.8" } diff --git a/.devcontainer/build_wheel_3_9_aarch64/devcontainer.json b/.devcontainer/build_wheel_3_9_aarch64/devcontainer.json new file mode 100644 index 0000000..77973fc --- /dev/null +++ b/.devcontainer/build_wheel_3_9_aarch64/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "PyMeshLab aarch64 wheel for Python 3.9", + + "build": { + "dockerfile": "../Dockerfile_x86_64", + "args": { + "PYTHON_VERSION": "3.9" + } + }, + "runArgs": [ + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined" + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + "postStartCommand": "bash scripts/Linux/make_wheel.sh" +} \ No newline at end of file diff --git a/.devcontainer/build_wheel_3_9/devcontainer.json b/.devcontainer/build_wheel_3_9_x86_64/devcontainer.json similarity index 82% rename from .devcontainer/build_wheel_3_9/devcontainer.json rename to .devcontainer/build_wheel_3_9_x86_64/devcontainer.json index 3230d0b..7e2d068 100644 --- a/.devcontainer/build_wheel_3_9/devcontainer.json +++ b/.devcontainer/build_wheel_3_9_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "PyMeshLab wheel for Python 3.9", + "name": "PyMeshLab x86_64 wheel for Python 3.9", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.9" } diff --git a/.devcontainer/develop_aarch64/devcontainer.json b/.devcontainer/develop_aarch64/devcontainer.json new file mode 100644 index 0000000..59c40da --- /dev/null +++ b/.devcontainer/develop_aarch64/devcontainer.json @@ -0,0 +1,33 @@ +{ + "name": "Develop PyMeshLab aarch64", + + "build": { + "dockerfile": "../Dockerfile_aarch64", + "args": { + "PYTHON_VERSION": "3.12" + } + }, + "runArgs": [ + "-ti", + "-v", "/lib/modules:/lib/modules", + "--device", "/dev/fuse", + "--cap-add", "SYS_ADMIN", + "--security-opt", "apparmor=unconfined", + ], + "workspaceFolder": "/workspaces/pymeshlab", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/pymeshlab,type=bind", + + // vscode extensions + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.cmake-tools" + ], + "settings": { + "cmake.buildDirectory": "${workspaceFolder}/build", + } + } + } +} \ No newline at end of file diff --git a/.devcontainer/develop/devcontainer.json b/.devcontainer/develop_x86_64/devcontainer.json similarity index 90% rename from .devcontainer/develop/devcontainer.json rename to .devcontainer/develop_x86_64/devcontainer.json index ced6fc7..cdabf1f 100644 --- a/.devcontainer/develop/devcontainer.json +++ b/.devcontainer/develop_x86_64/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "Develop PyMeshLab", + "name": "Develop PyMeshLab x86_64", "build": { - "dockerfile": "../Dockerfile", + "dockerfile": "../Dockerfile_x86_64", "args": { "PYTHON_VERSION": "3.12" } diff --git a/setup.py b/setup.py index 5154fea..0dacab7 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,9 @@ def get_tag(self): platform_tag = 'win_amd64' elif platform.system() == 'Linux': arch = sysconfig.get_platform().split('-')[1] - platform_tag = 'manylinux_2_31_' + arch + glibc_version = os.popen('ldd --version').read().split('\n')[0].split()[-1] + glibc_version = glibc_version.replace('.', '_') + platform_tag = 'manylinux_' + glibc_version + '_' + arch elif platform.system() == 'Darwin': arch = platform.machine() pltf = 'macosx_11_0_x86_64'