Skip to content

Commit 5a8779f

Browse files
committed
Merge branch 'lief_cherrypick' into 'main'
Cherry-pick LIEF fix for 0.16.6 See merge request rewriting/ddisasm!1243
2 parents 80206ee + 241f59a commit 5a8779f

3 files changed

Lines changed: 54 additions & 78 deletions

File tree

.ci/Dockerfile.static

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ RUN apt-get -y update && \
4141
cmake \
4242
git \
4343
python3 \
44-
python3-pip \
4544
wget
4645

4746
# Install CMake 3.24.0 (needed by LIEF 0.16.6)
@@ -53,30 +52,23 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm
5352
ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
5453
rm cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
5554

56-
RUN pip install conan==1.59 && \
57-
conan profile new default --detect && \
58-
conan remote add rewriting_remote https://git.grammatech.com/api/v4/packages/conan
59-
6055
ENV LIEF_VERSION="0.16.6"
6156

62-
RUN echo "[requires]\n\
63-
lief/${LIEF_VERSION}@rewriting+extra-packages/stable\n\
64-
\n\
65-
[generators]\n\
66-
CMakeDeps\n\
67-
CMakeToolchain" > /tmp/conanfile.txt
68-
69-
RUN conan install /tmp/conanfile.txt \
70-
--build=missing \
71-
--remote=rewriting_remote \
72-
-pr:b=default -pr:h=default
73-
74-
RUN PKG_DIR=$(find /root/.conan/data/lief/${LIEF_VERSION}/rewriting+extra-packages/stable/package -mindepth 1 -maxdepth 1 -type d) && \
75-
mkdir -p /opt/lief-pkg && \
76-
cp -a $PKG_DIR/include /opt/lief-pkg/ && \
77-
cp -a $PKG_DIR/lib /opt/lief-pkg/ && \
78-
cp -a $PKG_DIR/lib/cmake /opt/lief-pkg/ && \
79-
cp -a $PKG_DIR/lib/pkgconfig /opt/lief-pkg/ || true
57+
RUN git clone -b ${LIEF_VERSION} --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF
58+
59+
WORKDIR /usr/local/src/LIEF
60+
61+
# Apply a fix from the main branch to resolve a build error related to `noexcept`.
62+
# The commit 6877ce7aba037074954bc63102c9d45b73d63b0b cherry-picked from upstream.
63+
# TODO: Remove this workaround once LIEF includes the fix in an official release.
64+
RUN git config --global user.email "build@example.com" && \
65+
git config --global user.name "Automated Build" && \
66+
git remote add upstream https://github.com/lief-project/LIEF.git && \
67+
git fetch upstream 6877ce7aba037074954bc63102c9d45b73d63b0b && \
68+
git cherry-pick 6877ce7aba037074954bc63102c9d45b73d63b0b
69+
70+
RUN cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build && \
71+
cmake --build /usr/local/src/LIEF/build -j4 --target install
8072

8173
# ------------------------------------------------------------------------------
8274
# Build libehp
@@ -176,9 +168,9 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
176168

177169
COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
178170
COPY --from=souffle /usr/local/include/souffle/ /usr/include/souffle
179-
COPY --from=lief /opt/lief-pkg/lib/libLIEF.a /usr/lib/libLIEF.a
180-
COPY --from=lief /opt/lief-pkg/lib/cmake/LIEF /usr/lib/cmake/LIEF
181-
COPY --from=lief /opt/lief-pkg/include/LIEF /usr/include/LIEF
171+
COPY --from=lief /usr/lib/libLIEF.a /usr/lib/libLIEF.a
172+
COPY --from=lief /usr/lib/cmake/LIEF /usr/lib/cmake/LIEF
173+
COPY --from=lief /usr/include/LIEF /usr/include/LIEF
182174
COPY --from=libehp /usr/local/lib /usr/local/lib
183175
COPY --from=libehp /usr/local/include /usr/local/include
184176
COPY --from=UASM /usr/local/bin/uasm /usr/local/bin/uasm

.ci/Dockerfile.ubuntu20

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ RUN apt-get -y update && \
4242
cmake \
4343
git \
4444
python3 \
45-
python3-pip \
4645
wget
4746

4847
# Install CMake 3.24.0 (needed by LIEF 0.16.6)
@@ -54,30 +53,23 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm
5453
ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
5554
rm cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
5655

57-
RUN pip install conan==1.59 && \
58-
conan profile new default --detect && \
59-
conan remote add rewriting_remote https://git.grammatech.com/api/v4/packages/conan
60-
6156
ENV LIEF_VERSION="0.16.6"
6257

63-
RUN echo "[requires]\n\
64-
lief/${LIEF_VERSION}@rewriting+extra-packages/stable\n\
65-
\n\
66-
[generators]\n\
67-
CMakeDeps\n\
68-
CMakeToolchain" > /tmp/conanfile.txt
69-
70-
RUN conan install /tmp/conanfile.txt \
71-
--build=missing \
72-
--remote=rewriting_remote \
73-
-pr:b=default -pr:h=default
74-
75-
RUN PKG_DIR=$(find /root/.conan/data/lief/${LIEF_VERSION}/rewriting+extra-packages/stable/package -mindepth 1 -maxdepth 1 -type d) && \
76-
mkdir -p /opt/lief-pkg && \
77-
cp -a $PKG_DIR/include /opt/lief-pkg/ && \
78-
cp -a $PKG_DIR/lib /opt/lief-pkg/ && \
79-
cp -a $PKG_DIR/lib/cmake /opt/lief-pkg/ && \
80-
cp -a $PKG_DIR/lib/pkgconfig /opt/lief-pkg/ || true
58+
RUN git clone -b ${LIEF_VERSION} --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF
59+
60+
WORKDIR /usr/local/src/LIEF
61+
62+
# Apply a fix from the main branch to resolve a build error related to `noexcept`.
63+
# The commit 6877ce7aba037074954bc63102c9d45b73d63b0b cherry-picked from upstream.
64+
# TODO: Remove this workaround once LIEF includes the fix in an official release.
65+
RUN git config --global user.email "build@example.com" && \
66+
git config --global user.name "Automated Build" && \
67+
git remote add upstream https://github.com/lief-project/LIEF.git && \
68+
git fetch upstream 6877ce7aba037074954bc63102c9d45b73d63b0b && \
69+
git cherry-pick 6877ce7aba037074954bc63102c9d45b73d63b0b
70+
71+
RUN cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build && \
72+
cmake --build /usr/local/src/LIEF/build -j4 --target install
8173

