Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logic for static cross-compile for linux-aarch64 to pom file. #857

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ jobs:
- name: Checking for test failures
run: ./.github/scripts/check_build_result.sh build.output

- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: build-pr-${{ matrix.setup }}-jars
path: |
**/target/*.jar

- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
Expand Down
45 changes: 8 additions & 37 deletions boringssl-static/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,12 @@
</profile>

<profile>
<id>linux-aarch64</id>
<id>linux-aarch64-cross-compile</id>

<properties>
<boringsslSourceDir>${project.build.directory}/boringssl-${boringsslBranch}</boringsslSourceDir>
<boringsslHome>${boringsslSourceDir}/build</boringsslHome>
<crossCompile>linux</crossCompile>
<linkStatic>true</linkStatic>
<msvcSslIncludeDirs>${boringsslSourceDir}/include</msvcSslIncludeDirs>
<msvcSslLibDirs>${boringsslHome}/ssl;${boringsslHome}/crypto</msvcSslLibDirs>
Expand Down Expand Up @@ -695,10 +696,6 @@
</files>
<content>release 7.6</content>
</requireFilesContent>
<requireProperty>
<property>aprArmHome</property>
<message>The folder of APR for aarch64 must be specified by hand. Please try -DaprArmHome=</message>
</requireProperty>
</rules>
<ignoreCache>true</ignoreCache>
</configuration>
Expand Down Expand Up @@ -807,38 +804,12 @@

<mkdir dir="${boringsslHome}" />

<if>
<equals arg1="${os.detected.name}" arg2="windows" />
<then>
<!-- On Windows, build with /MT for static linking -->
<property name="cmakeAsmFlags" value="" />
<property name="cmakeCFlags" value="/MT" />
<!-- Disable one warning to be able to build on windows -->
<property name="cmakeCxxFlags" value="/MT /wd4091" />
</then>
<elseif>
<equals arg1="${os.detected.name}" arg2="linux" />
<then>
<!-- On *nix, add ASM flags to disable executable stack -->
<property name="cmakeAsmFlags" value="-Wa,--noexecstack" />
<property name="cmakeCFlags" value="-O3 -fno-omit-frame-pointer" />
<!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
<property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" />
</then>
</elseif>
<else>
<!-- On *nix, add ASM flags to disable executable stack -->
<property name="cmakeAsmFlags" value="-Wa,--noexecstack" />
<property name="cmakeCFlags" value="-O3 -fno-omit-frame-pointer" />
<property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer" />
</else>
</if>
<exec executable="cmake" failonerror="true" dir="${boringsslHome}" resolveexecutable="true">
<arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
<arg value="-DCMAKE_BUILD_TYPE=Release" />
<arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
<arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
<arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
<arg value="-DCMAKE_ASM_FLAGS=-Wa,--noexecstack" />
<arg value="-DCMAKE_C_FLAGS_RELEASE=-O3 -fno-omit-frame-pointer" />
<arg value="-DCMAKE_CXX_FLAGS_RELEASE=-O3 -fno-omit-frame-pointer -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" />
<arg value="-DCMAKE_SYSTEM_NAME=Linux" />
<arg value="-DCMAKE_SYSTEM_PROCESSOR=aarch64" />
<arg value="-DCMAKE_C_COMPILER=aarch64-none-linux-gnu-gcc" />
Expand Down Expand Up @@ -951,7 +922,7 @@
<!-- <verbose>true</verbose> -->
<configureArgs>
<configureArg>--with-ssl=no</configureArg>
<configureArg>--with-apr=${aprArmHome}</configureArg>
<configureArg>--with-apr=${aprHome}</configureArg>
<configureArg>--with-static-libs</configureArg>
<configureArg>--libdir=${project.build.directory}/native-build/target/lib</configureArg>
<configureArg>CFLAGS=-O3 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value</configureArg>
Expand Down Expand Up @@ -1145,7 +1116,7 @@

<properties>
<linkStatic>true</linkStatic>
<osxCrossCompile>true</osxCrossCompile>
<crossCompile>osx</crossCompile>
<target>arm64-apple-macos11</target>
<macOsxDeploymentTarget>OSX_DEPLOYMENT_TARGET=11.0</macOsxDeploymentTarget>
<cmakeOsxDeploymentTarget>-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0</cmakeOsxDeploymentTarget>
Expand Down Expand Up @@ -1392,7 +1363,7 @@

<properties>
<linkStatic>true</linkStatic>
<osxCrossCompile>true</osxCrossCompile>
<crossCompile>osx</crossCompile>
<target>x86_64-apple-macos10.12</target>
<macOsxDeploymentTarget>OSX_DEPLOYMENT_TARGET=10.12</macOsxDeploymentTarget>
<cmakeOsxDeploymentTarget>-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12</cmakeOsxDeploymentTarget>
Expand Down
8 changes: 4 additions & 4 deletions docker/docker-compose.centos-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:

cross-compile-aarch64-build:
<<: *cross-compile-aarch64-common
command: /bin/bash -cl "./mvnw clean package -Plinux-aarch64 -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share -DskipTests && ./mvnw clean package -Plinux-aarch64 -am -pl boringssl-static -DaprArmHome=/opt/apr-$$APR_VERSION-static -DboringsslSourceDir=/root/workspace/boringssl-source -DboringsslHome=/root/workspace/boringssl -DskipTests"
command: /bin/bash -cl "./mvnw clean package -Plinux-aarch64-cross-compile -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share -DskipTests && ./mvnw clean package -Plinux-aarch64-cross-compile -am -pl boringssl-static -DskipTests"

cross-compile-aarch64-deploy:
<<: *cross-compile-aarch64-common
Expand All @@ -50,7 +50,7 @@ services:
- ~/.m2/repository:/root/.m2/repository
- ~/.m2/settings.xml:/root/.m2/settings.xml
- ..:/code
command: /bin/bash -cl "./mvnw clean deploy -Plinux-aarch64 -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share -DskipTests && ./mvnw clean deploy -Plinux-aarch64 -am -pl boringssl-static -DaprArmHome=/opt/apr-$$APR_VERSION-static -DboringsslSourceDir=/root/workspace/boringssl-source -DboringsslHome=/root/workspace/boringssl -DskipTests"
command: /bin/bash -cl "./mvnw clean deploy -Plinux-aarch64-cross-compile -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share -DskipTests && ./mvnw clean deploy -Plinux-aarch64-cross-compile -am -pl boringssl-static -DskipTests"

cross-compile-aarch64-stage-snapshot:
<<: *cross-compile-aarch64-common
Expand All @@ -60,7 +60,7 @@ services:
- ~/.m2/repository:/root/.m2/repository
- ~/local-staging:/root/local-staging
- ..:/code
command: /bin/bash -cl "./mvnw -Plinux-aarch64 -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true && ./mvnw -Plinux-aarch64 -am -pl boringssl-static -DaprArmHome=/opt/apr-$$APR_VERSION-static -DboringsslSourceDir=/root/workspace/boringssl-source -DboringsslHome=/root/workspace/boringssl clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true"
command: /bin/bash -cl "./mvnw -Plinux-aarch64-cross-compile -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true && ./mvnw -Plinux-aarch64-cross-compile -am -pl boringssl-static clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true"

cross-compile-aarch64-stage-release:
<<: *cross-compile-aarch64-common
Expand All @@ -70,5 +70,5 @@ services:
- ~/.m2/settings.xml:/root/.m2/settings.xml
- ~/local-staging:/root/local-staging
- ..:/code
command: /bin/bash -cl "cat <(echo -e \"${GPG_PRIVATE_KEY}\") | gpg --batch --import && ./mvnw -Plinux-aarch64 -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEYNAME} && ./mvnw -Plinux-aarch64 -am -pl boringssl-static -DaprArmHome=/opt/apr-$$APR_VERSION-static -DboringsslSourceDir=/root/workspace/boringssl-source -DboringsslHome=/root/workspace/boringssl clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEYNAME}"
command: /bin/bash -cl "cat <(echo -e \"${GPG_PRIVATE_KEY}\") | gpg --batch --import && ./mvnw -Plinux-aarch64-cross-compile -am -pl openssl-dynamic -DaprArmHome=/opt/apr-$$APR_VERSION-share -DopensslArmHome=/opt/openssl-$$OPENSSL_VERSION-share clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEYNAME} && ./mvnw -Plinux-aarch64-cross-compile -am -pl boringssl-static clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEYNAME}"

2 changes: 1 addition & 1 deletion openssl-dynamic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
</build>
</profile>
<profile>
<id>linux-aarch64</id>
<id>linux-aarch64-cross-compile</id>

<properties>
<!-- use aarch_64 as this is also what os.detected.arch will use on an aarch64 system -->
Expand Down
30 changes: 28 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<aprSourceDir>${project.build.directory}/apr-source</aprSourceDir>
<archBits>64</archBits>
<linkStatic>false</linkStatic>
<osxCrossCompile>false</osxCrossCompile>
<crossCompile>false</crossCompile>
<sslHome>${project.build.directory}/ssl</sslHome>
<msvcSslIncludeDirs>${sslHome}/include</msvcSslIncludeDirs>
<msvcSslLibDirs>${sslHome}/lib</msvcSslLibDirs>
Expand Down Expand Up @@ -667,7 +667,7 @@
<exec executable="buildconf" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true" />

<if>
<equals arg1="${osxCrossCompile}" arg2="true" />
<equals arg1="${crossCompile}" arg2="osx" />
<then>
<!--
+ We need to set some extra variables as otherwise the configure of apr will fail when trying to cross-compile.
Expand All @@ -691,6 +691,32 @@
<arg line="install" />
</exec>
</then>
<elseif>
<equals arg1="${crossCompile}" arg2="linux" />
<then>
<!--
+ We need to set some extra variables as otherwise the configure of apr will fail when trying to cross-compile.
+ See https://stackoverflow.com/a/1605497/1074097
+ -->
<exec executable="configure" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="--disable-shared --prefix=${aprHome} CC=aarch64-none-linux-gnu-gcc CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' --host=aarch64-linux-gnu ac_cv_have_decl_sys_siglist=no ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8" />
</exec>
<!--
Make will fail when it tries to use the gen_test_char program.
We work around this by compile gen_test_char separate, execute and than rerun make.
See https://stackoverflow.com/a/56262330/1074097
-->
<exec executable="make" failonerror="false" dir="${aprSourceDir}" resolveexecutable="true" />
<exec executable="gcc" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="-Wall -O2 -DCROSS_COMPILE tools/gen_test_char.c -o tools/gen_test_char" />
</exec>
<exec executable="tools/gen_test_char" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true" output="${aprSourceDir}/include/private/apr_escape_test_char.h" />
<exec executable="make" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true" />
<exec executable="make" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="install" />
</exec>
</then>
</elseif>
<else>
<exec executable="configure" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<!--
Expand Down
Loading