Skip to content

Commit ec11b7b

Browse files
committed
HPCC-33405: Add support for ubuntu arm
Bump vcpkg to 2025.02.13 with arm support Move antlr3c into vcpkg DC: Fix for arm64 register naming DC: Fix arm64 build issue in _cpyrevn DC: Move large zero array outside of functions (jlib file unittest) Rework dockerfiles/vcpkg/build.sh to support arm Signed-off-by Gordon Smith <[email protected]> Move large zero array outside of functions
1 parent a520d8d commit ec11b7b

File tree

10 files changed

+196
-95
lines changed

10 files changed

+196
-95
lines changed

.github/workflows/build-docker.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,19 @@ on:
5858
description: 'Asset Name (if upload-package is true)'
5959
required: false
6060
default: 'build-docker-package'
61+
tag_postfix:
62+
type: string
63+
description: 'Either -arm or empty string'
64+
required: false
65+
default: ''
6166
secrets:
6267
LNB_TOKEN:
6368
required: false
6469

6570
jobs:
6671

6772
build-docker:
68-
runs-on: ubuntu-22.04
73+
runs-on: ubuntu-22.04${{ inputs.tag_postfix }}
6974
steps:
7075
- name: Free additional disk space (remove Android SDK + Tools)
7176
continue-on-error: true
@@ -113,8 +118,8 @@ jobs:
113118
vcpkg_sha_short=$(git rev-parse --short=8 HEAD)
114119
echo "vcpkg_sha_short=$vcpkg_sha_short" >> $GITHUB_OUTPUT
115120
docker_build_label=hpccsystems/platform-build-${{ inputs.os }}
116-
echo "docker_tag=$docker_build_label:$vcpkg_sha_short" >> $GITHUB_OUTPUT
117-
echo "docker_tag_candidate_base=$docker_build_label:$branch_label" >> $GITHUB_OUTPUT
121+
echo "docker_tag=$docker_build_label:$vcpkg_sha_short${{ inputs.tag_postfix }}" >> $GITHUB_OUTPUT
122+
echo "docker_tag_candidate_base=$docker_build_label:$branch_label${{ inputs.tag_postfix }}" >> $GITHUB_OUTPUT
118123
119124
- name: Print vars
120125
shell: "bash"
@@ -133,12 +138,12 @@ jobs:
133138
- uses: hendrikmuhs/[email protected]
134139
with:
135140
save: ${{ inputs.update-cache == true }}
136-
key: docker-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-${{ inputs.containerized == true && 'k8s' || 'bare-metal' }}-${{ inputs.ln == true && 'LN' || 'HPCC-Platform' }}
141+
key: docker${{ inputs.tag_postfix }}-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-${{ inputs.containerized == true && 'k8s' || 'bare-metal' }}-${{ inputs.ln == true && 'LN' || 'HPCC-Platform' }}
137142
restore-keys: |
138-
docker-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-${{ inputs.containerized == true && 'k8s' || 'bare-metal' }}-
139-
docker-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-
140-
docker-${{ inputs.os }}-${{ inputs.build-type }}-
141-
docker-${{ inputs.os }}-
143+
docker${{ inputs.tag_postfix }}-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-${{ inputs.containerized == true && 'k8s' || 'bare-metal' }}-
144+
docker${{ inputs.tag_postfix }}-${{ inputs.os }}-${{ inputs.build-type }}-${{ steps.vars.outputs.branch_label }}-
145+
docker${{ inputs.tag_postfix }}-${{ inputs.os }}-${{ inputs.build-type }}-
146+
docker${{ inputs.tag_postfix }}-${{ inputs.os }}-
142147
143148
- name: Docker build image
144149
uses: docker/build-push-action@v5
@@ -149,7 +154,7 @@ jobs:
149154
push: false
150155
load: true
151156
build-args: |
152-
VCPKG_REF=${{ steps.vars.outputs.vcpkg_sha_short }}
157+
VCPKG_REF=${{ steps.vars.outputs.vcpkg_sha_short }}${{ inputs.tag_postfix }}
153158
tags: |
154159
${{ steps.vars.outputs.docker_tag }}
155160
${{ steps.vars.outputs.docker_tag_candidate_base }}
@@ -174,7 +179,7 @@ jobs:
174179
--mount source="${{ github.workspace }}/build",target=/hpcc-dev/build,type=bind,consistency=delegated \
175180
--mount source="${{ github.workspace }}/.ccache",target=/root/.ccache,type=bind,consistency=delegated \
176181
${{ steps.vars.outputs.docker_tag }} "\
177-
cmake -G Ninja -S /hpcc-dev/${{ inputs.ln == true && 'LN' || 'HPCC-Platform' }} -B /hpcc-dev/build -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform -DVCPKG_FILES_DIR=/hpcc-dev -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DCONTAINERIZED=${{ inputs.containerized == true && 'ON' || 'OFF' }} -DCPACK_STRIP_FILES=${{ inputs.strip-files == true && 'ON' || 'OFF' }} ${{ inputs.single-package == true && '-DINCLUDE_PLUGINS=ON' || '-D$plugin=ON' }} ${{ inputs.cmake-configuration }} ${{ inputs.cmake-configuration-ex }} && \
182+
cmake -G Ninja -S /hpcc-dev/${{ inputs.ln == true && 'LN' || 'HPCC-Platform' }} -B /hpcc-dev/build -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DCONTAINERIZED=${{ inputs.containerized == true && 'ON' || 'OFF' }} -DCPACK_STRIP_FILES=${{ inputs.strip-files == true && 'ON' || 'OFF' }} ${{ inputs.single-package == true && '-DINCLUDE_PLUGINS=ON' || '-D$plugin=ON' }} ${{ inputs.cmake-configuration }} ${{ inputs.cmake-configuration-ex }} && \
178183
cmake --build /hpcc-dev/build --parallel ${{ inputs.upload-package == true && '--target package' || ''}}"
179184
done
180185

