Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error on macOS #2

Closed
keigoi opened this issue Sep 9, 2022 · 0 comments
Closed

Linking error on macOS #2

keigoi opened this issue Sep 9, 2022 · 0 comments

Comments

@keigoi
Copy link

keigoi commented Sep 9, 2022

Hello! When I try to compile a code that uses pyre-ast as a library, I get the following error, indicating a linking-time error:

File "bin/dune", line 3, characters 7-11:
3 |  (name main)
           ^^^^
Undefined symbols for architecture x86_64:
  "_libintl_bind_textdomain_codeset", referenced from:
      __locale_bind_textdomain_codeset in libpython.a(_localemodule.o)
  "_libintl_bindtextdomain", referenced from:
      __locale_bindtextdomain in libpython.a(_localemodule.o)
  "_libintl_dcgettext", referenced from:
      __locale_dcgettext in libpython.a(_localemodule.o)
  "_libintl_dgettext", referenced from:
      __locale_dgettext in libpython.a(_localemodule.o)
  "_libintl_gettext", referenced from:
      __locale_gettext in libpython.a(_localemodule.o)
  "_libintl_setlocale", referenced from:
      __locale_setlocale in libpython.a(_localemodule.o)
      __locale_localeconv in libpython.a(_localemodule.o)
  "_libintl_textdomain", referenced from:
      __locale_textdomain in libpython.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

After some searching on the web, I found the following related issue:
beeware/Python-Apple-support#91

And they suggests temporarily hiding /usr/local/* from the system.

The following workaround works for me:

# rename /usr/local/* so that they won't affect the compilation of Python3 under the vendor/ directory
sudo -s sh -c "mv /usr/local/lib /usr/local/lib0; mv /usr/local/include /usr/local/include0"
# now install pyre-ast
opam install pyre-ast
# recover the renamed directories
sudo -s sh -c "mv /usr/local/lib0 /usr/local/lib; mv /usr/local/include0 /usr/local/include"

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants