Software Archive
Read-only legacy content
17061 Discussions

[MPSS 3.6.1, Windows] Cross compiling with -std=c++11 fails

Stefan_F
Beginner
603 Views

Hi!

I upgraded from MPSS 3.4.6 to 3.6.1 today and am now facing difficulties compiling my native MIC application.

Including <algorithm> and compiling with C++ 11 produces a slew of errors in x86intrin.h. Apparently the headers for intrinsics reference some non-existent compiler built-ins.

You can easily reproduce the problem by compiling

#include <algorithm>

int main(int argc, char** argv) {
}

with

icl /Qmic -std=c++11 mictest.cpp -o test

The result is several errors of the form

In file included from C:/Program Files/Intel/MPSS//x86_64-mpsssdk-linux/usr/lib/k1om-mpss-linux/gcc/k1om-mpss-linux/5.1.1/include/x86intrin.h(76),
                 from C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/k1om-mpss-linux/bits/opt_random.h(33),
                 from C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/random(50),
                 from C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/bits/stl_algo.h(66),
                 from C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/algorithm(62),
                 from mictest.cpp(1):
C:/Program Files/Intel/MPSS//x86_64-mpsssdk-linux/usr/lib/k1om-mpss-linux/gcc/k1om-mpss-linux/5.1.1/include/adxintrin.h(36): error: identifier "__builtin_ia32_sbb_u32" is undefined
      return __builtin_ia32_sbb_u32 (__CF, __Y, __X, __P);
             ^

Has anyone observerd the same error or knows a workaround? Is this an error with the header files distributed with MPSS 3.6.1 or do I need to change the way I cross compile for MIC?

My environment is Windows 8.1 with all current updates, MPSS 3.6.1, Intel C++ Version 16.0.1.146 Build 20151021

 

thanks for your help,

Stefan

0 Kudos
9 Replies
Kevin_D_Intel
Employee
603 Views

I will try reproducing this and consult with our C++ Developers and then let you know what I learn.

0 Kudos
Kevin_D_Intel
Employee
603 Views

Thank you for notifying us about this error. I was able to reproduce this and our Developers did identify a defect with our compiler that we expect will be fixed in our next update (PSXE 2016 Update 3) in mid-Q2.

The issue relates to a missing include, <installdir>\windows\compiler\include\mic\x86intrin.h. There are a couple of ways to work around this by making a file by this name available. I recommend alternative #2 below since the first alternative requires that you remember to undo the change to the installed image before you uninstall in the future.

To work around please do either of the following:

  1. Copy <installdir>\windows\compiler\include\immintrin.h into the file <installdir>\windows\compiler\include\mic\x86intrin.h
  2. Copy <installdir>\windows\compiler\include\immintrin.h into the file x86intrin.h within your personal area and then add -I<dir> accordingly. For example, copy into the file x86intrin.h in the same folder as your test case source file and then add -I. to the compile (e.g. icl /Qmic -std=c++11 -I. mictest.cpp –o test)

Where <installdir> will be like: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.1.146   (this is for PSXE 2016 Update 1)

I will keep you updated on the availability of a permanent fix.

(Internal tracking id: DPD200578564)

(Resolution Update on 05/09/2016): This defect is fixed in the Intel® Parallel Studio XE 2016 Update 3 Release (PSXE 2016.3.059 / CnL 2016.3.207 - Windows)

0 Kudos
Stefan_F
Beginner
603 Views

Thanks for the reply, I just tried the second workaround you suggested and it fixes the compilation issues of the example code.

The headers seem to be broken beyond that however. Including <future> also breaks compilation.

0 Kudos
Kevin_D_Intel
Employee
603 Views

I do not see failures when using the second workaround with the small test case and just adding: #include <future>

Is that what you meant?    If not, can I trouble you for another test case?

 

0 Kudos
Stefan_F
Beginner
603 Views

Yes, that's what I did.

For reference, mictest.cpp:

#include <algorithm>
#include <future>

int main(int argc, char** argv) {
}

I added a directory override containing the immintrin.h, renamed to x86intrin.h:

C:\temp>dir override
 Volume in drive C has no label.
 Volume Serial Number is F213-3BE6

 Directory of C:\temp\override

04.03.2016  12:40    <DIR>          .
04.03.2016  12:40    <DIR>          ..
22.10.2015  03:57           112 367 x86intrin.h
               1 File(s)        112 367 bytes
               2 Dir(s)  92 494 364 672 bytes free

 

