Open ermshiperete opened 1 year ago
See also #141
Since the Slack discussion may not be accessible to everyone (e.g., any open-source contributors who might find this), here's the important parts from the discussion:
Relevant code from source/icu.net/NativeMethods/NativeMethods.cs:
Relevant comment from Slack discussion:
It looks like we always assume non-Windows OSes name their libraries with
.so
. However, macOS (at least Catalina) usesdylib
files, notso
files. Also, while we assume theicuuc
library would belibicuuc.so.[version]
, on macOS it looks like the file pattern islibicuuc.[version].dylib
. On top of that, I only see icu4c available on macOS if you install Homebrew or build it yourself. (libicuuc is part of the icu4c package)
It looks like #142 was an attempt to fix this issue, but didn't completely solve it.
https://github.com/sillsdev/TheCombine/issues/927 is probably caused by this as well.
@rmunn I was hoping to try out a fix on my mac: https://github.com/sillsdev/icu-dotnet/compare/master...imnasnainaec:icu-dotnet:mac
...but I'm not sure how to build on/for macOSX to test it out.
(Attempting: https://github.com/sillsdev/icu-dotnet/pull/188)
@ermshiperete What is the state of this issue?
At least for its use in The Combine, the current hurdle is getting icu-dotnet
to find my libicuuc
. I'm not sure yet whether there's more required from the icu-dotnet
side of things or if it's a matter of local setup.
One issue I've discovered is that depending on how you installed icu4c, the installed .dylib
files might not be on the standard library search path. Yesterday we tried running brew install icu4c
and it installed libicuuc.74.2.dylib
(and a libicuuc.74.dylib
symlink) into /opt/homebrew/Cellar/icu4c/lib
(I think, I'll have to go back and check).
One thing that might help is https://github.com/sickcodes/Docker-OSX which builds off the work done by https://github.com/kholia/OSX-KVM. Running Mac OS in a Docker container might allow automated testing, so we can make sure icu.net can find the libraries in all common install scenarios.
For Platform.Bible we bundle in the icu4c libraries along with our application builds so we don't have to worry about this. Since OSX doesn't provide them we assume we can't rely on them being anywhere in the path.
For reference, prs #194, #198, #200 were toward resolving this issue.
macOS uses
dylib
files instead ofso
and the file pattern islibicuuc.[version].dylib
instead oflibicuuc.so.[version]
, so our current approach for loading unmanaged ICU doesn't work.The relevant code is in
source/icu.net/NativeMethods/NativeMethods.cs
.See discussion on Slack.