Skip to content

Instantly share code, notes, and snippets.

@frytoli
Last active September 3, 2021 05:25
Show Gist options
  • Save frytoli/f98ee948f54ee4fbaa1cdbee36dbc590 to your computer and use it in GitHub Desktop.
Save frytoli/f98ee948f54ee4fbaa1cdbee36dbc590 to your computer and use it in GitHub Desktop.

Installing Pyicu on Mac

Install icu4c and get the version

$ brew install icu4c

Do what homebrew tells you to do: set necessary env variables

$ echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
$ export LDFLAGS="-L/usr/local/opt/icu4c/lib"
$ export CPPFLAGS="-I/usr/local/opt/icu4c/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

Create an icu-config symlink

This step is done to combat the error Symbol not found: __ZNK6icu_6114Transliterator12getTargetSetERNS_10UnicodeSetE. This, allegedly, is a sign of a "shared library mismatch between the ICU version we are using and the one actually used when building the package" (Thanks Siddharth Das) because OSX has a pre-existing ICU library in /usr/library/libicucore.dylib

ln -s /usr/local/Cellar/icu4c/61.1/bin/icu-config /usr/local/bin/icu-config

Install pyicu with flags

All of these flags might not be necessary, but overkilling it works

ln -s /usr/local/Cellar/icu4c/61.1/bin/icu-config /usr/local/bin/icu-config
PYICU_CFLAGS=-std=c++11 PYICU_LFLAGS=-L/usr/local/opt/icu4c/lib CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu
@frytoli
Copy link
Author

frytoli commented Jun 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment