godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.95k stars 3.22k forks source link

Instructions for building Godot on Mac OS do not work on Sonoma (14.4) Xcode 14.5 #9898

Open zaddok opened 2 months ago

zaddok commented 2 months ago

Your Godot version:

Godot: 4.3-stable MacOS: 14.4, 14.6.1

Issue description:

The instructions for building Godot on Mac OS (Tested on Sonoma 14.4, and 14.6.1) are incomplete and/or don't work.

When you follow the instructions on the page, to install scons using brew, clone the repo, then use scons the following errors are generated:

godot % scons platform=macos arch=arm64

scons: Reading SConscript files ...
Auto-detected 12 CPU cores available for build parallelism. Using 11 cores by default. You can override it with the -j argument.
Building for macOS 11.0+.
Building for platform "macos", architecture "arm64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling platform/macos/os_macos.mm ...
[Initial build] Compiling platform/macos/godot_application.mm ...
[Initial build] Compiling platform/macos/godot_application_delegate.mm ...
[Initial build] Compiling platform/macos/crash_handler_macos.mm ...
[Initial build] Compiling platform/macos/macos_terminal_logger.mm ...
In file included from platform/macos/godot_application.mm:31:
In file included from platform/macos/godot_application.h:34:
In file included from ./core/os/os.h:34:
In file included from ./core/config/engine.h:34:
In file included from ./core/os/main_loop.h:34:
In file included from ./core/input/input_event.h:35:
In file included from ./core/io/resource.h:34:
In file included from ./core/io/resource_uid.h:34:
In file included from ./core/object/ref_counted.h:34:
In file included from ./core/object/class_db.h:34:
In file included from ./core/object/method_bind.h:34:
In file included from ./core/variant/binder_common.h:35:
In file included from ./core/object/object.h:35:
In file included from ./core/object/message_queue.h:35:
In file included from ./core/os/thread_safe.h:34In file included from :
platform/macos/os_macos.mm:31:
In file included from platform/macos/os_macos.h:35:
In file included from platform/macos/joypad_macos.h:31:
In file included from ./core/input/input.h:34:
In file included from ./core/input/input_event.h:35:
In file included from ./core/io/resource.h:34:
In file included from ./core/io/resource_uid.h:34:
In file included from ./core/object/ref_counted.h:34:
In file included from ./core/object/class_db.h:34:
In file included from ./core/object/method_bind.h:34:
In file included from ./core/variant/binder_common.h:35:
In file included from ./core/object/object.h:35:
In file included from ./core/os/mutex.h:34:
In file included from ./core/error/error_macros.h:36:
In file included from ./core/object/message_queue.h:35:
In file included from In file included from ./core/os/thread_safe.h/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/atomic::34522:
:
In file included from In file included from ./core/os/mutex.h/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__atomic/aliases.h::3420:
:
In file included from ./core/error/error_macros.h/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstdlib::36144:
:In file included from 9/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/atomic:: error: no member named 'at_quick_exit' in the global namespace
522:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__atomic/aliases.h:20:
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstdlib
:144      ~~^:
9: error: no member named 'at_quick_exit' in the global namespace
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstdlib:145:9: error: no member named 'quick_exit' in the global namespace
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/cstdlib:145:9: errorusing ::quick_exit _LIBCPP_USING_IF_EXISTS;
: no member named 'quick_exit' in the global namespace      ~~^

using ::quick_exit _LIBCPP_USING_IF_EXISTS;
      ~~^

There are actually thousands of errors, I have just included up until the first few errors appear.

I wonder if there are other dependencies needed, or if Xcode needs to be a certain version?

URL to the documentation page:

https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_macos.html

zaddok commented 2 months ago

Note that the same problem occurs if you disable Vulcan in a custom.py, or if you include Vulkan like this:

scons platform=macos arch=arm64 vulkan_sdk_path= /Volumes/drive/VulkanSDK/1.3.290.0/

Here is the Xcode/macOS update history in case it could be relevant.

godot % softwareupdate --history
Display Name                                       Version    Date
------------                                       -------    ----
macOS Ventura 13.5                                 13.5       08/07/2023, 14:13:37
Command Line Tools for Xcode                       14.3       08/08/2023, 12:31:41
macOS Ventura 13.5.1                               13.5.1     08/30/2023, 08:00:18
macOS Ventura 13.5.2                               13.5.2     09/12/2023, 15:18:37
Command Line Tools for Xcode                       15.0       09/20/2023, 07:51:11
macOS Sonoma 14.0                                  14.0       10/09/2023, 09:05:23
macOS Sonoma 14.1.2                                14.1.2     12/07/2023, 23:31:17
Command Line Tools for Xcode                       15.1       12/24/2023, 21:55:31
macOS Sonoma 14.2.1                                14.2.1     12/24/2023, 21:57:28
Command Line Tools for Xcode                       15.3       04/19/2024, 23:30:16
macOS Sonoma 14.4.1                                14.4.1     04/19/2024, 23:32:16
macOS Sonoma 14.6.1                                14.6.1     09/04/2024, 15:00:08
olliejudge commented 2 months ago

I ran the compile from 4.3 branch with up to date Xcode and macOS and it ran fine. I believe your error may be to do with your custom.py. Please clarify the content for testing.

This is a follow on from your reddit thread here: https://www.reddit.com/r/godot/comments/1f8ms6n/comment/llg3su5/?context=3

bruvzg commented 2 months ago

Can't reproduce it on macOS 14.6.1 (23G93) with Xcode 15.4 (15F31d). It's likely either your custom.py or something wrong with Xcode install.

scons platform=macos arch=arm64 vulkan_sdk_path= /Volumes/drive/VulkanSDK/1.3.290.0/

There's extra space after = in the command.

zaddok commented 2 months ago

Thank you for letting me know. This means we at least know it works for some Mac's and not others. To be clear I have tried

scons platform=macos arch=arm64
scons platform=macos arch=arm64 vulkan_sdk_path=/Volumes/scripturial/VulkanSDK/1.3.290.0/
scons platform=macos arch=x86_64
scons platform=macos arch=x86_64 vulkan_sdk_path=/Volumes/scripturial/VulkanSDK/1.3.290.0/

I have tried with no custom.py and adding a custom.py.

I also rm -rfed the Command Line Tools folder and did a full reinstall with xcode-select --install

rm -rf /Library/Developer/CommandLineTools
xcode-select --install
zaddok commented 2 months ago

Here is a video showing me typing the commands above, and the errors that appear in full.

https://www.youtube.com/watch?v=b0_Sh2AjHZ0

zaddok commented 1 month ago

After much trial and error. I discovered what I think is the solution. Remove any/all of the following from your path before building:

/Users/user/Library/Android/cmdline-tools/bin
/opt/homebrew/opt/openjdk@17/bin
/Users/user/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/bin/

It looks like some things I had installed to get android builds working are interfering with building godot itself.