8274
# ------------------------------------------------------------------------------
8375
# Build libehp
@@ -224,9 +216,9 @@ RUN git init && \
224216

225217
COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
226218
COPY --from=souffle /usr/local/include/souffle/ /usr/local/include/souffle
227-
COPY --from=lief /opt/lief-pkg/lib/libLIEF.a /usr/lib/libLIEF.a
228-
COPY --from=lief /opt/lief-pkg/lib/cmake/LIEF /usr/lib/cmake/LIEF
229-
COPY --from=lief /opt/lief-pkg/include/LIEF /usr/include/LIEF
219+
COPY --from=lief /usr/lib/libLIEF.a /usr/lib/libLIEF.a
220+
COPY --from=lief /usr/lib/cmake/LIEF /usr/lib/cmake/LIEF
221+
COPY --from=lief /usr/include/LIEF /usr/include/LIEF
230222
COPY --from=libehp /usr/local/lib /usr/local/lib
231223
COPY --from=libehp /usr/local/include /usr/local/include
232224
COPY --from=UASM /usr/local/bin/uasm /usr/local/bin/uasm

Dockerfile

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ RUN apt-get -y update && \
4040
cmake \
4141
git \
4242
python3 \
43-
python3-pip \
4443
wget
4544

4645
# Install CMake 3.24.0 (needed by LIEF 0.16.6)
@@ -52,30 +51,23 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm
5251
ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
5352
rm cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
5453

55-
RUN pip install conan==1.59 && \
56-
conan profile new default --detect && \
57-
conan remote add rewriting_remote https://git.grammatech.com/api/v4/packages/conan
58-
5954
ENV LIEF_VERSION="0.16.6"
6055

61-
RUN echo "[requires]\n\
62-
lief/${LIEF_VERSION}@rewriting+extra-packages/stable\n\
63-
\n\
64-
[generators]\n\
65-
CMakeDeps\n\
66-
CMakeToolchain" > /tmp/conanfile.txt
67-
68-
RUN conan install /tmp/conanfile.txt \
69-
--build=missing \
70-
--remote=rewriting_remote \
71-
-pr:b=default -pr:h=default
72-
73-
RUN PKG_DIR=$(find /root/.conan/data/lief/${LIEF_VERSION}/rewriting+extra-packages/stable/package -mindepth 1 -maxdepth 1 -type d) && \
74-
mkdir -p /opt/lief-pkg && \
75-
cp -a $PKG_DIR/include /opt/lief-pkg/ && \
76-
cp -a $PKG_DIR/lib /opt/lief-pkg/ && \
77-
cp -a $PKG_DIR/lib/cmake /opt/lief-pkg/ && \
78-
cp -a $PKG_DIR/lib/pkgconfig /opt/lief-pkg/ || true
56+
RUN git clone -b ${LIEF_VERSION} --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF
57+
58+
WORKDIR /usr/local/src/LIEF
59+
60+
# Apply a fix from the main branch to resolve a build error related to `noexcept`.
61+
# The commit 6877ce7aba037074954bc63102c9d45b73d63b0b cherry-picked from upstream.
62+
# TODO: Remove this workaround once LIEF includes the fix in an official release.
63+
RUN git config --global user.email "build@example.com" && \
64+
git config --global user.name "Automated Build" && \
65+
git remote add upstream https://github.com/lief-project/LIEF.git && \
66+
git fetch upstream 6877ce7aba037074954bc63102c9d45b73d63b0b && \
67+
git cherry-pick 6877ce7aba037074954bc63102c9d45b73d63b0b
68+
69+
RUN cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build && \
70+
cmake --build /usr/local/src/LIEF/build -j4 --target install
7971

8072
# ------------------------------------------------------------------------------
8173
# Install libehp
@@ -184,9 +176,9 @@ RUN wget https://download.grammatech.com/gtirb/files/apt-repo/pool/unstable/libc
184176

185177
COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
186178
COPY --from=souffle /usr/local/include /usr/local/include
187-
COPY --from=lief /opt/lief-pkg/lib/libLIEF.a /usr/lib/libLIEF.a
188-
COPY --from=lief /opt/lief-pkg/lib/cmake/LIEF /usr/lib/cmake/LIEF
189-
COPY --from=lief /opt/lief-pkg/include/LIEF /usr/include/LIEF
179+
COPY --from=lief /usr/lib/libLIEF.a /usr/lib/libLIEF.a
180+
COPY --from=lief /usr/lib/cmake/LIEF /usr/lib/cmake/LIEF
181+
COPY --from=lief /usr/include/LIEF /usr/include/LIEF
190182
COPY --from=libehp /usr/local/lib /usr/local/lib
191183
COPY --from=libehp /usr/local/include /usr/local/include
192184
COPY --from=gtirb /usr/local/lib /usr/local/lib

0 commit comments

Comments
 (0)