Skip to content
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

Undefined symbols for architecture arm64: "_getmcontext" "_setmcontext" for Mac M1 CPU #183

Open
aivve opened this issue Feb 9, 2022 · 7 comments

Comments

@aivve
Copy link
Collaborator

aivve commented Feb 9, 2022

[ 91%] Linking CXX executable karbowanecd
Undefined symbols for architecture arm64:
  "_getmcontext", referenced from:
      System::Dispatcher::Dispatcher() in libSystem.a(Dispatcher.cpp.o)
      _swapcontext in libSystem.a(Context.c.o)
  "_setmcontext", referenced from:
      _swapcontext in libSystem.a(Context.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@aivve
Copy link
Collaborator Author

aivve commented Mar 10, 2022

For arm mac cpu's need to rewrite Dispatcher

@driquelme
Copy link

Regarding the above comment, the change would require writing arm64 asm code?

@aivve
Copy link
Collaborator Author

aivve commented Mar 30, 2022

Maybe not necessarily asm, perhaps something like Android version

@aivve
Copy link
Collaborator Author

aivve commented Apr 17, 2022

Rewrote asm code but only got segmentation fault.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0

@aivve
Copy link
Collaborator Author

aivve commented Apr 18, 2022

The size of pthread_mutex_t for some reason is 64 whereas on arm64 it should be 48 ??

@aivve
Copy link
Collaborator Author

aivve commented Apr 18, 2022

After df8d9d9 it catchers the error:

ERROR   Exception: Dispatcher::getReusableContext, swapcontext failed, result=22, Invalid argument

not crashes but exits

@aivve
Copy link
Collaborator Author

aivve commented Apr 30, 2022

same exception is caught on lastest Dispatcher version, also replaced context functions by using ucontext.h with the same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants