Build mostly static native image, loose linux glibc requirement to 2.12 (#730)

This commit is contained in:
James Z.M. Gao
2022-12-14 06:01:31 +08:00
committed by GitHub
parent 25b5117749
commit 1249211b49
3 changed files with 75 additions and 10 deletions

View File

@@ -57,8 +57,25 @@ jobs:
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Maven clean'
run: ./mvnw clean -Dmrm=false -B -ntp -e
- name: 'Patch Graal libs for only requiring glibc 2.12'
shell: bash
run: |
if [[ $OS == linux ]] && [[ $GRAALVM_HOME ]] && [[ -d "$GRAALVM_HOME/lib/static/linux-amd64/glibc" ]]; then
mkdir -p client/target/graalvm-libs-for-glibc-2.12
echo "memcpy memcpy@GLIBC_2.2.5" >client/target/glibc.redef
echo "posix_spawn posix_spawn@GLIBC_2.2.5" >>client/target/glibc.redef
find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a' | while IFS= read -r input; do
output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
objcopy --redefine-syms=client/target/glibc.redef -- "$input" "$output" 2>/dev/null
done
find /usr/lib -name libz.a | xargs -r -I {} objcopy --redefine-syms=client/target/glibc.redef {} client/target/graalvm-libs-for-glibc-2.12/libz.a
fi
- name: 'Build native distribution'
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e
- name: 'Upload daemon test logs'
if: always()