chore(deps): statically link icu4c libraries for macOS

What does this MR do and why?

On Homebrew, icu4c constantly is updated, which breaks the gitlab-elasticsearch-indexer binary. Just as we do in charlock_holmes gem, statically link the icu4c libraries to avoid this constant breakage.

Note that we can't do this on Linux distributions because the statically library usually isn't compiled with -fPIC.

How to set up and validate locally

Run:

make clean
make
otool -L bin/gitlab-elasticsearch-indexer

The output should not show icu4c libraries:

bin/gitlab-elasticsearch-indexer:
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 2000.63.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 4109.1.255)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61901.40.77)

The binary is also large (110 MB):

% ls -al bin/gitlab-elasticsearch-indexer
-rwxr-xr-x@ 1 stanhu  staff  114831186 Nov 17 15:49 bin/gitlab-elasticsearch-indexer

On main, it shows something like this:

bin/gitlab-elasticsearch-indexer:
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/homebrew/opt/icu4c@77/lib/libicui18n.77.dylib (compatibility version 77.0.0, current version 77.1.0)
	/opt/homebrew/opt/icu4c@77/lib/libicuuc.77.dylib (compatibility version 77.0.0, current version 77.1.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 4109.1.255)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61901.40.77)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)

The binary is 79 MB:

% ls -al bin/gitlab-elasticsearch-indexer
-rwxr-xr-x@ 1 stanhu  staff  82384434 Nov 17 15:49 bin/gitlab-elasticsearch-indexer
Edited by Stan Hu

Merge request reports

Loading