classification
Title: Error build Python with Intel compiler: doesn't provide atomic_uintptr_t
Type: compile error Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Glenn Johnson, Saszalez, cberger, skrah, vstinner
Priority: normal Keywords:

Created on 2019-06-26 15:32 by Saszalez, last changed 2019-08-12 13:22 by vstinner.

Files
File name Uploaded Description Edit
stdatomic.h Saszalez, 2019-06-27 21:51
Messages (9)
msg346637 - (view) Author: Borja (Saszalez) Date: 2019-06-26 15:32
I'm trying to build Python 3.7 on CentOS 7 with Intel compilers. To compile I do the following:

export CC=icc
export CXX=icpc
export FC=ifort

./configure --prefix=my_prefix --enable-optimizations --without-gcc
make
make install

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 generation
# enabled.
make profile-gen-stamp
make[1]: se ingresa al directorio `/home/python/source/Python-3.7.3'
Building with support for profile generation:
make build_all_generate_profile
make[2]: se ingresa al directorio `/home/python/source/Python-3.7.3'
make build_all CFLAGS_NODIST=" -prof-gen" LDFLAGS_NODIST=" -prof-gen" LIBS="-lcrypt -lpthread -ldl  -lutil"
make[3]: se ingresa al directorio `/home/python/source/Python-3.7.3'
icc -pthread -c -Wsign-compare -Wunreachable-code -DNDEBUG -g  -O3 -Wall    -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -Werror=implicit-function-declaration -fp-model strict -prof-gen  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
icc: command line warning #10006: ignoring unknown option '-Wno-cast-function-type'
In file included from ./Include/Python.h(75),
                 from ./Programs/python.c(3):
./Include/pyatomic.h(39): error: identifier "atomic_uintptr_t" is undefined
      atomic_uintptr_t _value;
      ^

compilation aborted for ./Programs/python.c (code 2)
msg346639 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-26 15:42
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?
msg346716 - (view) Author: Borja (Saszalez) Date: 2019-06-27 08:07
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.
msg346739 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-27 14:25
> 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;
msg346778 - (view) Author: Borja (Saszalez) Date: 2019-06-27 21:51
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.
msg346785 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-27 23:23
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 {
msg348268 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2019-07-21 23:05
Is it available with -std=c11? It is a bit strange that we use -std=c99. I thought that header is C11:

https://en.cppreference.com/w/c/atomic
msg349081 - (view) Author: Christian Berger (cberger) Date: 2019-08-05 22:19
I have the same problem on RH6 with icc 2019.4 and Python 3.6.9. Do you want a new bug for that?
Changing Include/pyatomic.h to use _Atomic as suggested by Victor in msg346785 leads to the error that _Atomic was undefined.
msg349471 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-12 13:22
> Changing Include/pyatomic.h to use _Atomic as suggested by Victor in msg346785 leads to the error that _Atomic was undefined.

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 ;-)
History
Date User Action Args
2019-08-12 13:22:26vstinnersetmessages: + msg349471
2019-08-05 22:19:00cbergersetnosy: + cberger
messages: + msg349081
2019-07-21 23:05:43skrahsetnosy: + skrah
messages: + msg348268
2019-07-21 22:49:54Glenn Johnsonsetnosy: + Glenn Johnson
2019-06-27 23:23:02vstinnersetmessages: + msg346785
2019-06-27 21:51:32Saszalezsetfiles: + stdatomic.h

messages: + msg346778
2019-06-27 14:25:35vstinnersetmessages: + msg346739
title: Error build Python with Intel compiler -> Error build Python with Intel compiler: <stdatomic.h> doesn't provide atomic_uintptr_t
2019-06-27 08:07:42Saszalezsetmessages: + msg346716
2019-06-26 15:42:01vstinnersetnosy: + vstinner
messages: + msg346639
2019-06-26 15:32:47Saszalezcreate