I have a JNI module and I'm trying to cross compile with GitHub action and the org.codehaus.mojo:native-maven-plugin
maven plugin, so I wrote the following workflow that worked before I added the installation of the package arm-linux-androideabi-g
that the docker image can't find:
elaborate-native-module:
name: Elaborate native module (${{ matrix.os }} ${{ matrix.architecture }})
strategy:
fail-fast: false
max-parallel: 2
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
java: [18]
architecture: [x86, x64]
exclude:
- os: macOS-latest
architecture: x86
runs-on: ${{ matrix.os }}
steps:
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
architecture: ${{ matrix.architecture }}
- if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x64')
name: Set up C/C compiler
run: |
sudo apt update
sudo apt-get -y install g -aarch64-linux-gnu arm-linux-androideabi-g
- if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x86')
name: Set up C/C compiler
run: |
sudo apt update
sudo apt-get -y install doxygen vera zlib1g-dev libsnappy-dev \
g -multilib
- if: startsWith(matrix.os, 'windows-latest') && startsWith(matrix.architecture, 'x86')
name: Set up C/C compiler
uses: egor-tensin/setup-mingw@v2
with:
platform: ${{ matrix.architecture }}
- uses: actions/checkout@v2
- name: Build native library
run: mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -DskipTests=true --file ./native/pom.xml
- if: startsWith(matrix.os, 'ubuntu-latest') && startsWith(matrix.architecture, 'x64')
name: Build native library for aarch64
run: |
mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Paarch64-for-unix-x64 -DskipTests=true --file ./native/pom.xml
mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Parm-eabi-for-unix-x64 -DskipTests=true --file ./native/pom.xml
- if: github.event_name == 'push' && (endsWith(github.event.head_commit.message, 'Releasing new version') || contains(github.event.head_commit.message, 'Generating external artifacts'))
name: Push native library
run: |
git config user.name "${{ github.event.head_commit.committer.name }}"
git config user.email "${{ github.event.head_commit.committer.email }}"
git pull origin ${{github.ref}}
git add .
git commit -am "Generated native library on ${{ matrix.os }} ${{ matrix.architecture }}" --allow-empty
git push
... But the workflow fails with this message:
Fetched 8180 kB in 2s (4256 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
15 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package arm-linux-androideabi-g
... The code line that doesn't work is sudo apt-get -y install g -aarch64-linux-gnu arm-linux-androideabi-g
: how can I solve?
CodePudding user response:
Try with sudo apt-get -y install g -aarch64-linux-gnu g -arm-linux-gnueabi
. The related compilation executable is arm-linux-gnueabi-g