I'm getting this error while packaging for Android using UE 5.2:

UATHelper: Packaging (Android (ETC2)): D:/Projects/Poppy and Buddy 5.2/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp(301,27): error: temporary whose address is used as value of local variable 'fromChar' will be destroyed at the end of the full-expression [-Werror,-Wdangling]
UATHelper: Packaging (Android (ETC2)): const char *fromChar = TCHAR_TO_UTF8(*data.From);
UATHelper: Packaging (Android (ETC2)): ^~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ETC2)): D:/UE_5.2/Engine/Source/Runtime/Core/Public/Containers/StringConv.h(962,39): note: expanded from macro 'TCHAR_TO_UTF8'
UATHelper: Packaging (Android (ETC2)): #define TCHAR_TO_UTF8(str) (ANSICHAR*)FTCHARToUTF8((const TCHAR*)str).Get()
UATHelper: Packaging (Android (ETC2)): ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ETC2)): D:/Projects/Poppy and Buddy 5.2/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp(302,25): error: temporary whose address is used as value of local variable 'toChar' will be destroyed at the end of the full-expression [-Werror,-Wdangling]
UATHelper: Packaging (Android (ETC2)): const char *toChar = TCHAR_TO_UTF8(*data.To);
UATHelper: Packaging (Android (ETC2)): ^~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ETC2)): D:/UE_5.2/Engine/Source/Runtime/Core/Public/Containers/StringConv.h(962,39): note: expanded from macro 'TCHAR_TO_UTF8'
UATHelper: Packaging (Android (ETC2)): #define TCHAR_TO_UTF8(str) (ANSICHAR*)FTCHARToUTF8((const TCHAR*)str).Get()
UATHelper: Packaging (Android (ETC2)): ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ETC2)): 2 errors generated.
PackagingResults: Error: temporary whose address is used as value of local variable 'fromChar' will be destroyed at the end of the full-expression [-Werror,-Wdangling]
PackagingResults: Error: temporary whose address is used as value of local variable 'toChar' will be destroyed at the end of the full-expression [-Werror,-Wdangling]

I'm on the latest commit of the 4.1 branch. Is this a known issue? Is there a fix?

Related Discussions
...

No, this is not a known issue. What Android NDK are you using?

    Mario It's reporting back r21b, I'm struggling to get it to use r25b.

    Confirming that "const char toChar = TCHAR_TO_UTF8(data.To); ... Error: temporary whose address is used as value of local variable 'fromChar' will be destroyed at the end of the full-expression [-Werror,-Wdangling] "
    was affecting iOS Packaging also (UE5.2). The new update resolved the issue.

    Hi Mario,
    One more question regarding compiling with Xcode (Visual Studio / PC works). Getting this error and failure on MacOS, Please advise:

    "Showing All Messages
    [6/20] Compile [Apple] Module.SpinePlugin.3_of_3.cpp
    In file included from /Users/xxx/Perforce/clones/Wormwood/Animacio/Unreal/Wormwood5.2/Plugins/SpinePlugin/Intermediate/Build/Mac/arm64/UnrealEditor/Development/SpinePlugin/Module.SpinePlugin.3_of_3.cpp:26:
    Vector<Polygon *> &SkeletonBounds::getPolygons() {
    ^
    /Users/xxx/Perforce/clones/Wormwood/Animacio/Unreal/Wormwood5.2/Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp/src/spine/SkeletonBounds.cpp:193:8: reference to 'Polygon' is ambiguous
    typedef MacPolygon Polygon;
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/Headers/Quickdraw.h:267:41: candidate found by name lookup is 'Polygon'
    class Polygon : public SpineObject {
    ^
    In file included from /Users/xxx/Perforce/clones/Wormwood/Animacio/Unreal/Wormwood5.2/Plugins/SpinePlugin/Intermediate/Build/Mac/arm64/UnrealEditor/Development/SpinePlugin/Module.SpinePlugin.3_of_3.cpp:26:
    /Users/xxx/Perforce/clones/Wormwood/Animacio/Unreal/Wormwood5.2/Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp/include/spine/SkeletonBounds.h:110:8: candidate found by name lookup is 'spine:😛olygon'
    Vector<Polygon *> &SkeletonBounds::getPolygons() {
    ^
    /Users/xxx/Perforce/clones/Wormwood/Animacio/Unreal/Wormwood5.2/Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp/src/spine/SkeletonBounds.cpp:193:8: reference to 'Polygon' is ambiguous
    typedef MacPolygon Polygon;
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/Headers/Quickdraw.h:267:41: candidate found by name lookup is 'Polygon'
    class Polygon : public SpineObject {
    ^
    2 errors generated."

    In SkeletonBounds:
    Vector<Polygon *> &SkeletonBounds::getPolygons() {
    return _polygons;
    }
    thrown error is: reference to 'Polygon' is ambiguous

    Thank you,
    Ivan

    Seem to have resolved the problem by modifying SkeletonBounds:
    Vector<spine: : Polygon *> &SkeletonBounds::getPolygons() {
    return _polygons;
    }

    Is this a correct approach? Thanks Ivan

    5 days later

    Sorry for the delayed response! Yes, that's the correct fix. It's what's in the 4.1 branch now.