Skip to content

Commit 7eafc0a

Browse files
committed
Update Dockerfile
- Update version of bpftool - Migrate LD_LIBRARY_PATH to use python3.10 in listed paths - Update panda building process to be in sync with recent panda-re Dockerfile: https://github.com/panda-re/panda/blob/48bf566b9fad2590f574c559513b022ae71b3666/Dockerfile - Add "packaging>22.0" to fix setuptools bug: pypa/setuptools#4483
1 parent 8dbf3c8 commit 7eafc0a

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

Diff for: Dockerfile

+21-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ ARG TARGET_LIST
3030
RUN apt-get -qq update
3131
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*') && \
3232
apt-get clean && \
33-
python3 -m pip install --upgrade --no-cache-dir pip && \
33+
wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && \
34+
python3 -m pip install --upgrade --no-cache-dir "packaging>22.0" && \
3435
python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
3536
python3 -m pip install --upgrade --no-cache-dir "capstone" && \
3637
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
@@ -53,24 +54,27 @@ RUN cd /tmp && \
5354
cmake -GNinja .. && ninja && ninja package && dpkg -i libosi*.deb && \
5455
cd /tmp && rm -rf libosi/ && ldconfig
5556

56-
# Build and install panda
5757
# Note we diable NUMA for docker builds because it causes make check to fail in docker
5858
RUN git -C /panda submodule update --init dtc && \
5959
git -C /panda rev-parse HEAD > /usr/local/panda_commit_hash && \
6060
mkdir /panda/build && cd /panda/build && \
61+
python3 -m pip install setuptools_scm && \
62+
python3 -m pip install build && \
63+
python3 -m setuptools_scm -r .. --strip-dev 2>/dev/null >/tmp/savedversion && \
6164
/panda/configure \
6265
--target-list="${TARGET_LIST}" \
6366
--prefix=/usr/local \
6467
--disable-numa \
65-
--enable-llvm \
66-
--extra-cflags="-Wno-error=deprecated-declarations"
68+
--enable-llvm && \
69+
rm -rf /panda/.git
6770

68-
RUN make -C /panda/build -j "$(nproc)"
71+
RUN PRETEND_VERSION=$(cat /tmp/savedversion) make -C /panda/build -j "$(nproc)"
6972

7073
#### Develop setup: panda built + pypanda installed (in develop mode) - Stage 3
7174
FROM builder as developer
7275
RUN cd /panda/panda/python/core && \
73-
python3 setup.py develop && \
76+
python3 create_panda_datatypes.py && \
77+
PRETEND_VERSION=$(cat /tmp/savedversion) pip install -e . && \
7478
ldconfig && \
7579
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
7680
cd /panda && \
@@ -90,8 +94,15 @@ RUN make -C /panda/build install && \
9094

9195
# Install pypanda
9296
RUN cd /panda/panda/python/core && \
93-
python3 setup.py install
97+
python3 create_panda_datatypes.py --install && \
98+
PRETEND_VERSION=$(cat /tmp/savedversion) pip install .
9499
RUN python3 -m pip install --ignore-install pycparser && python3 -m pip install --force-reinstall --no-binary :all: cffi
100+
# Build a whl too
101+
RUN cd /panda/panda/python/core && \
102+
python3 create_panda_datatypes.py --install && \
103+
PRETEND_VERSION=$(cat /tmp/savedversion) python3 -m build --wheel .
104+
105+
RUN python3 -m pip show pandare
95106

96107
# BUG: PANDA sometimes fails to generate all the necessary files for PyPANDA. This is a temporary fix to detect and fail when this occurs
97108
RUN ls -alt $(pip show pandare | grep Location: | awk '{print $2}')/pandare/autogen/
@@ -126,9 +137,9 @@ COPY --from=cleanup /usr/lib/libcapstone* /usr/lib/
126137
COPY --from=cleanup /lib/libosi.so /lib/libiohal.so /lib/liboffset.so /lib/
127138

128139
# Workaround issue #901 - ensure LD_LIBRARY_PATH contains the panda plugins directories
129-
ENV LD_LIBRARY_PATH /usr/local/lib/python3.8/dist-packages/pandare/data/x86_64-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/i386-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/arm-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/ppc-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mips-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mipsel-softmmu/panda/plugins/
140+
ENV LD_LIBRARY_PATH /usr/local/lib/python3.10/dist-packages/pandare/data/x86_64-softmmu/panda/plugins/:/usr/local/lib/python3.10/dist-packages/pandare/data/i386-softmmu/panda/plugins/:/usr/local/lib/python3.10/dist-packages/pandare/data/arm-softmmu/panda/plugins/:/usr/local/lib/python3.10/dist-packages/pandare/data/ppc-softmmu/panda/plugins/:/usr/local/lib/python3.10/dist-packages/pandare/data/mips-softmmu/panda/plugins/:/usr/local/lib/python3.10/dist-packages/pandare/data/mipsel-softmmu/panda/plugins/
130141
#PANDA_PATH is used by rust plugins
131-
ENV PANDA_PATH /usr/local/lib/python3.8/dist-packages/pandare/data
142+
ENV PANDA_PATH /usr/local/lib/python3.10/dist-packages/pandare/data
132143

133144
# Ensure runtime dependencies are installed for our libpanda objects and panda plugins
134145
RUN ldconfig && \
@@ -144,7 +155,7 @@ RUN apt-get -qq update
144155
RUN apt-get -qq install -y gcc libguestfs-tools make flex bison libelf-dev bc linux-image-generic pahole gdb
145156

146157
# Compile and install bpftool
147-
RUN cd /tmp && git clone --branch v7.4.0 --recurse-submodules https://github.com/libbpf/bpftool.git
158+
RUN cd /tmp && git clone --branch v7.5.0 --recurse-submodules https://github.com/libbpf/bpftool.git
148159
RUN cd /tmp/bpftool/src && make && make install
149160

150161
# Install python dependencies

0 commit comments

Comments
 (0)