Statically link libicu for macOS for static_holmes gem
What does this merge request do and why?
static_holmes is a fork of the charlock_holmes gem with a single
change to make it possible to statically link icu4c libraries via the
--enable-static
config option:
gitlab-org/ruby/gems/charlock_holmes!2 (merged)
Note that the --enable-static
flag only works on macOS. Ubuntu Linux doesn't compile the static library with position-independent code (-fPIC
), so link errors result if --enable-static
is used.
Relates to #2062 (closed)
How to set up and validate locally
- On this branch run
make gitlab-bundle-prepare
. This should set--enable-static
forstatic_holmes
. - In your
gitlab
dir, rungit fetch && git checkout sh-use-static-holmes
to check out gitlab!147721 (merged). - Run
bundle install
. - On macOS, take a look at the installed library:
% ls -al ~/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/static_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle
-rwxr-xr-x 1 stanhu staff 34866664 Mar 22 17:37 /Users/stanhu/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/static_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle
Compare that to the original library:
% ls -al ~/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/charlock_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle
-rwxr-xr-x 1 stanhu staff 64664 Feb 29 09:27 /Users/stanhu/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/charlock_holmes-0.7.7/lib/charlock_holmes/charlock_holmes.bundle
- Run
bundle exec irb
and make surecharlock_holmes
still works:
irb(main):001:0> require 'charlock_holmes'
=> true
irb(main):002:0> CharlockHolmes::EncodingDetector.detect('hello world')
=> {:type=>:text, :encoding=>"ISO-8859-1", :ruby_encoding=>"ISO-8859-1", :confidence=>25, :language=>"it"}
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Edited by Stan Hu