<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic vector undefined symbol  in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018919#M37324</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am porting a code to Xeon Phi (using manual offload) and I am experimenting some trouble to compile/execute code with STL vectors on MIC. I isolated a small test case which reproduces the problem (see attached files).&lt;/P&gt;

&lt;P&gt;Using classical compilation generates the executable but execution fails :&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ icpc  -fPIC -fopenmp  ../Code/DATA/RegionF.cxx -I ../Code/DATA
$ ./a.out
On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_
On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_"
offload error: cannot load library to the device 0 (error code 20)

$ c++filt _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_
std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::vector&amp;lt;int&amp;gt;(int, int, std::allocator&amp;lt;int&amp;gt; const&amp;amp;)&lt;/PRE&gt;

&lt;P&gt;There is a missing symbol concerning std::vector on the MIC side.&lt;/P&gt;

&lt;P&gt;If I compile using verification option, it gives me details on the error :&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ icpc  -fPIC -fopenmp -offload-option,mic,compiler,"-z defs"  ../Code/DATA/RegionF.cxx -I ../Code/DATA
/tmp/pbs.1698391.tu-adm01/icpckl957f.o: In function `data::Region::isInside(data::Region const&amp;amp;) const':
../Code/DATA/RegionF.cxx:(.text+0xda): undefined reference to `std::allocator&amp;lt;int&amp;gt;::allocator()'
../Code/DATA/RegionF.cxx:(.text+0xed): undefined reference to `std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::vector&amp;lt;int&amp;gt;(int, int, std::allocator&amp;lt;int&amp;gt; const&amp;amp;)'
../Code/DATA/RegionF.cxx:(.text+0xf7): undefined reference to `std::allocator&amp;lt;int&amp;gt;::~allocator()'
../Code/DATA/RegionF.cxx:(.text+0x101): undefined reference to `std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::~vector()'
../Code/DATA/RegionF.cxx:(.text+0x116): undefined reference to `std::allocator&amp;lt;int&amp;gt;::~allocator()'&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	May be I missed something, I tryed to include the #include &amp;lt;vector&amp;gt; into the #pragma offload_attribute(push,target(mic))&lt;BR /&gt;
	region but it's giving me another error.&lt;/P&gt;

&lt;P&gt;Is someone can help me to make this small code to work ?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 May 2014 10:16:46 GMT</pubDate>
    <dc:creator>Hummel_M_</dc:creator>
    <dc:date>2014-05-20T10:16:46Z</dc:date>
    <item>
      <title>vector undefined symbol</title>
      <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018919#M37324</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am porting a code to Xeon Phi (using manual offload) and I am experimenting some trouble to compile/execute code with STL vectors on MIC. I isolated a small test case which reproduces the problem (see attached files).&lt;/P&gt;

&lt;P&gt;Using classical compilation generates the executable but execution fails :&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ icpc  -fPIC -fopenmp  ../Code/DATA/RegionF.cxx -I ../Code/DATA
$ ./a.out
On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_
On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_"
offload error: cannot load library to the device 0 (error code 20)

$ c++filt _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_
std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::vector&amp;lt;int&amp;gt;(int, int, std::allocator&amp;lt;int&amp;gt; const&amp;amp;)&lt;/PRE&gt;

&lt;P&gt;There is a missing symbol concerning std::vector on the MIC side.&lt;/P&gt;

&lt;P&gt;If I compile using verification option, it gives me details on the error :&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;$ icpc  -fPIC -fopenmp -offload-option,mic,compiler,"-z defs"  ../Code/DATA/RegionF.cxx -I ../Code/DATA
/tmp/pbs.1698391.tu-adm01/icpckl957f.o: In function `data::Region::isInside(data::Region const&amp;amp;) const':
../Code/DATA/RegionF.cxx:(.text+0xda): undefined reference to `std::allocator&amp;lt;int&amp;gt;::allocator()'
../Code/DATA/RegionF.cxx:(.text+0xed): undefined reference to `std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::vector&amp;lt;int&amp;gt;(int, int, std::allocator&amp;lt;int&amp;gt; const&amp;amp;)'
../Code/DATA/RegionF.cxx:(.text+0xf7): undefined reference to `std::allocator&amp;lt;int&amp;gt;::~allocator()'
../Code/DATA/RegionF.cxx:(.text+0x101): undefined reference to `std::vector&amp;lt;int, std::allocator&amp;lt;int&amp;gt; &amp;gt;::~vector()'
../Code/DATA/RegionF.cxx:(.text+0x116): undefined reference to `std::allocator&amp;lt;int&amp;gt;::~allocator()'&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	May be I missed something, I tryed to include the #include &amp;lt;vector&amp;gt; into the #pragma offload_attribute(push,target(mic))&lt;BR /&gt;
	region but it's giving me another error.&lt;/P&gt;

&lt;P&gt;Is someone can help me to make this small code to work ?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 10:16:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018919#M37324</guid>
      <dc:creator>Hummel_M_</dc:creator>
      <dc:date>2014-05-20T10:16:46Z</dc:date>
    </item>
    <item>
      <title>Oups adding ALL includes into</title>
      <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018920#M37325</link>
      <description>&lt;P&gt;Oups adding ALL includes into to #pragma offload_attribute solve the issue.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 11:44:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018920#M37325</guid>
      <dc:creator>Hummel_M_</dc:creator>
      <dc:date>2014-05-20T11:44:22Z</dc:date>
    </item>
    <item>
      <title>I actually found the real</title>
      <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018921#M37326</link>
      <description>&lt;P&gt;I actually found the real problem is ....don't #define&amp;lt;iostream&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2015 05:08:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018921#M37326</guid>
      <dc:creator>Jun</dc:creator>
      <dc:date>2015-04-14T05:08:27Z</dc:date>
    </item>
    <item>
      <title>Jun,</title>
      <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018922#M37327</link>
      <description>&lt;P&gt;Jun,&lt;/P&gt;

&lt;P&gt;Can I take it you mean #include &amp;lt;iostream&amp;gt;?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;You don't want to include iostream in a _Cilk_shared offload region, but you do need to include it in the offload. You need to tell the compiler that it needs to include both processor and coprocessor versions of the member functions but the objects themselves can't be in shared memory - or at least I know of know way to do this.&lt;/P&gt;

&lt;P&gt;In any event, Hummel's solution is correct.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2015 20:44:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018922#M37327</guid>
      <dc:creator>Frances_R_Intel</dc:creator>
      <dc:date>2015-04-15T20:44:13Z</dc:date>
    </item>
    <item>
      <title>Hi Frances</title>
      <link>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018923#M37328</link>
      <description>&lt;P&gt;Hi Frances&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Thanks for you explain. One thing I still not able to understand is that if I put #define&amp;lt;some header &amp;gt; in both outside and inside offload attribute target(mic) region. I will get runtime error. In this example if I have already put #define&amp;lt;iostream&amp;gt; in the offload region, and I put&amp;nbsp;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;#define&amp;lt;iostream&amp;gt; in regionF.h/regionF.cxx(one of them gives me error...) outside offload region, I get runtime error. &amp;nbsp;I tried same thing for Cilk , runtime error happens.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2015 22:16:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/vector-undefined-symbol/m-p/1018923#M37328</guid>
      <dc:creator>Jun</dc:creator>
      <dc:date>2015-04-15T22:16:42Z</dc:date>
    </item>
  </channel>
</rss>

