From 30e0afbaae1364827aeeef00857d3d0f434f5217 Mon Sep 17 00:00:00 2001 From: Matt Lyons Date: Fri, 22 Nov 2024 17:19:37 -0600 Subject: [PATCH] Fix macOS icu dylib loading problems when MacPorts is not installed --- .github/workflows/package-main.yml | 13 ++++++++++++- .github/workflows/publish.yml | 13 ++++++++++++- .github/workflows/test.yml | 14 +++++++++++++- c-sharp/ParanextDataProvider.csproj | 2 +- c-sharp/Program.cs | 3 +++ 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/package-main.yml b/.github/workflows/package-main.yml index bb107f069e..4cad68f6b5 100644 --- a/.github/workflows/package-main.yml +++ b/.github/workflows/package-main.yml @@ -27,10 +27,21 @@ jobs: if: ${{ matrix.os == 'macos-latest' }} uses: melusina-org/setup-macports@v1 + - name: Install loader tools on macOS + if: ${{ matrix.os == 'macos-latest' }} + run: | + sudo port -v install ld64 + - name: Install icu4c on macOS + if: ${{ matrix.os == 'macos-latest' }} + run: sudo port -v install icu @74.2_0 +universal + + - name: Fixup loader paths for icu4c if: ${{ matrix.os == 'macos-latest' }} run: | - sudo port -v install icu + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicuuc.74.dylib + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicui18n.74.dylib + sudo install_name_tool -change /opt/local/lib/libicuuc.74.dylib @loader_path/libicuuc.74.dylib /opt/local/lib/libicui18n.74.dylib - name: Checkout git repo uses: actions/checkout@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ae29240a3f..84d7875eaa 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,10 +27,21 @@ jobs: if: ${{ matrix.os == 'macos-latest' }} uses: melusina-org/setup-macports@v1 + - name: Install loader tools on macOS + if: ${{ matrix.os == 'macos-latest' }} + run: | + sudo port -v install ld64 + - name: Install icu4c on macOS + if: ${{ matrix.os == 'macos-latest' }} + run: sudo port -v install icu @74.2_0 +universal + + - name: Fixup loader paths for icu4c if: ${{ matrix.os == 'macos-latest' }} run: | - sudo port -v install icu + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicuuc.74.dylib + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicui18n.74.dylib + sudo install_name_tool -change /opt/local/lib/libicuuc.74.dylib @loader_path/libicuuc.74.dylib /opt/local/lib/libicui18n.74.dylib - name: Checkout git repo uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f5b8558ba..9f819af5fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,9 +30,21 @@ jobs: if: ${{ matrix.os == 'macos-latest' }} uses: melusina-org/setup-macports@v1 + - name: Install loader tools on macOS + if: ${{ matrix.os == 'macos-latest' }} + run: | + sudo port -v install ld64 + - name: Install icu4c on macOS if: ${{ matrix.os == 'macos-latest' }} - run: sudo port -v install icu + run: sudo port -v install icu @74.2_0 +universal + + - name: Fixup loader paths for icu4c + if: ${{ matrix.os == 'macos-latest' }} + run: | + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicuuc.74.dylib + sudo install_name_tool -change /opt/local/lib/libicudata.74.dylib @loader_path/libicudata.74.dylib /opt/local/lib/libicui18n.74.dylib + sudo install_name_tool -change /opt/local/lib/libicuuc.74.dylib @loader_path/libicuuc.74.dylib /opt/local/lib/libicui18n.74.dylib - name: Check out Git repository uses: actions/checkout@v4 diff --git a/c-sharp/ParanextDataProvider.csproj b/c-sharp/ParanextDataProvider.csproj index 222e08e9a6..ecd2bff7fe 100644 --- a/c-sharp/ParanextDataProvider.csproj +++ b/c-sharp/ParanextDataProvider.csproj @@ -28,7 +28,7 @@ - + diff --git a/c-sharp/Program.cs b/c-sharp/Program.cs index 7e4cfce959..45b667c8d0 100644 --- a/c-sharp/Program.cs +++ b/c-sharp/Program.cs @@ -15,6 +15,9 @@ public static async Task Main() { Console.WriteLine("Paranext data provider starting up"); Thread.CurrentThread.Name = "Main"; + System.Diagnostics.Trace.Listeners.Add(new System.Diagnostics.ConsoleTraceListener()); + System.Diagnostics.Trace.AutoFlush = true; + System.Diagnostics.Trace.WriteLine("Trace logging enabled"); using PapiClient papi = new(); try