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
Error build Python with Intel compiler: <stdatomic.h> doesn't provide atomic_uintptr_t #81596
Comments
I'm trying to build Python 3.7 on CentOS 7 with Intel compilers. To compile I do the following: export CC=icc ./configure --prefix=my_prefix --enable-optimizations --without-gcc In the configure, no error is seen, but when I execute make, the following message is printed: Running code to generate profile data (this can take a while): First, we need to create a clean build with profile generationenabled.make profile-gen-stamp compilation aborted for ./Programs/python.c (code 2) |
atomic_uintptr_t is used if HAVE_STD_ATOMIC defined is defined. Can you please check in pyconfig.h if it's defined? So <stdatomic.h> doesn't provide atomic_uintptr_t with ICC? |
In pyconfig.h the variable HAVE_STD_ATOMIC appears like this: /* Has stdatomic.h with atomic_int */
#define HAVE_STD_ATOMIC 1 I searched at <stdatomic.h> atomic_uintptr_t and found nothing. |
That's not good. I expectd std to stand for standard. I expected that atomic_uintptr_t would always be available on <stdatomic.h>. GCC defines the type as: typedef _Atomic __UINTPTR_TYPE__ atomic_uintptr_t; Maybe you should try: typedef struct _Py_atomic_address {
_Atomic Py_uintptr_t _value;
} _Py_atomic_address; |
Two things. I searched a bit more and found "atomic_uint" inside <stdatomic.h>, but it's not exactly the same as what you wrote. What you have put me to try, where do I put it? I attached <stdatomic.h> in case it helps. |
I suggested you to test the following change on the master branch of Python: diff --git a/Include/internal/pycore_atomic.h b/Include/internal/pycore_atomic.h
index 336bc3fec2..c624a0cf1c 100644
--- a/Include/internal/pycore_atomic.h
+++ b/Include/internal/pycore_atomic.h
@@ -44,7 +44,7 @@ typedef enum _Py_memory_order {
} _Py_memory_order;
typedef struct _Py_atomic_address {
- atomic_uintptr_t _value;
+ _Atomic uintptr_t _value;
} _Py_atomic_address;
typedef struct _Py_atomic_int { |
Is it available with -std=c11? It is a bit strange that we use -std=c99. I thought that header is C11: |
I have the same problem on RH6 with icc 2019.4 and Python 3.6.9. Do you want a new bug for that? |
No idea how to define a "_Py_atomic_address" type with icc 2019.4 in this case. If someone has a working patch, I can review it ;-) |
We have been experiencing the same problem with compiling Python-3.7.4 on a system with CentOS 7.6 (aka glib-2.17): Intel Compiler 2019.6 implements stdatomic.h. but lacks the definition of atomic_uintptr_t. From a configure-point of view just failing to define HAVE_STDATOMIC_H would suffice. The following patch works for us to compile. Granted, the "proper" way would be to add another configure check for the underlying type and not blurry the check for stdatomic.h -- but then again, Intel should just implement all of C11... |
I wrote PR 16717 which uses a similar approach than python.patch. |
Can someone please test PR 16717 with ICC? |
I marked bpo-35473 as duplicate of this issue. |
According to Adam J. Stewart, my PR 16717 fix the Python build on ICC: So I merged it in 3.7, 3.8 and master branches. Adam saw other failures, but it's unrelated issues which should be reported separately. Thanks for the bug report Borja. It should now be fixed. Until a new Python version is released with the fix, you should either apply the patch manually or use a different compiler. GCC and Clang are well supported on Linux for example. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: