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

_MR_atomic_sub_int symbol not found on macOS #110

Open
poldy opened this issue Dec 24, 2022 · 4 comments
Open

_MR_atomic_sub_int symbol not found on macOS #110

poldy opened this issue Dec 24, 2022 · 4 comments

Comments

@poldy
Copy link
Contributor

poldy commented Dec 24, 2022

The full error message is:

dyld[47054]: symbol not found in flat namespace '_MR_atomic_sub_int'

I installed Mercury from homebrew using brew install mercury. This is on an M1 Mac running the latest Ventura. A sequential "hello world" program compiles and runs no problem. And indeed, when I compile the Dining Philosophers sample code with either --parallel or --grade hlc.par.gc it compiles ok, but when I run it gives the above error message.

@juliensf
Copy link
Member

I assume that you are using clang as the C compiler here. The problem is simply that there is not a definition of MR_atomic_sub_int for clang on Aarch64 based systems in the runtime; we will need to add one.
(There is a generic definition for GCC which should work on M1 based systems, although I've not tested that myself,
so installing GCC via homebrew and using that may be an option.)

@poldy
Copy link
Contributor Author

poldy commented Dec 24, 2022

Yes, I'm using clang.

I added the bare minimum of <stdatomic.h> code to get the build to complete. It could be quite a lot of work, but there are some nice features that Mercury could make use of if you introduced a minimum required version of C11.

@juliensf
Copy link
Member

Requiring the use of C11 is not an option in the short to medium term. MSVC only just gained some initial experimental support for C11/C17 style atomics (and I gather even that is not complete). It would make sense for us to starting C11
atomics on platforms where they are supported (i.e. in preference to the inline assembly).

@poldy
Copy link
Contributor Author

poldy commented Feb 13, 2023

I logged PR #114 in an attempt to do this. Feel free to review ...

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