- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem to compile OpenMPI 4.1.1 by Intel Classic Compiler, which is included in Intel OneAPI HPC Toolkit 2021.4. Here is the command that I used.
./configure --prefix=/usr/local/opt/openmpi/4.1.1 CC=icc CXX=icpc CFLAGS='-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include'
When I used above command, I met an error below.
configure: error: ptrdiff_t type is not available, this is required by C99 standard. Cannot continue
I found that 'stddef.h', which enveloped with ICC, has ptrdiff_t type definition.
(location is /opt/intel/oneapi/compiler/latest/mac/compiler/include/icc/stddef.h')
What should I do to resolve the problem?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are able to reproduce your issue at our end. We are working on your issue internally and we will get back to you soon.
Thanks & Regards,
Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Santosh,
Thanks for your kind reply.
I will wait your test results.
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not so sure what happened but I don't think it is compiler issue.
Looking at your provided config.log, I saw so many errors:
conftest.c(10): error #2379: cannot open source file "string.h"
#include <string.h>
conftest.c(52): catastrophic error: cannot open source file "minix/config.h"
#include <minix/config.h>
conftest.c(80): error #2379: cannot open source file "zlib.h"
#include <zlib.h>
conftest.c(83): error: expected a ";"
error: this is not __NetBSD__
^
..... .....
Can you compile this test program to see if you still having issue with ptrdiff_t?
$ cat t2.c
#include <stdio.h>
#include <stddef.h>
int main()
{
const int N = 50;
int tmps[N];
int *int1=&tmps[20], *int2=&tmps[24];
ptrdiff_t diff_is = int2 - int1;
printf("int2 - int1 = %td\n", diff_is);
return 0;
}
$ icc t2.c &&./a.out
int2 - int1 = 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet
Thank you for your kind reply.
I have done your request.
Compiling 't2.c' make an error that icc cannot find the 'stdio.h'. This is because icc do not know the header file location.
icc t2.c
t2.c(1): catastrophic error: cannot open source file "stdio.h"
#include <stdio.h>
For that reason, I used '-isysroot' command for compilation.
Here is the command, which was also used in compiling OpenMPI.
icc -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk t2.c
Since I introduced the header files directory to icc by '-isysroot' tag, 't2.c' was compiled and worked in Mac.
./a.out
int2 - int1 = 4
There is a page that give the solution when people stuck in use of icc in Mac .
Is there a problem to use '-isysroot'?
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is clearly there are some issues with your ENV, which icc couldn't find header files. I wonder if gcc does the same?
This is your original command line for compiling conftest.c
icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict conftest.c >&5
conftest.c(175): error: identifier "ptrdiff_t" is undefined
if (sizeof (ptrdiff_t))
What happens if you do:
icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict t2.c? Will it fail to compile?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
Thanks for your fast reply.
I agree with your opinion.
I did search in google and I found that some people were suffering the same problem.
As you requested, I entered the command you gave me.
icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict t2.c
Mac did not give any error and objective file was made successfully.
I attached the screenshot of my terminal.
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, the same command line (used for conftest.c) worked on a simple test case. Could be that STDC_HEADERS isn't defined in your ENV, which then excluded stddef.h?
configure:21860: icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict conftest.c >&5
conftest.c(175): error: identifier "ptrdiff_t" is undefined
if (sizeof (ptrdiff_t))
^
compilation aborted for conftest.c (code 2)
configure:21860: $? = 2
configure: failed program was:
| /* confdefs.h */
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
One thing you can try is to go to the directory where conftest.c resides, then run "icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict conftest.c"
To see if you still get the same error on ptrdiff_t?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
I have a problem. I cannot find the location of 'confides.h'.
I expect that the file resides in 'openmpi' directory, but it is not.
Did you know where is the file created during configuration?
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I extracted it from your config.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
I tested the attached code, which was extracted from 'config.log'.
The terminal showed that the compiler cannot identify 'ptrdiff_t' type.
icc -c -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict conftest.c
conftest.c(174): error: identifier "ptrdiff_t" is undefined
if (sizeof (ptrdiff_t))
As you pointed out, STDC_HEADERS was not defined in my environment, so 'stddef.h' was not included in the 'contest.c'.
I will define STDC_HEADERS manually and try to compile 'openmpi'.
And then, I will report the result in this page.
Thanks Viet!
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested with set up environment variable as below in zsh.
export STDC_HEADERS=1
However, I still get the same message that icc cannot find the type 'ptrdiff_d'.
Is there any suggestion?
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about adding -DSTDC_HEADERS to the command line?
icc -c -O3 -DNDEBUG -DSTDC_HEADERS -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -std=gnu11 -finline-functions -fno-strict-aliasing -restrict conftest.c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
As your suggestion, I did not meet the 'ptrdiff_t' problem. Thank you so much Viet.
Below command is that I used in macOS (BigSur 11.6). During configuration, CXXFLAGS are also required. Thus, I copy the CFLAGS.
./configure --prefix=/usr/local/opt/openmpi/4.1.1 CC=icc CXX=icpc CFLAGS='-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -DSTDC_HEADERS' CXXFLAGS='-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/opt/intel/oneapi/compiler/latest/mac/compiler/lib -I/opt/intel/oneapi/compiler/latest/mac/compiler/include -DSTDC_HEADERS'
However, I faced another problem during making process.
It seems the c language grammar problem. Do you have any suggestion?
I think that I need to test older version of OpenMPI (e.g. 3.x.x).
make -j2
Making all in config
make[1]: Nothing to be done for `all'.
Making all in contrib
make[1]: Nothing to be done for `all'.
Making all in opal
Making all in include
/Library/Developer/CommandLineTools/usr/bin/make all-am
Making all in datatype
CC libdatatype_reliable_la-opal_datatype_pack.lo
CC libdatatype_reliable_la-opal_datatype_unpack.lo
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(406): error: expected a ")"
static inline uint32_t htonl(uint32_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(406): warning #2171: declaration hides built-in function "__builtin_constant_p"
static inline uint32_t htonl(uint32_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(407): error: expected a ")"
static inline uint32_t ntohl(uint32_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(406): error: expected a ")"
static inline uint32_t htonl(uint32_t hostvar) { return hostvar; }
^
../../opal/include/opal_config_bottom.h(407): error: function "__builtin_constant_p" has already been defined
static inline uint32_t ntohl(uint32_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(408): error: function "__builtin_constant_p" is not a type name
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
../../opal/include/opal_config_bottom.h(406): warning #2171: declaration hides built-in function "__builtin_constant_p"
from opal_datatype_unpack.c(25):
static inline uint32_t htonl(uint32_t hostvar) { return hostvar; }
^
../../opal/include/opal_config_bottom.h(408): error: expected a ")"
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(408): error: "__uint16_t" has already been declared in the current scope
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(408): error #141: unnamed prototyped parameters not allowed when body is present
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(407): error: expected a ")"
static inline uint32_t ntohl(uint32_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(408): error: identifier "hostvar" is undefined
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(407): error: function "__builtin_constant_p" has already been defined
static inline uint32_t ntohl(uint32_t netvar) { return netvar; }
In file included from ../../opal/include/opal_config.h(3090),
^
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(409): error: function "__builtin_constant_p" is not a type name
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
In file included from ../../opal/include/opal_config.h(3090),
../../opal/include/opal_config_bottom.h(408): error: function "__builtin_constant_p" is not a type name
from opal_datatype_unpack.c(25):
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
../../opal/include/opal_config_bottom.h(409): error: expected a ")"
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(408): error: expected a ")"
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(409): error: function "__uint16_t" has already been defined
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
In file included from ../../opal/include/opal_config.h(3090),
../../opal/include/opal_config_bottom.h(408): error: "__uint16_t" has already been declared in the current scope
from opal_datatype_unpack.c(25):
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
../../opal/include/opal_config_bottom.h(409): error #141: unnamed prototyped parameters not allowed when body is present
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(408): error #141: unnamed prototyped parameters not allowed when body is present
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
In file included from ../../opal/include/opal_config.h(3090),
^
from opal_datatype_unpack.c(25):
../../opal/include/opal_config_bottom.h(409): error: identifier "netvar" is undefined
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(408): error: identifier "hostvar" is undefined
static inline uint16_t htons(uint16_t hostvar) { return hostvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(409): error: function "__builtin_constant_p" is not a type name
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(409): error: expected a ")"
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(409): error: function "__uint16_t" has already been defined
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(409): error #141: unnamed prototyped parameters not allowed when body is present
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
In file included from ../../opal/include/opal_config.h(3090),
from opal_datatype_pack.c(24):
../../opal/include/opal_config_bottom.h(409): error: identifier "netvar" is undefined
static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
^
compilation aborted for opal_datatype_pack.c (code 2)
compilation aborted for opal_datatype_unpack.c (code 2)
make[2]: *** [libdatatype_reliable_la-opal_datatype_pack.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [libdatatype_reliable_la-opal_datatype_unpack.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, seems like you have some other ENV issues. You may need to try with gcc/g++ first to see if it works then switch to icc/icpc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
I'm sorry to reply late.
Before I tray to compile with icc, I have compiled with gcc/g++ and clang. At that time, I did not find any problem.
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank for the input. We have seen that when your env setup correctly then icc worked. Thus, I am not sure how ./configure setting up the ENV, but even "string.h" could not be found in your config.log
conftest.c(10): error #2379: cannot open source file "string.h"
#include <string.h>
^
You may try to compare gcc's configure with icc's to see what are the differences.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi SangHyuk Yoo,
One thing we noticed that you are on BigSur 11.6, which isn't a supported OS in oneAPI 2021 Update 4.
Can you try on a supported OS to see if the problem still persists?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
I'm sorry to reply late. I just moved so that I cannot test it right now.
Anyway, my OS is too latest version (OS X 11.6) to be supported by ICC.
If I can downgrade my OS version, I will try it.
Thank you very much for every help.
Sincerely,
SangHyuk Yoo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Viet,
I tried to downgrade my OS version, but I failed to do it because of an unknown reason in my Macbook.
I should use OpenMPI with the default C compiler in Mac until ICC will support the current OS version.
I really appreciate your advice.
Sincerely,
SangHyuk Yoo

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page