-
Notifications
You must be signed in to change notification settings - Fork 4
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 the builds on macOS (universal). #26
Conversation
09bc08b
to
b4123c2
Compare
Looks like the macOS build is passing, though Windows is failing. Curious, as I didn't touch the Windows builds. Maybe it's affected by the |
test/python.gdextension
Outdated
@@ -5,7 +5,7 @@ entry_symbol = "python_extension_init" | |||
|
|||
[libraries] | |||
|
|||
macos = "res://bin/macos/libgodot-python.macos.framework" | |||
macos = "res://bin/macos/libgodot-python.macos.universal.dylib" |
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.
I don't know the difference here, but maybe there's a tag to be added after macos
so that both can be listed?
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.
The difference between the dylib is explained in my PR text. TL;DR dylib and framework use the same binary but with a slightly different folder structure. Both cannot be supported since the gdextension must choose one path for the tags at hand.
I don't think anything you did broke anything, my guess is |
I do have one tip for you. Windows builds were very stubborn in my own project, until I adopted include-what-you-use for my includes. Being verbose with includes stabilizes include order across systems and was the final thing I needed to compile on all systems reliably. Since Windows is failing around a reference to |
This PR includes #29 now so that the runners can pass. |
I managed to run Godot and execute some python code! 🥳 The binary needs to be patched after build like so:
I added that to SConstruct to be performed automatically. It's probably not the cleanest solution to do it as a post-action (the expected path may be changeable elsehow), but it works. I get the icons and can move them with the arrow keys: |
@maiself Are you following the godot engine policy of 1 commit squashed pull request? |
@fire Out of habit I've been following Blender's policy of a linear rebased history. |
My personal preference is to have a merge commit per pull request. I am not picky about single commit or sequence of commits, but it helps me a lot to have the merge commit. |
I'm the opposite, I've always found it easier if merge commits are avoided so that the history is easier to navigate, bisection is easier, rebasing if needed is easier etc. Can you give insight into how having merge commits helps you? |
I just realized the 'universal' macOS build was a lie: The libpython is single-arch, so we cannot have a proper universal build. I updated everything to match. aarch64 builds should work fine though when we add a target for it. Besides, Godot also uses two separate builds for universal, joining them after the fact. Godot-CPP is inconsistent with Godot upstream in this right now (see: godotengine/godot-cpp#1613). |
if platform == 'macos': | ||
# Rename the library id (which we depend on) to be in @rpath. | ||
# (it defaults to /install/lib/) | ||
subprocess.run(['install_name_tool', '-id', f'@rpath/{lib_filename}', src_lib_path], check=True) |
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.
This should maybe be performed on the copy instead, but that doesn't work because the copy isn't what is being linked, rendering the id change useless, and the final binary links to /install/lib/
.
3daa317
to
93967c0
Compare
589655f
to
990d8eb
Compare
Horray! Thanks a bunch for the help! |
A few comments:
std::quick_exit
std::quick_exit
is not supported on macOS. For the replacement call I referenced this change:wesnoth/wesnoth@6ce218f#diff-fc3beea58bc7268f70c24a27ee7f556f6440c92ebb72d7db4ff321b82cec4df4R182
(Oh, i didn't even realize it was from wesnoth. Nice!)
libs
The line
(v.removeprefix('-l') for v in value.split())
failed for the following error:I printed
print(config_vars.link_libs)
to get the following result:CoreFoundation is technically a library, but it doesn't compile with it:
Since it compiles fine without it, I conclude none of my items are libraries. I'm sure there's a reason the line is there, so I opted to just include the libraries if they actually do start with
-l
(even if there aren't any that do on my end).strip -s
strip -s
is not supported as that in macOS. But to strip dylibs,-x
is needed. I opted to just separate the 2 lines, it's likely more differences may emerge in the future.dylib vs framework
On macOS, both dylibs and frameworks are supported. On iOS, only
.framework
is supported..framework
and.dylib
have the same binary but slightly different directory structures. The reason godot-cpp defaults to.framework
is for consistency to iOS, as well as for signing the binary later. This is not important for now since the python extension supports neither iOS nor signing currently. Besides, godot's loading of.framework
remains spotty, and I don't want to fiddle with SConstruct too much for now. We can switch over later.framework
later when it becomes relevant.More work
The current build still has 3 warnings:
At least the final warning is probably relevant for arm macs, but we can address it later. For now,
libgodot-python.macos.universal.dylib
is built, and that's better than before.I have not yet tested the library in action.
Edit: I have now, it works.