Skip to content

Commit

Permalink
8293098: GHA: Harmonize GCC version handling for host and cross builds
Browse files Browse the repository at this point in the history
Reviewed-by: ihse, clanger
  • Loading branch information
shipilev committed Aug 31, 2022
1 parent 38377d5 commit 923c952
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/build-cross-compile.yml
Expand Up @@ -29,17 +29,14 @@ on:
workflow_call:
inputs:
gcc-major-version:
required: false
required: true
type: string
default: '10'
apt-gcc-version:
required: false
required: true
type: string
default: '10.3.0-1ubuntu1~20.04'
apt-gcc-cross-suffix:
required: false
apt-gcc-cross-version:
required: true
type: string
default: 'cross1'

jobs:
build-cross-compile:
Expand Down Expand Up @@ -95,8 +92,8 @@ jobs:
sudo apt-get install \
gcc-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \
g++-${{ inputs.gcc-major-version }}=${{ inputs.apt-gcc-version }} \
gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \
g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-version }}${{ inputs.apt-gcc-cross-suffix }} \
gcc-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \
g++-${{ inputs.gcc-major-version }}-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}=${{ inputs.apt-gcc-cross-version }} \
libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }}
Expand Down Expand Up @@ -143,8 +140,8 @@ jobs:
--openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}
--with-sysroot=sysroot
--with-build-jdk=${{ steps.buildjdk.outputs.jdk-path }}
CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-10
CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-10
CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }}
CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }}
- name: 'Build'
id: build
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/build-linux.yml
Expand Up @@ -42,6 +42,13 @@ on:
required: false
type: string
default: '[ "debug", "release" ]'
gcc-major-version:
required: true
type: string
gcc-package-suffix:
required: false
type: string
default: ''
apt-gcc-version:
required: true
type: string
Expand Down Expand Up @@ -101,8 +108,8 @@ jobs:
fi
sudo apt-get update
sudo apt-get install --only-upgrade apt
sudo apt-get install gcc-${{ inputs.apt-gcc-version }} g++-${{ inputs.apt-gcc-version }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }}=${{ inputs.apt-gcc-version }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }}=${{ inputs.apt-gcc-version }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }}
- name: 'Configure'
run: >
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/main.yml
Expand Up @@ -123,7 +123,8 @@ jobs:
uses: ./.github/workflows/build-linux.yml
with:
platform: linux-x64
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
# The linux-x64 jdk bundle is used as buildjdk for the cross-compile job
if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true'

Expand All @@ -133,7 +134,9 @@ jobs:
uses: ./.github/workflows/build-linux.yml
with:
platform: linux-x86
apt-gcc-version: '10-multilib'
gcc-major-version: '10'
gcc-package-suffix: '-multilib'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
apt-architecture: 'i386'
# Some multilib libraries do not have proper inter-dependencies, so we have to
# install their dependencies manually.
Expand All @@ -149,7 +152,8 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
extra-conf-options: '--disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -161,7 +165,8 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -173,7 +178,8 @@ jobs:
platform: linux-x64
make-target: 'hotspot'
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -186,7 +192,8 @@ jobs:
make-target: 'hotspot'
# Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
debug-levels: '[ "debug" ]'
apt-gcc-version: '10=10.3.0-1ubuntu1~20.04'
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
if: needs.select.outputs.linux-x64-variants == 'true'

Expand All @@ -196,6 +203,10 @@ jobs:
- select
- build-linux-x64
uses: ./.github/workflows/build-cross-compile.yml
with:
gcc-major-version: '10'
apt-gcc-version: '10.3.0-1ubuntu1~20.04'
apt-gcc-cross-version: '10.3.0-1ubuntu1~20.04cross1'
if: needs.select.outputs.linux-cross-compile == 'true'

build-macos-x64:
Expand Down

1 comment on commit 923c952

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.