- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icpc shows the following error when it is compiled with "-std=c++17" However, it is okay with "-std=c++11" and "-std=c++14".
ICPC version: 19.0.4.243 20190416
OS : RHEL 7.6 / X86-64
--------------------------------
icpc -std=c++17 -ltbb foo.cpp -o foo
/tmp/icpcSHeQQ3.o: In function `main':
foo.cpp:(.text+0x46): undefined reference to `__builtin_is_constant_evaluated'
<<< foo.cpp >>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
int n = stoi(argv[1]);
vector<int> vec(10);
return 0;
}
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't have RHEL7.6, but tried on 7.4 and didn't see the error.
spdlvme080 tmp]$ cat foo.cpp
#include <vector>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
int n = stoi(argv[1]);
vector<int> vec(10);
return 0;
}
spdlvme080 tmp]$ icpc foo.cpp -std=c++17 -ltbb
spdlvme080 tmp]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)
spdlvme080 tmp]$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had a similar issue (error referring to builtin_is_constant_evaluated), but with the following differences:
1) It was a new error that came when I upgraded the gcc backend to gcc 9, due to the fact that there are such sections in GCC headers:
# if __GNUC__ >= 9
# define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1
# endif
...
#if __cplusplus >= 201402L
#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
if (__builtin_is_constant_evaluated())
#else
if (__builtin_constant_p(__x > __y))
#endif
#endif
2) The problem only arose when using -std=c++14 or higher, as can be seen from the lines above.
3) It was fixed when I upgraded the Intel Compiler from 2019.3.199 to 2019.4.243.
Which gcc version are you using as the backend?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I now ran your test case and found out that the error I had been seeing with 2019.3.199 was a compile time error (rather than an undefined reference):
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/9.1.0.1-0b417/x86_64-centos7/bin/../include/c++/9.1.0/bits/ios_base.h(46),
from /cvmfs/sft.cern.ch/lcg/releases/gcc/9.1.0.1-0b417/x86_64-centos7/bin/../include/c++/9.1.0/ios(42),
from /cvmfs/sft.cern.ch/lcg/releases/gcc/9.1.0.1-0b417/x86_64-centos7/bin/../include/c++/9.1.0/ostream(38),
from /cvmfs/sft.cern.ch/lcg/releases/gcc/9.1.0.1-0b417/x86_64-centos7/bin/../include/c++/9.1.0/iostream(39),
from foo.C(1):
/cvmfs/sft.cern.ch/lcg/releases/gcc/9.1.0.1-0b417/x86_64-centos7/bin/../include/c++/9.1.0/bits/stl_function.h(437): error: identifier "__builtin_is_constant_evaluated" is undefined
if (__builtin_is_constant_evaluated())
^
compilation aborted for foo.C (code 2)
And I can confirm the link time error you are seeing with 2019.4.243:
$ cat foo.C
#include <iostream>
int main() {
std::cout << "hello" << std::endl;
return 0;
}
$ icpc -v
icpc version 19.0.4.243 (gcc version 9.1.0 compatibility)
$ icpc -std=c++17 -o foo foo.C
ld: /tmp/icpcr89KGh.o: in function `std::char_traits<char>::length(char const*)':
foo.C:(.text._ZNSt11char_traitsIcE6lengthEPKc[_ZNSt11char_traitsIcE6lengthEPKc]+0x6): undefined reference to `__builtin_is_constant_evaluated'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To Bastian:
Thank you for the confirmation on the error and sharing the details on the cause of the error.
I confirmed that
* icpc --std=c++17 is fine with g++ 7.3.1.
* icpc --std=c++17 generates the errow when g++ is 9.1
I am currently using the latest icpc, which is 19.0.4.243 (gcc version 9.1.0 compatibility)
Here are my tests.
$ source /opt/intel/bin/iccvars.sh intel64
$ gcc --version
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ icpc --version
icpc (ICC) 19.0.4.243 20190416
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
$ icpc -std=c++17 foo.cpp <-- it is fine !!!
$
$source gcc91ActiviationShellScript
$ gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ source /opt/intel/bin/iccvars.sh intel64
(base) [sunwoo@localhost cpp]$ icpc -std=c++17 foo.cpp
/tmp/icpcfC3MFV.o: In function `main':
foo.cpp:(.text+0x46): undefined reference to `__builtin_is_constant_evaluated'
(base) [sunwoo@localhost cpp]$
To Viet:
Thank you for testing this.
As I mentioned above, if you use g++ 9.1.0, I think you will get the same error.
Thanks,

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