-
-
Notifications
You must be signed in to change notification settings - Fork 922
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
Linker fails with "-stack_size option can only be used when linking a main executable" #289
Comments
kitty does not use -stack_size in its build. That is coming from some other component on your system, if I had to guess, miniconda. Use a python installed via brew instead and you will be fine. |
You're totally right about that. Compiling with my brew-installed python 3.6 worked perfectly:
I'm posting this because it might help people in a similar situation to navigate around this roadblock. How would you feel about keeping this issue open until we figure out the best way to resolve this incompatibility in general? |
I dont see how this has anything to do with kitty. Basically miniconda is compiling python with the -stack_size option. It should remove that option from the generated sysconfig.py file, which is where flags used to compile python modules are stored and where applications like kitty that want to build python modules are supposed to read them from. I am not going to implement logic to try to sanitize the flags sysconfig.py supplies, since that is highly compiler dependent and a moving target. |
Thank you for your insight, because I didn't have it. Looks like we have two issues already upstream:
I understand what you're saying, that this is not a problem with Kitty. I do think this is a valuable situation to be able to look at with respect to the upstream issue, which in turn has relevance in terms of being a hindrance to potential users trying to install Kitty and having no clue why the build isn't succeeding. |
Yes, this has nothing to do with kitty, true. I'm glad I found this issue. Thanks for saving me some time investigating it. I'm using Python 3.6.5 from pyenv, which apparently has the same issue as miniconda. Still, in case anyone wants a quick n' dirty change just to run diff --git a/setup.py b/setup.py
index b9f0a57e..c6c79bb4 100755
--- a/setup.py
+++ b/setup.py
@@ -126,7 +126,7 @@ def get_python_flags(cflags):
libs += [
'-lpython' + sysconfig.get_config_var('VERSION') + sys.abiflags
]
- libs += sysconfig.get_config_var('LINKFORSHARED').split()
+ libs += sysconfig.get_config_var('LINKFORSHARED').replace('-Wl,-stack_size,1000000', '').split()
return libs
Just bear in mind this flag sanitization should not – and is not going to – be part of kitty. |
If you're using pyenv, a less invasive work-around might be to just run 'pyenv local system' in your kitty build area and call it a day :) Worked great for me! |
Would be nice having some of this information in the docs, would have saved me a couple of hours. |
Another quick solution : So I deactivate from miniconda base and then ran make, it work fine for me
My solution :
|
@kovidgoyal, this seems to be coming up again. It now looks like many more distributions of Python are including the Python 3 packaged with macOS 12.3: ❯ /usr/bin/python3 -c "import sysconfig; print(sysconfig.get_config_var('LINKFORSHARED'))"
-Wl,-stack_size,1000000 -framework CoreFoundation Python3.framework/Versions/3.8/Python3 Python 3 installed by Homebrew: ❯ /opt/homebrew/bin/python3 -c "import sysconfig; print(sysconfig.get_config_var('LINKFORSHARED'))"
-Wl,-stack_size,1000000 -framework CoreFoundation /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/Python Additionally I don't know much about this stuff, but it does seem to me like, at least today (as opposed to when this issue was originally opened), that something about |
@malob: LINKFORSHARED is only used for non-framework builds of python. The default and recommended way to build python on macos is using a framework build. When using a framework build, linkforshared is not used at all so what it defaults to is irrelevant. |
Trying to build from source on macOS 10.13.2.
As soon as it gets to linking, it errors with
-stack_size option can only be used when linking a main executable
:The text was updated successfully, but these errors were encountered: