Fix macOS icu dylib loading problems when MacPorts is not installed #1346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To decipher the changes made:
+universal
to the MacPorts install of icu libs or we only get libs matching the architecture of the build machine (i.e., x64 or arm64). That would leave one architecture always broken, and it would vary which is broken depending on whether an arm64 or x64 machine was used for building. Universal libraries are basically containers that contain 2 libraries, one for x64 and one for arm64. Our build process doesn't provide a simple way to build separately for different architectures, so including universal libraries is a simple fix even though it makes the download larger since you'll always include code that isn't for your architecture. Because I'm not sure if every build of ICU on MacPorts will include universal libs, I locked in the version number to one that does.dylib
so it doesn't look for its dependentdylibs
only in the path where they were on the machine used to build the ICUdylib
files originally that we download from MacPorts. As it stands now, when you load one of the ICUdylib
s, it always looks for its dependencies under/opt/local/lib
. Unless the machine running Platform.Bible has ICU installed from MacPorts (which puts them under/opt/local/lib
), then loading ICUdylib
s will not work in P.B. Apple provides a tool (install_name_tool
) that can rewrite locations inside of a library where to look for each dependency.icu.net
might use them, but P.B does not.icu.net
to one that includes trace logging if loading ICU libraries fails. I updated the .NET program to log that extra trace information to the console when running on macOS. I didn't add it for other OSes for now. We can always adjust that later easily.This change is