diff --git a/.github/workflows/early-access.yaml b/.github/workflows/early-access.yaml index 3715c969..865331c8 100644 --- a/.github/workflows/early-access.yaml +++ b/.github/workflows/early-access.yaml @@ -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() diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6b1c9063..3e0590e1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,8 +58,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 -DskipTests + run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e -DskipTests - name: 'Upload artifact' uses: actions/upload-artifact@v2 diff --git a/client/pom.xml b/client/pom.xml index 81f90dd6..3b082ecf 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -33,6 +33,8 @@ 11 11 + + @@ -134,8 +136,34 @@ - native + enable-partial-static-native + + + !mac + + + + -H:+StaticExecutableWithDynamicLibC + + + + linux-image-only-require-glibc-2.12 + + + linux + + + target/graalvm-libs-for-glibc-2.12 + + + + -H:CLibraryPath=${project.build.directory}/graalvm-libs-for-glibc-2.12 + + + + + native @@ -146,13 +174,16 @@ org.mvndaemon.mvnd.client.DefaultClient mvnd --no-server - --no-fallback - --allow-incomplete-classpath - -H:IncludeResources=org/mvndaemon/mvnd/.* - -H:IncludeResources=mvnd-bash-completion.bash - -H:-ParseRuntimeOptions - -H:+AddAllCharsets - -ea + --no-fallback + --allow-incomplete-classpath + ${graalvm-native-static-opt} + ${graalvm-native-glibc-opt} + -H:IncludeResources=org/mvndaemon/mvnd/.* + -H:IncludeResources=mvnd-bash-completion.bash + -H:-ParseRuntimeOptions + -H:+AddAllCharsets + -H:+ReportExceptionStackTraces + -ea