Closed junglie85 closed 2 years ago
Hey @junglie85,
thanks for reporting this issue. Is the library really at /opt/homebrew/Cellar/glfw/3.3.4
, not somethin like /opt/homebrew/Cellar/glfw/3.3.4/libglfw3.dylib
or a similar filename ending in .dylib
or .so
? If the PYGLFW_LIBRARY
location is correct, could you please check the architecture of your python installation and of the glfw library?
Hey @FlorianRhiem,
I've checked and all seems to be correct. I've even downloaded directly from GLFW website rather than via Brew or similar.
ls ~/opt/glfw-3.3.4/lib-arm64/
libglfw.3.dylib libglfw3.a
PYGLFW_LIBRARY=/Users/junglie85/opt/glfw-3.3.4/lib-arm64/libglfw.3.dylib
❯ python
Python 3.9.6 (default, Aug 24 2021, 08:50:49)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', '')
>>> platform.machine()
'arm64'
>>>
Yet, still the same error.
What happens if you do the following:
import os
import ctypes
print(ctypes.CDLL(os.environ['PYGLFW_LIBRARY']))
To fix this, I manually added /opt/homebrew/lib
to the glfw search path like so:
search_paths = [
'',
package_path,
sys.prefix + '/lib',
'/usr/lib64',
'/usr/local/lib64',
'/usr/lib', '/usr/local/lib',
'/run/current-system/sw/lib',
'/opt/homebrew/lib/', # <= here
'/usr/lib/x86_64-linux-gnu/',
'/usr/lib/aarch64-linux-gnu/',
]
This is because Homebrew installs to /opt/homebrew
on apple silicon macs (link) instead of /usr/local/
(well, technically ARM stuff installs to /opt/homebrew
).
Opened a PR 😄 https://github.com/FlorianRhiem/pyGLFW/pull/58
@junglie85 Does the issue persist?
I have just released version 2.4.0, along with wheels for macOS and arm64. This should fix this issue. As @junglie85 hasn't replied, I assume the workaround has worked for him as well.
Fails to find GLFW on Mac M1:
Also cannot load manually installed GLFW
PYGLFW_LIBRARY=/opt/homebrew/Cellar/glfw/3.3.4
.