.github/workflows/build-vcpkg.yml

+25
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,29 @@ jobs:
6464
asset-name: 'docker-package'
6565
secrets: inherit
6666

67+
build-docker-ubuntu-24_04-arm:
68+
if: ${{ contains('pull_request,push', github.event_name) }}
69+
uses: ./.github/workflows/build-docker.yml
70+
with:
71+
os: ubuntu-24.04
72+
tag_postfix: "-arm"
73+
secrets: inherit
74+
6775
build-docker-ubuntu-24_04:
6876
if: ${{ contains('pull_request,push', github.event_name) }}
6977
uses: ./.github/workflows/build-docker.yml
7078
with:
7179
os: ubuntu-24.04
7280
secrets: inherit
7381

82+
build-docker-ubuntu-22_04-arm:
83+
if: ${{ contains('pull_request,push', github.event_name) }}
84+
uses: ./.github/workflows/build-docker.yml
85+
with:
86+
os: ubuntu-22.04
87+
tag_postfix: "-arm"
88+
secrets: inherit
89+
7490
build-docker-ubuntu-22_04:
7591
if: ${{ contains('pull_request,push', github.event_name) }}
7692
uses: ./.github/workflows/build-docker.yml
@@ -214,3 +230,12 @@ jobs:
214230
build-type: 'Release'
215231
cmake-configuration-ex: '-DUSE_CPPUNIT=OFF -DCLIENTTOOLS_ONLY=ON -DINCLUDE_PLUGINS=OFF -DUSE_AZURE=OFF -DUSE_CASSANDRA=OFF -DSUPPRESS_CASSANDRAEMBED=ON -DUSE_JAVA=OFF -DUSE_OPENLDAP=OFF'
216232
secrets: inherit
233+
234+
build-gh_runner-macos-14:
235+
if: ${{ contains('pull_request,push', github.event_name) }}
236+
uses: ./.github/workflows/build-gh_runner.yml
237+
with:
238+
os: macos-14
239+
build-type: 'Release'
240+
cmake-configuration-ex: '-DCMAKE_OSX_ARCHITECTURES=arm64 -DUSE_CPPUNIT=OFF -DCLIENTTOOLS_ONLY=ON -DINCLUDE_PLUGINS=OFF -DUSE_AZURE=OFF -DUSE_CASSANDRA=OFF -DSUPPRESS_CASSANDRAEMBED=ON -DUSE_JAVA=OFF -DUSE_OPENLDAP=OFF'
241+
secrets: inherit

cmake_modules/vcpkg.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ elseif(APPLE)
1919
set(VCPKG_TARGET_TRIPLET "x64-osx" CACHE STRING "target triplet")
2020
endif()
2121
elseif(UNIX)
22+
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE)
23+
string(STRIP ${ARCHITECTURE} ARCHITECTURE)
24+
if(ARCHITECTURE MATCHES "arm" OR ARCHITECTURE MATCHES "aarch64")
25+
set(VCPKG_HOST_TRIPLET "arm64-linux-dynamic" CACHE STRING "host triplet")
26+
set(VCPKG_TARGET_TRIPLET "arm64-linux-dynamic" CACHE STRING "target triplet")
27+
else()
2228
set(VCPKG_HOST_TRIPLET "x64-linux-dynamic" CACHE STRING "host triplet")
2329
set(VCPKG_TARGET_TRIPLET "x64-linux-dynamic" CACHE STRING "target triplet")
30+
endif()
2431
endif()
2532

