<h3 dir="auto">Please state the information for your system</h3>
<ul dir="auto">
<li>OpenCV version: 3.1</li>
<li>Host OS: Ubuntu 16.04 LTS</li>
<li>Nvidia-367 with CUDA 7.5<br>
-Compiler &amp; CMake: GCC 5.3 &amp; CMake 3.5</li>
</ul>
<h3 dir="auto">In which part of the OpenCV library you got the issue?</h3>
<p dir="auto">Examples:</p>
<ul dir="auto">
<li>core, cuda</li>
</ul>
<p dir="auto">Error generated using gcc &amp; cmake in 16.04 LTS<br>
Error generated:<br>
/usr/include/string.h: In function ‘void* <em><em>mempcpy_inline(void</em>, const void</em>, size_t)’:<br>
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope<br>
return (char *) memcpy (__dest, __src, __n) + __n;</p>
<p dir="auto">Using the methods in [https://github.com/<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="151135972" data-permission-text="Title is private" data-url="https://github.com/BVLC/caffe/issues/4046" data-hovercard-type="issue" data-hovercard-url="/BVLC/caffe/issues/4046/hovercard" href="https://github.com/BVLC/caffe/issues/4046">BVLC/caffe/issues/4046</a>] by adding</p>
<p dir="auto">set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")</p>
<p dir="auto">to the top of the CMakeLists.txt, everything compiled and worked fine</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.4</li>
<li>Operating System / Platform =&gt; macOS High Sierra</li>
<li>Compiler =&gt; Clang (mac's default gcc)</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I think I read somewhere clang wasn't supported, but I can't find it again so hopefully I was wrong. I compiled it from source from the 3.4 tag, there were no errors.</p>
<p dir="auto">I'm running opencv as a <a href="https://nodejs.org/api/addons.html#addons_n_api" rel="nofollow">nodejs addon</a> in <a href="https://github.com/nodejs/node-addon-api">c++</a>, it is running on a separate thread and every once in a while (one or two loops), when it gets to the detectMultiScale function it crashes.<br>
When I run it without the node addon api library as a separate program (still in a separate thread) it doesn't crash, it just keeps the capture loop going as it is supposed to. But because it crashes on an opencv function I think it makes sense to put the issue here.</p>
<p dir="auto">Piece of code where is crashes:</p>
<div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Gray has 1 channel, 2 dims, cols = 1280, rows = 720
// found_bodies is an empty std::vector&lt;Rect&gt;
body_cascade.detectMultiScale(gray, found_bodies, 1.01, 4, 0, cv::Size());"><pre class="notranslate"><span class="pl-c"><span class="pl-c">//</span> Gray has 1 channel, 2 dims, cols = 1280, rows = 720</span>
<span class="pl-c"><span class="pl-c">//</span> found_bodies is an empty std::vector&lt;Rect&gt;</span>
body_cascade.detectMultiScale(gray, found_bodies, <span class="pl-c1">1.01</span>, <span class="pl-c1">4</span>, <span class="pl-c1">0</span>, cv::<span class="pl-c1">Size</span>());</pre></div>
<p dir="auto">Error I get after a while:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.4-dev) 
/usr/local/include/opencv2/core/mat.inl.hpp:1179: error: (-215:Assertion failed) (unsigned)(i1 * 
DataType&lt;_Tp&gt;::channels) &lt; (unsigned)(size.p[1] * channels()) in function 'at'"><pre class="notranslate">libc++abi.dylib: terminating with uncaught exception of <span class="pl-c1">type</span> cv::Exception: OpenCV(3.4.4-dev) 
/usr/local/include/opencv2/core/mat.inl.hpp:1179: error: (-215:Assertion failed) (unsigned)(i1 <span class="pl-k">*</span> 
DataType<span class="pl-k">&lt;</span>_Tp<span class="pl-k">&gt;</span>::channels) <span class="pl-k">&lt;</span> (unsigned)(size.p[1] <span class="pl-k">*</span> <span class="pl-en">channels</span>()) <span class="pl-k">in</span> <span class="pl-k">function</span> <span class="pl-en">'at'</span></pre></div>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">I'm not sure how you can help me with this as I'm not allowed to share this code. :/</p>
<p dir="auto">It's basically this code <a href="https://nodejs.org/api/addons.html#addons_n_api" rel="nofollow">here</a> (below), with a normal opencv capture loop from a video, running in a separate thread and doing detectMultiScale every loop.</p>
<p dir="auto">Thank you in advance, anything you need, just ask.</p>