Skip to content

Commit

Permalink
update for ubuntu 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjhogan committed Sep 7, 2024
1 parent 08023e4 commit 4e16a04
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu20.04
FROM nvidia/cuda:12.6.1-devel-ubuntu24.04

ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONUNBUFFERED 1
Expand All @@ -23,24 +23,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libsqlite3-dev \
libssl-dev \
libswscale-dev \
python-openssl \
tk-dev \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Patched version of patchelf for auditwheel
RUN git clone https://github.com/nvictus/patchelf.git --depth 1
RUN git clone https://github.com/NixOS/patchelf -b 0.18.0 --depth 1
WORKDIR $HOME/patchelf
RUN ./bootstrap.sh
RUN ./configure
RUN make
RUN make install

# Create batman user
RUN useradd -ms /bin/bash batman
USER batman
ENV HOME /home/batman
USER ubuntu
ENV HOME /home/ubuntu
WORKDIR $HOME

# Install python
Expand All @@ -50,7 +47,7 @@ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-instal
pyenv global 3.11.4 && \
pyenv rehash

RUN pip install --upgrade pip auditwheel==5.1.2 setuptools numpy scikit-build==0.17.6
RUN pip install --upgrade pip auditwheel==6.1.0 setuptools numpy scikit-build

VOLUME [ "/input", "/output" ]
WORKDIR /input
Expand All @@ -59,6 +56,7 @@ ENV ENABLE_HEADLESS=1
ENV CMAKE_ARGS="-DWITH_CUDA=ON -DCUDA_ARCH_BIN=6.1,7.5,8.6,8.9 -DWITH_OPENCL=OFF -DWITH_OPENCLAMDFFT=OFF -DWITH_OPENCLAMDBLAS=OFF -DOPENCV_DNN_OPENCL=OFF -DOPENCV_EXTRA_MODULES_PATH=/input/opencv_contrib/modules -DBUILD_SHARED_LIBS=ON -DBUILD_opencv_world=OFF"

CMD python setup.py bdist_wheel && \
python auditwheel-min.py repair dist/*.whl --plat manylinux_2_31_x86_64 && \
python auditwheel-min.py repair dist/*.whl --plat manylinux_2_39_x86_64 && \
cp wheelhouse/*.whl /output/ && \
python verify-libs.py wheelhouse/*.whl && \
cp wheelhouse/*.whl /output/
18 changes: 11 additions & 7 deletions auditwheel-min.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import os
import sys

from auditwheel.main import main
from auditwheel.policy import _POLICIES as POLICIES
import unittest.mock
from auditwheel.policy import WheelPolicies
from auditwheel.lddtree import lddtree

ldd_tree = lddtree('_skbuild/linux-x86_64-3.11/cmake-install/cv2/cv2.abi3.so')
exclude_libs = [x for x in ldd_tree['libs'].keys() if not x.startswith('libopencv_')]

for p in POLICIES:
for lib in exclude_libs:
p['lib_whitelist'].append(lib)
class _WheelPolicies(WheelPolicies):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for p in self._policies:
for lib in exclude_libs:
p['lib_whitelist'].append(lib)

if __name__ == "__main__":
sys.exit(main())
with unittest.mock.patch('auditwheel.policy.WheelPolicies', _WheelPolicies):
from auditwheel.main import main
sys.exit(main())
2 changes: 1 addition & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

if [ ! -d opencv-python ]; then
git clone https://github.com/opencv/opencv-python.git -b 80 --depth 1 --single-branch
git clone https://github.com/opencv/opencv-python.git -b 84 --depth 1 --single-branch
(cd opencv-python && git submodule update --init --depth 1)
fi

Expand Down

0 comments on commit 4e16a04

Please sign in to comment.