-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
llvm11: clang error when building c++ hello world on arm-linux-musleabi -mcpu=generic+v6kz (__libcpp_signed_lock_free) #6573
Comments
Issue has been found: Lines 2764 to 2781 in 7067764
Apparently on arm none of the ATOMIC_{}_LOCK_FREE are set to 2 thus there is no support for signed/unsigned lock-free types. But in that case typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; should not be defined.
llvm-project trunk does not have a fix for this, so the following patch has to be applied: diff --git a/zig/lib/libcxx/include/atomic b/zig/lib/libcxx/include/atomic
index 9c2898653..bf037726f 100644
--- a/zig/lib/libcxx/include/atomic
+++ b/zig/lib/libcxx/include/atomic
@@ -2775,10 +2775,15 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free;
#else
// No signed/unsigned lock-free types
+#define LOCK_FREE_NOT_AVAILABLE
#endif
+#ifndef LOCK_FREE_NOT_AVAILABLE
typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free;
typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
+#endif
+
+#undef LOCK_FREE_NOT_AVAILABLE
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v} |
We can carry this patch, but first it should be sent upstream and accepted upstream so that we will eventually merge our fork back to match upstream with the next release. |
This deserves to be tagged |
https://reviews.llvm.org/D75183 sent upstream but seems abandoned atm for lack of tests included in patch if anyone wants to resume the work later |
Just checking: Is it expected that, with 0.10.0, I now get:
? This used to compile fine with 0.9.1. |
What is the status of this issue? Commit 3997828 just added a fatal error in src/Compilation.zig for ARM. And it seems there is no way to test if this is fixed in current libc++ because you cannot set |
Simple work around now: use zig 0.9.1
|
Any status update now that llvm16 is merged? |
It seems this issue has been fixed in https://reviews.llvm.org/D118391 |
Hi folks, I have tested the latest master zig-bootstrap (llvm 16.0.1), with the limitation above unlocked, and I can successfully compile a c++ program for the target arm-linux-musleabihf now. I can try to create a PR for this, but I am not sure if removing the limitation part is enough. |
@haohaolee Yes, please go ahead so that we can fix any possible problems - the current situation prevents any testing at all! |
When building a simple c++ hello world with llvm11 branch (llvm 11.0.0-rc5) (
zig c++ example-cc.cpp -target arm-linux-musleabi -mcpu=generic+v6kz
):We get the following error:
Related: https://reviews.llvm.org/D75183
cc @LemonBoy
The text was updated successfully, but these errors were encountered: