Skip to content

Fix FFLAGS for older GCC versions - remove unsupported -fallow-argume… #6

Fix FFLAGS for older GCC versions - remove unsupported -fallow-argume…

Fix FFLAGS for older GCC versions - remove unsupported -fallow-argume… #6

# Temporary workflow for testing IpOpt Linux build with GCC 8 in Docker.
# This workflow tests the compatibility of the built libraries by:
# 1. Building in an Ubuntu 18.04 Docker container with GCC 8 for maximum compatibility
# 2. Uploading the native libraries as artifacts
# 3. Running tests on a clean Ubuntu runner to verify the libraries work
name: Test IpOpt Linux Build
on:
push:
branches:
- copilot/update-ci-pipeline-ubuntu-1804
workflow_dispatch:
# Limit permissions for security
permissions:
contents: read
jobs:
# Job 1: Build IpOpt in Ubuntu 18.04 Docker container
# We use Docker because Ubuntu 18.04/20.04 runners are no longer available.
# Ubuntu 18.04 has GCC 7 as its default compiler, which produces binaries
# compatible with older glibc and libstdc++ versions.
build:
name: Build IpOpt in Docker (Ubuntu 18.04)
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
# Build inside Ubuntu 18.04 container with all necessary dependencies
- name: Build IpOpt in Docker Container
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
ubuntu:18.04 \
bash -c '
set -e
echo "==> Installing build dependencies..."
apt-get update
# Install GCC 7 (default on Ubuntu 18.04), Fortran compiler, build tools,
# and libraries needed for MUMPS/IpOpt build.
# pkg-config is required for configure to detect lapack/blas.
# gfortran needs libgfortran-7-dev for Fortran compilation to work.
apt-get install -y \
build-essential \
gcc \
g++ \
gfortran \
libgfortran-7-dev \
libblas-dev \
liblapack-dev \
pkg-config \
curl \
git \
patchelf \
ca-certificates
echo "==> Verifying compiler versions..."
gcc --version
g++ --version
gfortran --version
# Test that Fortran compiler works
echo "==> Testing Fortran compiler..."
echo "program test; print *, \"Hello\"; end program" > /tmp/test.f90
gfortran /tmp/test.f90 -o /tmp/test && /tmp/test
echo "==> Fortran compiler works!"
echo "==> Running build script..."
chmod +x ./buildIpOptLinux.sh
./buildIpOptLinux.sh
echo "==> Build complete!"
'
# Verify library dependencies on the host runner
- name: Verify Library Dependencies
run: |
echo "==> Verifying library dependencies for libipopt.so..."
cd libs/Native/IpOptSharp/linux/AMD64
echo "==> Libraries in output directory:"
ls -lh
echo ""
echo "==> Dependencies for libipopt.so:"
ldd libipopt.so || true
shopt -s nullglob
for lib in libgfortran.so.* libgcc_s.so.* libquadmath.so.*; do
echo ""
echo "==> Dependencies for $lib:"
ldd "$lib" || true
done
shopt -u nullglob
echo ""
echo "==> Verification complete!"
# Upload the native libraries as artifacts for the test job
- name: Upload Native Libraries
uses: actions/upload-artifact@v4
with:
name: ipopt_linux_x64_test
path: libs/Native/IpOptSharp/linux/AMD64/
# Job 2: Test on a clean Ubuntu runner
# This simulates a user environment that doesn't have the build tools installed
test:
name: Test on Clean Runner
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
# Download the built native libraries
- name: Download Native Libraries
uses: actions/download-artifact@v4
with:
name: ipopt_linux_x64_test
path: libs/Native/IpOptSharp/linux/AMD64/
# Verify the downloaded libraries
- name: Verify Downloaded Libraries
run: |
echo "==> Verifying downloaded libraries..."
cd libs/Native/IpOptSharp/linux/AMD64
echo "==> Libraries in directory:"
ls -lh
echo ""
echo "==> Dependencies for libipopt.so (on clean runner):"
ldd libipopt.so || true
shopt -s nullglob
for lib in libgfortran.so.* libgcc_s.so.* libquadmath.so.*; do
echo ""
echo "==> Dependencies for $lib:"
ldd "$lib" || true
done
shopt -u nullglob
echo ""
echo "==> All dependencies should resolve without 'not found' errors"
# Setup .NET and run tests
- name: Install Dotnet
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore Tools
run: dotnet tool restore
- name: Restore
run: dotnet paket restore
- name: Test IpOpt
run: dotnet test src/IpOptSharp.Tests/IpOptSharp.Tests.fsproj