bonsai icon indicating copy to clipboard operation
bonsai copied to clipboard

got any chances to build bonsai for MacOS?

Open shomeax opened this issue 1 year ago • 4 comments

    from bonsai._bonsai import ldapconnection, ldapsearchiter
E   ImportError: dlopen(/Users/user/.venv/lib/python3.11/site-packages/bonsai/_bonsai.cpython-311-darwin.so, 2): Symbol not found: _ldap_create_passwordpolicy_control
E     Referenced from: /Users/user/.venv/lib/python3.11/site-packages/bonsai/_bonsai.cpython-311-darwin.so
E     Expected in: flat namespace
E    in /Users/user/.venv/lib/python3.11/site-packages/bonsai/_bonsai.cpython-311-darwin.so

shomeax avatar Feb 18 '25 18:02 shomeax

There are wheels for macOS uploaded to pypi, and there's documentation about how to build it from source.

In your case, it seems you linked the system provided old openldap libraries during build.

noirello avatar Feb 19 '25 16:02 noirello

will try, thnx

apparently I have too old Mac)

pip debug --verbose gives the topmost py310-none-macosx_11_0_x86_64 and PyPi least is bonsai-1.5.3-cp311-cp311-macosx_13_0_x86_64.whl

shomeax avatar Feb 19 '25 16:02 shomeax

I'm seeing the same error on my setup, an ARM M1 Mac (Sonoma 14.7.4 (23H420)). I'm not trying to build from source, a wheel would be preferred.

Error: dlopen(.../.venv/lib/python3.13/site-packages/bonsai/_bonsai.cpython-313-darwin.so, 0x0002): symbol not found in flat 
namespace '_ldap_create_passwordpolicy_control'

From the poetry dist-info I think it's looking for tag: cp313-cp313-macosx_14_0_arm64 which is not listed on Pypi: https://pypi.org/project/bonsai/#files

Python:         3.13.2
Implementation: CPython

So, installed openldap with Homebrew. It's brew info mentions:

==> openldap: stable 2.6.9 (bottled) [keg-only]
export LDFLAGS="-L/opt/homebrew/opt/openldap/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openldap/include"

So I ran:

poetry remove bonsai
poetry shell
pip download bonsai
tar xzf bonsai-1.5.3.tar.gz
cd bonsai-1.5.3

I edited setup.cfg to include:

[build_ext]
library_dirs = /opt/homebrew/opt/openldap/lib
include_dirs = /usr/include/sasl:/opt/homebrew/opt/openldap/include

Then continued:

python setup.py build
python setup.py install

Now I get the same error, but mentioning a new path:

Error: 
dlopen(.../.venv/lib/python3.13/site-packages/bonsai-1.5.3-py3.13-macosx-14.7-arm64.egg/bonsai/_bonsai.cpython-313-darwin.so, 
0x0002): symbol not found in flat namespace '_ldap_create_passwordpolicy_control'

I'm not sure what I'm missing or what else to try.

whitehat101 avatar Mar 18 '25 23:03 whitehat101

A new release has been made just now with Python3.13 wheels for macOS.

noirello avatar Jul 20 '25 13:07 noirello