Skip to content

Commit

Permalink
Fix macOS icu dylib loading problems when MacPorts is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
lyonsil committed Nov 23, 2024
1 parent b114439 commit a1e7fd8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/package-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ 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
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: Checkout git repo
uses: actions/checkout@v4
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ 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
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: Checkout git repo
uses: actions/checkout@v4
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,22 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion c-sharp/ParanextDataProvider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="icu.net" Version="2.10.0" />
<PackageReference Include="icu.net" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.1" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
Expand Down
8 changes: 8 additions & 0 deletions c-sharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public static async Task Main()
Console.WriteLine("Paranext data provider starting up");
Thread.CurrentThread.Name = "Main";

// Turn on additional logging to help diagnose failures on macOS
if (OperatingSystem.IsMacOS())
{
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
{
Expand Down

0 comments on commit a1e7fd8

Please sign in to comment.