[3.8.1] Use XCode 15.3 (MACOSX 14.4.1) Build iOS & mac platform failed

I just upgraded my macbook to newest version (MACOSX 14.4.1), and upgraded to XCode 15.3.
Then I created new empty project with Cocos Creator v3.8.1 .
Try to test a simple, empty build, but failed when XCode builds (or using Cocos Creator ‘make’ button).
All failed on compiling AudioPlayer.mm, about std::function.

The following is the build error logs. Can anyone help? We need to upgrade our MAC build machine soon.

4 warnings generated.
In file included from /Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioPlayer.mm:30:
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:55:37: error: no template named 'function' in namespace 'std'
    void addPlayCallback(const std::function<void()> &callback);
                               ~~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:57:37: error: no template named 'function' in namespace 'std'
    void addLoadCallback(const std::function<void(bool)> &callback);
                               ~~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:91:24: error: no member named 'function' in namespace 'std'
    ccstd::vector<std::function<void()>> _playCallbacks;
                  ~~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:91:40: error: expected member name or ';' after declaration specifiers
    ccstd::vector<std::function<void()>> _playCallbacks;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:94:24: error: no member named 'function' in namespace 'std'
    ccstd::vector<std::function<void(bool)>> _loadCallbacks;
                  ~~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:94:42: error: expected '(' for function-style cast or type construction
    ccstd::vector<std::function<void(bool)>> _loadCallbacks;
                                     ~~~~^
/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/audio/apple/AudioCache.h:94:44: error: expected member name or ';' after declaration specifiers
    ccstd::vector<std::function<void(bool)>> _loadCallbacks;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
7 errors generated.


2024-3-31 21:53:02-log: [cmake] note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'EmptyBuild')
note: Run script build phase 'Generate CMakeFiles/genbindings' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'genbindings' from project 'EmptyBuild')
note: Run script build phase 'Generate CMakeFiles/ALL_BUILD' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ALL_BUILD' from project 'EmptyBuild')


2024-3-31 21:53:02-error: [cmake-err] ** BUILD FAILED **


2024-3-31 21:53:02-log: [task:make]: Error: run cmake failed "cmake --build "/Users/riverwang/Work/Cocos/EmptyBuild/build/ios/proj" --config Debug -- -allowProvisioningUpdates -quiet -sdk iphonesimulator -arch x86_64", code: 65, signal: null, 36.66666666666667%
2024-3-31 21:53:02-warn: Error: run cmake failed "cmake --build "/Users/riverwang/Work/Cocos/EmptyBuild/build/ios/proj" --config Debug -- -allowProvisioningUpdates -quiet -sdk iphonesimulator -arch x86_64", code: 65, signal: null
    at ChildProcess.<anonymous> (/Applications/Cocos/Creator/3.8.1/CocosCreator.app/Contents/Resources/resources/3d/engine/scripts/native-pack-tool/source/utils.ts:483:28)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)

2024-3-31 21:53:02-log: [task:make]: Run build plugin native : make failed!, 23.333333333333332%
2024-3-31 21:53:02-debug: // ---- builder:run-build-stage-make ---- (104465ms)
2024-3-31 21:53:02-log: [task:make]: failed!
2024-3-31 21:53:02-error: make package /Users/riverwang/Work/Cocos/EmptyBuild/build/ios failed!
2024-3-31 21:53:02-debug: [Build Memory track]: builder:build-stage-total make start:283.64MB, end 288.87MB, increase: 5.23MB

1 Like

Did you find a resolution to this one? I just started running into the same problem on my system/project.

you just need to add

#include <functional>

in the AudioCache.h file

not worked…

@reichtiger Fix a compilation error if using xcode 15.3 by dumganhar · Pull Request #16849 · cocos/cocos-engine · GitHub fixed it. And it is the same as @Kumamon38 said.