Skip to content

try not specify -L /usr/aarch64-linux-gnu/ #44

try not specify -L /usr/aarch64-linux-gnu/

try not specify -L /usr/aarch64-linux-gnu/ #44

Workflow file for this run

name: main
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '**.linq'
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: x64
- os: linux
arch: x86
- os: linux
arch: arm64
env:
GMP_VERSION: 6.3
GMP_SO: libgmp.so.10.5.0
GMP_CPP_SO: libgmpxx.so.4.7.0
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Toolchain (arch-specific)
run: |
sudo apt-get update
if [ "${{ matrix.arch }}" = "x86" ]; then
sudo apt-get install -y gcc-multilib g++-multilib
elif [ "${{ matrix.arch }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt-get install -y qemu-user
fi
- name: Download GMP Source
run: |
git clone --depth 1 https://github.com/gmp-mirror/gmp-${GMP_VERSION}.git
- name: Autoreconf
run: |
cd gmp-${GMP_VERSION}
autoreconf -ivf
- name: Configure GMP
run: |
cd gmp-${GMP_VERSION}
if [ "${{ matrix.arch }}" = "x86" ]; then
./configure \
--host=i686-pc-linux-gnu \
--enable-shared --disable-static --enable-fat --enable-cxx
elif [ "${{ matrix.arch }}" = "arm64" ]; then
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ \
./configure \
--host=aarch64-linux-gnu \
--enable-shared --disable-static --enable-fat --enable-cxx
else
./configure \
--enable-shared --disable-static --enable-fat --enable-cxx
fi
- name: Build GMP
run: |
cd gmp-${GMP_VERSION}
make MAKEINFO=true
- name: Check .libs
run: |
cd gmp-${GMP_VERSION}/.libs
ls -l
file ${GMP_SO}
- name: Strip GMP Library
run: |
cd gmp-${GMP_VERSION}/.libs
if [ "${{ matrix.arch }}" = "arm64" ]; then
aarch64-linux-gnu-strip --strip-unneeded ${GMP_SO}
aarch64-linux-gnu-strip --strip-unneeded ${GMP_CPP_SO}
else
strip --strip-unneeded ${GMP_SO}
strip --strip-unneeded ${GMP_CPP_SO}
fi
- name: Compile C Program
run: |
if [ "${{ matrix.arch }}" = "x86" ]; then
gcc -m32 -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
elif [ "${{ matrix.arch }}" = "arm64" ]; then
aarch64-linux-gnu-gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
else
gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
fi
- name: Run C Program
run: |
if [ "${{ matrix.arch }}" = "arm64" ]; then
LD_LIBRARY_PATH=${{ github.workspace }}/gmp-${GMP_VERSION}/.libs qemu-aarch64 ${GITHUB_WORKSPACE}/factorial_gmp
else
LD_LIBRARY_PATH=${{ github.workspace }}/gmp-${GMP_VERSION}/.libs ./factorial_gmp
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}
path: |
${{ github.workspace }}/gmp-${{ env.GMP_VERSION }}/gmp.h
${{ github.workspace }}/gmp-${{ env.GMP_VERSION }}/gmpxx.h
${{ github.workspace }}/gmp-${{ env.GMP_VERSION }}/.libs/${{ env.GMP_SO }}
${{ github.workspace }}/gmp-${{ env.GMP_VERSION }}/.libs/${{ env.GMP_CPP_SO }}