ManimCommunity / ManimPango

Binding for Pango, to use with Manim.
https://manimpango.manim.community
MIT License
41 stars 13 forks source link

symbol not found in flat namespace #91

Closed GLanguage closed 1 year ago

GLanguage commented 1 year ago

I have recently turned to use a MacBook with M1, whose architecture is arm64. It seems that manimpango does not work well on my new Mac due to architecture issues. To fix this, I have used an arm64 brew to reinstall pango and an arm64 pip (python 3.10) to reinstall manimpango (I have used this approach to fix my cairo issues and it worked). However, the issue has not been fixed and when I import manimpango it throws:

>>> import manimpango
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/__init__.py", line 14, in <module>
    from .cmanimpango import *  # noqa: F403,F401
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/cmanimpango.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_cairo_create)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/__init__.py", line 35, in <module>
    raise ImportError(msg)
ImportError: 

ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:

    * ManimPango v0.4.1, Python v3.10.6

If you believe there is a greater problem,
feel free to contact us or create an issue on GitHub:

    * Discord: https://www.manim.community/discord/
    * GitHub: https://github.com/ManimCommunity/ManimPango/issues

Original error: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/cmanimpango.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_cairo_create)

I know it is an architecture problem, but where is it?

naveen521kk commented 1 year ago

Not sure if I can help in this case, I'm not familiar with how these work on a Mac. One thing I would suggest is to install everything from brew (like pango, Cairo, including python) and then mostly this should work.

GLanguage commented 1 year ago

I installed everything from brew except for python. Reinstalling python is a difficult and complicated work, but I will try that if there is no other solutions.

GLanguage commented 1 year ago

Has anyone run into similar situations?

GLanguage commented 1 year ago

I have just solved the problem by reinstalling clang. It seems that my clang used to be x86 as it was directly transferred from my old x86 mac. I reinstalled an arm64 clang and the problem disappeared.

naveen521kk commented 1 year ago

Thanks for returning and documenting the problem. Glad it got fixed! I'll close this issue then.