2633
message("-- vcpkg settings:")

dockerfiles/image.sh

+41-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ trapFunc() {
1111
trap 'trapFunc "${LINENO}/${BASH_LINENO}" "$?" "$BASH_COMMAND"' ERR
1212

1313
globals() {
14+
detect_arch
1415
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"
1516
ROOT_DIR=$(git rev-parse --show-toplevel)
1617

1718
set +e
18-
export $(grep -v '^#' $ROOT_DIR/.env | sed -e 's/\r$//' | xargs) > /dev/null
19+
if [ -f $ROOT_DIR/.env ]; then
20+
export $(grep -v '^#' $ROOT_DIR/.env | sed -e 's/\r$//' | xargs) > /dev/null
21+
fi
1922
set -e
2023

2124
GIT_REF=$(git rev-parse --short=8 HEAD)
@@ -24,6 +27,10 @@ globals() {
2427
pushd $ROOT_DIR/vcpkg
2528
VCPKG_REF=$(git rev-parse --short=8 HEAD)
2629
popd
30+
if [ "$ARCH" == "arm64" ]; then
31+
VCPKG_REF="$VCPKG_REF-arm"
32+
RELEASE_BASE_IMAGE="arm64v8/$RELEASE_BASE_IMAGE"
33+
fi
2734
DOCKER_USERNAME="${DOCKER_USERNAME:-hpccbuilds}"
2835

2936
CMAKE_OPTIONS="-G Ninja -DCPACK_THREADS=$(docker info --format '{{.NCPU}}') -DUSE_OPTIONAL=OFF -DCONTAINERIZED=ON -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON"
@@ -265,6 +272,10 @@ build() {
265272
exit 1
266273
fi
267274

275+
if [ "$ARCH" == "arm64" ]; then
276+
base="$base"
277+
fi
278+
268279
if [ "$RECONFIGURE" -eq 1 ]; then
269280
reconfigure
270281
fi
@@ -331,6 +342,25 @@ function cleanup() {
331342
fi
332343
}
333344

345+
function detect_arch() {
346+
if [ -z "$ARCH" ]; then
347+
if [ "$(uname -m)" == "x86_64" ]; then
348+
ARCH="x64"
349+
elif [ "$(uname -m)" == "aarch64" ]; then
350+
ARCH="arm64"
351+
elif [ "$(uname -m)" == "arm64" ]; then
352+
ARCH="arm64"
353+
else
354+
echo "Unsupported architecture: $(uname -m)"
355+
exit 1
356+
fi
357+
fi
358+
if [ "$ARCH" != "x64" ] && [ "$ARCH" != "arm64" ]; then
359+
echo "Unsupported architecture: $ARCH"
360+
exit 1
361+
fi
362+
}
363+
334364
trap cleanup EXIT
335365

336366
status() {
@@ -344,7 +374,9 @@ status() {
344374
echo "MODE: $MODE"
345375
echo "RECONFIGURE: $RECONFIGURE"
346376
echo "BUILD_OS: $BUILD_OS"
377+
echo "RELEASE_BASE_IMAGE: $RELEASE_BASE_IMAGE"
347378
echo "HPCC_BUILD: $HPCC_BUILD"
379+
echo "ARCH: $ARCH"
348380
}
349381

350382
# Print usage information
@@ -361,6 +393,7 @@ usage() {
361393
echo " -t, --tag tag the build volume with the current branch ref"
362394
echo " will preserve build state per branch"
363395
echo " -r, --reconfigure reconfigure CMake before building"
396+
echo " -a, --architecture override default architecture (x64 or arm64)"
364397
}
365398

366399
# Set default values
@@ -369,8 +402,9 @@ MODE="release"
369402
RECONFIGURE=0
370403
DEB_FILE=""
371404
BUILD_OS="ubuntu-22.04"
372-
RELEASE_BASE_IMAGE="ubuntu:jammy-20230308" # Matches vcpkg base image (does not need to be an exact match)
405+
RELEASE_BASE_IMAGE="ubuntu:22.04" # Matches vcpkg base image (does not need to be an exact match)
373406
TAG_BUILD=0
407+
ARCH=""
374408

375409
# Parse command line arguments
376410
while [[ $# -gt 0 ]]
@@ -413,6 +447,11 @@ case $key in
413447
RECONFIGURE=1
414448
shift # past argument
415449
;;
450+
-a|--architecture)
451+
ARCH="$2"
452+
shift # past argument
453+
shift # past value
454+
;;
416455
-h|--help)
417456
usage
418457
exit 0

0 commit comments

Comments
 (0)