Skip to content

Commit

Permalink
Made compatible with macOS mojave
Browse files Browse the repository at this point in the history
After a 10hour-long fight I finally found how to make this work with macOS Mojave. Since apple deprecated stdlibc++, it is necessary to pass the extra argument "-stdlib=libc++" to both the compiler and the linker. Furthermore, as is the case in chokkan/crfsuite#11, I modified the libraries given to the linker.
  • Loading branch information
ldorigo authored Apr 22, 2019
1 parent ff44c49 commit 9890bbb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def get_swigdir():
# need iconv too but without proper -L adding -liconv here won't always work
libs = []

if sys.platform.startswith("darwin"):
# On recent macos versions (mojave) it is necessary to specify that libc++ is used instead of libstdc++.
# Furthermore, '-Wl,-undefined,dynamic_lookup' is necessary to link the right libraries.
libs += ["-stdlib=libc++", '-Wl,-undefined,dynamic_lookup']
extra_compile_args = ["-stdlib=libc++"]


simstring_module = Extension(
'_simstring',
sources = [
Expand Down

0 comments on commit 9890bbb

Please sign in to comment.