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

Building on Mac OS X 11.0 with python 3.6.5 problem with linker flags #1183

Closed
georgid opened this issue Sep 17, 2021 · 1 comment
Closed
Labels

Comments

@georgid
Copy link
Contributor

georgid commented Sep 17, 2021

Hey, I am building with
/Users/joro/.pyenv/shims/python ./waf configure --with-python --pythondir=/Users/joro/.pyenv/versions/my_virtual_env/lib/python3.6/site-packages

and failed with

Setting out to                           : /Users/joro/Download/essentia/build
→ configuring the project in /Users/joro/Download/essentia
→ Building in release mode
Checking for 'clang++' (C++ compiler)    : /usr/bin/clang++
Checking for 'clang' (C compiler)        : /usr/bin/clang

=======================Lightweight Mode : Ignoring ALL libraries except [''] =======================

Checking for 'clang' (C compiler)        : /usr/bin/clang
Checking for program 'python'            : /Users/joro/.pyenv/versions/3.6.5/bin/python
Checking for python version >= 2.7.0     : 3.6.5
→ Configuring for python3
python-config                            : /Users/joro/.pyenv/versions/3.6.5/bin/python-config
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes
Testing pyembed configuration                                      : yes
Asking python-config for pyext '--cflags --libs --ldflags' flags   : yes
**Testing pyext configuration                                        : Could not build python extensions**

The log tells:


['/usr/bin/clang++', '-Wl,-stack_size,1000000', '-bundle', '-undefined', 'dynamic_lookup', 'test.cpp.1.o', '-o/Users/joro/Download/essentia/build/.conf_check_231afabe54c4ebccd2356cebe43bc6aa/testbuild/testprog.cpython-36m-darwin.so', '-framework', 'CoreFoundation', '-L/Users/joro/.pyenv/versions/3.6.5/lib/python3.6/config-3.6m-darwin', '-lpython3.6m', '-ldl', '-lpython3.6m', '-ldl', '-L/usr/local/opt/openssl@1.1/lib']
err: ld: -stack_size option can only be used when linking a main executable
clang: error: linker command failed with exit code 1 (use -v to see invocation)

According to this post and this post the flags -Wl,-stack_size,1000000 are confusing the linker. Is there a way to tell ./waf or to tell python3-config --ldflags to exclude these flags?

@georgid georgid changed the title Building on Mac OS X 11 with python 3.6.5 problem with linker flags Building on Mac OS X 11.0 with python 3.6.5 problem with linker flags Sep 17, 2021
@georgid
Copy link
Contributor Author

georgid commented Mar 19, 2023

It seems that the problem is that the ld flags are populated from the python installation used. You can check them with /path/to/python/bin/python3-config --ldflags
It seems that when using a framework build (from brew or binary ) the ldflags do not contain the problematic -stack_size.
Otherwise using non-framework python (from pyenv or anaconda) they ldflags seem to be there.

If using the latter, a workaround would be to tweak the ctx.env.LDFLAGS in wscript for waf, which is where they are stored at compile time. However, I could not make it work. Check this kovidgoyal/kitty#289

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

No branches or pull requests

2 participants