Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Oct 16, 2024
1 parent 3a4bd2a commit 9578c7c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 9 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
version-tag:
description: Python package version to release to PyPI (without 'v')
required: true
default: 4.14.post5
default: 4.14.post7
dry-run:
description: Dry run
type: boolean
Expand All @@ -21,9 +21,8 @@ jobs:
strategy:
matrix:
platform:
# Use old ubuntu for binary compatibility with older glibc
- runner: ubuntu-20.04
target: manylinux_2_28_x86_64
- runner: ubuntu-24.04
target: manylinux_2_17_x86_64.manylinux2014_x86_64
steps:
- uses: actions/checkout@v4
- name: Install dependencies
Expand All @@ -33,7 +32,7 @@ jobs:
uv tool install wheel
- name: Build app
run: |
bash build_reduce.sh ${{ inputs.reduce-release-tag }}
bash build_reduce_linux.sh ${{ inputs.reduce-release-tag }}
- name: Build python wheel
run: |
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
Expand Down Expand Up @@ -77,7 +76,7 @@ jobs:
brew install gnu-sed
- name: Build app
run: |
MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.target_env }} bash build_reduce.sh ${{ inputs.reduce-release-tag }}
MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.target_env }} bash build_reduce_mac.sh ${{ inputs.reduce-release-tag }}
- name: Build python wheel
run: |
export PATH="/Users/runner/.local/bin:$PATH"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build_glibc_dependency.txt
/build/
/build_python/
# Created by https://www.toptal.com/developers/gitignore/api/python
Expand Down
1 change: 1 addition & 0 deletions build_glibc_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4
23 changes: 22 additions & 1 deletion build_reduce_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,33 @@ if [[ $# -ge 1 ]]; then
REDUCE_RELEASE_TAG=$1
else
echo "usage: $0 <REDUCE-RELEASE-TAG>"
exit 1
fi

docker build . -f linux_build.Dockerfile -t reduce-build --build-arg REDUCE_RELEASE_TAG="$REDUCE_RELEASE_TAG"

docker rm -f reducecontainer
docker create -ti --name reducecontainer reduce-build bash
docker cp reducecontainer:/opt/build .
docker rm -f reducecontainer
docker cp reducecontainer:/opt/binary_glibc_dependency.txt .
BINARY_GLIBC_DEPENDENCY=$(cat binary_glibc_dependency.txt)
rm binary_glibc_dependency.txt

# Check if the glibc dependency is lower than 2.17
# this should be 2.17. Only if the dependency is higher than 2.17, the value will be different
dependency_lower_than_2_17=$(printf "%s\n2.17" "$BINARY_GLIBC_DEPENDENCY" | sort -Vu | tail -1)

if [[ "$dependency_lower_than_2_17" != "2.17" ]]; then
echo "⚠️ The glibc dependency is higher than 2.17."
echo "⚠️ The binary may not run on all systems."
echo "⚠️ Dependency: $BINARY_GLIBC_DEPENDENCY"
exit 1
else
echo "✅ The glibc dependency is lower than 2.17."
echo "✅ The binary should run on most systems."
echo "✅ Dependency: $BINARY_GLIBC_DEPENDENCY"
exit 1
fi

# docker rm -f reducecontainer

1 change: 1 addition & 0 deletions build_reduce_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if [[ $# -ge 1 ]]; then
REDUCE_RELEASE_TAG=$1
else
echo "usage: $0 <REDUCE-RELEASE-TAG>"
exit 1
fi

## Fetch Code
Expand Down
7 changes: 5 additions & 2 deletions linux_build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ubuntu:18.04 as builder
## USAGE: docker build . -f linux_build.Dockerfile -t reduce-appimage --build-arg REDUCE_RELEASE_TAG=v4.14
RUN apt-get update && apt-get install -y \
g++ make cmake \
curl git
g++ make cmake git \
binutils # to check the minimum required glibc version

ENV BUILD_DIR=/opt/build
RUN mkdir -p $BUILD_DIR
Expand All @@ -21,3 +21,6 @@ ENV CPPFLAGS="-I$BUILD_DIR/include"
ENV LDFLAGS="-L$BUILD_DIR/lib"
RUN cmake . -DCMAKE_INSTALL_PREFIX="$BUILD_DIR"
RUN make -j4 && make install

## Check the minimum required glibc version
RUN objdump -T "$BUILD_DIR/bin/reduce" | grep -v GLIBCXX | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu | tail -1 > /opt/binary_glibc_dependency.txt

0 comments on commit 9578c7c

Please sign in to comment.