Then when I try to compile, I get the following:

C:\temp>icl /Qmic -std=c++11 -I.\override mictest.cpp -o test
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.1.146 Build 20151021
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.
In file included from mictest.cpp(2):
C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/functional(78): error: class "std::thread" has no member "result_type"
      { typedef typename _Functor::result_type result_type; };
                                   ^
In file included from mictest.cpp(2):
          detected during:
In file included from mictest.cpp(2):
            instantiation of class "std::_Maybe_get_result_type<_Functor, void> [with _Functor=std::thread]" at line 86
In file included from mictest.cpp(2):
            instantiation of class "std::_Weak_result_type_impl<_Functor> [with _Functor=std::thread]" at line 184
In file included from mictest.cpp(2):
            instantiation of class "std::_Weak_result_type<_Functor> [with _Functor=std::thread]" at line 264
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base_impl<true, true, _Tp> [with _Tp=std::thread]" at line 283
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base<_Tp> [with _Tp=std::thread]" at line 399
In file included from mictest.cpp(2):
            instantiation of class "std::reference_wrapper<_Tp> [with _Tp=std::thread]" at line 1638 of "C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/future"
In file included from mictest.cpp(2):

In file included from mictest.cpp(2):
C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/functional(266): error: class "std::thread" has no member "argument_type"
        typedef typename _Tp::argument_type argument_type;
                              ^
In file included from mictest.cpp(2):
          detected during:
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base_impl<true, true, _Tp> [with _Tp=std::thread]" at line 283
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base<_Tp> [with _Tp=std::thread]" at line 399
In file included from mictest.cpp(2):
            instantiation of class "std::reference_wrapper<_Tp> [with _Tp=std::thread]" at line 1638 of "C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/future"
In file included from mictest.cpp(2):

In file included from mictest.cpp(2):
C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/functional(267): error: class "std::thread" has no member "first_argument_type"
        typedef typename _Tp::first_argument_type first_argument_type;
                              ^
In file included from mictest.cpp(2):
          detected during:
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base_impl<true, true, _Tp> [with _Tp=std::thread]" at line 283
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base<_Tp> [with _Tp=std::thread]" at line 399
In file included from mictest.cpp(2):
            instantiation of class "std::reference_wrapper<_Tp> [with _Tp=std::thread]" at line 1638 of "C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/future"
In file included from mictest.cpp(2):

In file included from mictest.cpp(2):
C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/functional(268): error: class "std::thread" has no member "second_argument_type"
        typedef typename _Tp::second_argument_type second_argument_type;
                              ^
In file included from mictest.cpp(2):
          detected during:
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base_impl<true, true, _Tp> [with _Tp=std::thread]" at line 283
In file included from mictest.cpp(2):
            instantiation of class "std::_Reference_wrapper_base<_Tp> [with _Tp=std::thread]" at line 399
In file included from mictest.cpp(2):
            instantiation of class "std::reference_wrapper<_Tp> [with _Tp=std::thread]" at line 1638 of "C:/Program Files/Intel/MPSS//k1om-mpss-linux/usr/include/c++/future"
In file included from mictest.cpp(2):

compilation aborted for mictest.cpp (code 2)

 

0 Kudos
Kevin_D_Intel
Employee
603 Views

Ok, sorry about all this.

I now see what you see but only with PSXE 2016 Update 1 that you are using. I was using Update 2 and for reasons I can’t explain the same behavior does not exist.

I did find that with Update 1 you can use this alternative. Instead of using your currently renamed copy of immintrin.h from your .\override folder, just create a new x86intrin.h file in that folder that contains the following:

// Local x86intrin.h work around

#ifndef _X86INTRIN_H_INCLUDED
#define _X86INTRIN_H_INCLUDED

#include <immintrin.h>

#endif /* _X86INTRIN_H_INCLUDED */

 

0 Kudos
Stefan_F
Beginner
603 Views

Using Update 2 works for me as well, thank you for your help :)

0 Kudos
Kevin_D_Intel
Employee
603 Views

Ok. Good to hear. I'll inform you when the permanent fix is available as noted earlier in PSXE 2016 Update 3 in mid-Q2.

0 Kudos
Kevin_D_Intel
Employee
603 Views

I confirmed this defect is fixed in our latest Intel Parallel Studio XE 2016 Update 3 release now available from the Intel Registration Center. Thank you again for notifying us about this issue.

0 Kudos
Reply