Advertisement

Apple M1 processor MacOS

Started by July 15, 2022 10:21 PM
20 comments, last by WitchLord 2 years, 3 months ago

I managed to reproduce the error on godbolt.org. Apparently clang 13 doesn't like the syntax to disambiguate the class method with AS_METHOD_AMBIGUITY_CAST. By making this macro as nothing the compilation works as it should, i.e:

#define AS_METHOD_AMBIGUITY_CAST(t)

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

WitchLord said:
#define AS_METHOD_AMBIGUITY_CAST(t)

I did some more tests, and it appears this is not a generic solution, it should only be done for the autowrapper macros when there are templates within templates. When using the asMETHODPR macros the AS_METHOD_AMBIGUITY_CAST must be kept as is, otherwise clang won't compile.

I'll investigate more, but it looks like a fix only in aswrappedcall.h is for the WRAP_MFN_PR macro what is needed.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks for all the effort on this.

Hacking that in, my program now builds and runs.

I'd like to run some of the AngelScript tests on this machine to see how it fares. Which of the tests is expected to work - while testing this mode of operation?

The test_feature regression test suite should work (it needs to be compiled with AS_MAX_PORTABILITY).

There might be some tests in the latest WIP that won't work with AS_MAX_PORTABILITY, as I typically only test this mode when closer to releasing a new version. But in that case it just a question of commenting out the tests that use native code.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed the issue with WRAP_MFN_PR in revision 2783. I also included the changes you had made in your git hub mirror,

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Thanks much, I will check this out and come back with any issues I encounter.

I spent some time trying to get the test_feature suite to run – I made a huge mess of things and wasn't getting there.

Hopefully you were able to install a recent version of clang on a Linux machine and beat on things there – it looks like most of these issues were clang issues rather than aarch64 issues. Obviously, getting native calling conventions working will be an aarch64 issue.

Best,

Rob

I'm having trouble with my program crashing now on aarch64 and x86-64. I wanted to narrow the issue to AngelScript or my program. So I spent some time tonight working to get test_feature closer to working on my M1 Mac built with XCode. I got that pretty far along, so it looks likely that my problem is my problem…

Here are the changes I made to get test_feature working.

https://github.com/ramcdona/angelscript-mirror/tree/M1_test_feature

d92974dd0 is probably the most interesting. These are tests that I had to disable, even after I put in some effort to get them to work. They now compile without issue, but segfault when run.

A bunch of the changes are due to the way I'm working with CMake. You'll probably want to ignore most of those.

I may have spoken too soon…

The call stack when my program crashes is very similar to the call stack when those disabled tests crash.

void gw::Wrapper<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (CustomGeomMgrSingleton::*)(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>::f<&(CustomGeomMgrSingleton::AddParm(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))>(asIScriptGeneric*) aswrappedcall.h:340
asCContext::CallGeneric(asCScriptFunction *) as_context.cpp:5688
asCContext::ExecuteNext() as_context.cpp:2846
asCContext::Execute() as_context.cpp:1485

Were you able to run test_feature built with clang?

Thanks again,

Rob

You've done some mistakes when trying to make test_feature work with AS_MAX_PORTABILITY.

1. You needlessly wrap the callback functions. As the callback functions have known signatures they do not need the assembler routines to work with native calling conventions
2. You used WRAP_FN on functions that are already having the generic calling convention (see for example the function Assert)
3. You used WRAP_FN on functions implemented to be used with asCALL_CDECL_OBJLAST/OBJFIRST (see for example the test_unsaferef.cpp). Use WRAP_OBJ_LAST/FIRST instead for these

I've checked in fixes for test_feature to work with AS_MAX_PORTABILITY now. Check out the changes I did in revision 2786.

Regards,
Andreas

PS. No, I haven't had the time to try clang yet.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement