-
Notifications
You must be signed in to change notification settings - Fork 246
Fix nanobind on MacOS #2132
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
Fix nanobind on MacOS #2132
Conversation
Cool thanks for the PR
Probably just an oversight. It looks like the CMake configuration adds the hypen as you suggest:
Make sure you have updated your tags from the upstream repo:
then you can run |
Thanks for a quick reply. Then it seems to maybe be the reason. I was primarily thinking about building my program with the new wrapdb without it being merged. But a sanity check is of course always good to do as well! |
Someone else likely has a more robust way of doing it, but you can try editing the files in your projects |
Thanks! I can at least then confirm that adding (And now I have some totally unrelated errors that I only saw on CI, but not locally earlier, so probably a hint for those as well as a bonus. But not at all related to nanobind, so I think this is good to go.) |
Previously, the linker args for stripping were only applied As a further thought, one might consider making stripping conditional on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 60: if get_option('buildtype') == 'shared'
This test is wrong. The variable buildtype
is for debug
or release
, etc.
What is wanted here is probably default_library
.
The goal of this code is to allow the main project to get the flags it needs to build libnanobind.so
, if that is desired.
It's an advanced use case, say for an extension that builds ten or more python modules and so wants to build libnanobind.so
rather than statically linking that functionality into all ten python modules.
Thanks! Did I understand correctly that line 60 should look like in the second commit? (At least it may not be more incorrect than the current...) |
Yes. Thank you, Oscar. |
@jpakkane as you merged the latest version, would you mind taking a look at this? |
I get the following problem with the latest nanobind wrap:
both in the CI and when building locally.
Now, I am far from a linker expert, but as far as I can tell, the x comes from
wrapdb/subprojects/packagefiles/nanobind/meson.build
Line 55 in c068c10
but I would guess that the idea is that it should be
-Wl,-x
Strange thing is that this x has been around since the initial version of the wrap, but I have never triggered it before. However, I also note the build process is a bit different for my project, with just a single nanobind-files being compiled
instead of about ten earlier. So this is nice, but also seems to trigger this issue.
CC: @hpkfft - you didn't change the linker flag, but maybe know more about what could have changed and why I now trigger that path (which, again, is an improvement, except for the bug)
@WillAyd - you created the first version. Is the
-Wl,x
instead of-Wl,-x
a typo or am I missing something?Btw, is there a good way to test a new wrap locally?