<p dir="auto">Copied from <a href="https://stackoverflow.com/q/48088189/1531708" rel="nofollow">https://stackoverflow.com/q/48088189/1531708</a> because I experience the same:</p>
<p dir="auto">After updating the NDK to v16, the previously working x86 build now fails with hundreds of messages like:</p>
<blockquote>
<p dir="auto">C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiCopyConstBorder_8u_C4IR_L_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object<br>
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiConvert_32s16u_C1RSfs_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object<br>
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiNormRel_L1_32f_C1R_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object<br>
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiFilterBilateralBorderInit_L_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object<br>
C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:/Android/OpenCV-android-sdk/sdk/native/3rdparty/libs/x86/libippicv.a(jmp_icvippiScaleC_32f8u_C1R_as.s.o): relocation R_386_GOTOFF against preemptible symbol icv_ippJumpIndexForMergedLibs cannot be used when making a shared object</p>
</blockquote>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; :2.4.9:</li>
<li>Operating System / Platform =&gt; :Windows 64 Bit</li>
<li>Compiler =&gt; :Visual Studio 2015 Professional</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/20737540/47890106-55ba6e80-de88-11e8-9240-cd2160a1826e.png"><img src="https://user-images.githubusercontent.com/20737540/47890106-55ba6e80-de88-11e8-9240-cd2160a1826e.png" alt="image" style="max-width: 100%;"></a><br>
Call Stack show:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/20737540/47890125-74206a00-de88-11e8-8fef-fc4c5a37302e.png"><img src="https://user-images.githubusercontent.com/20737540/47890125-74206a00-de88-11e8-8fef-fc4c5a37302e.png" alt="image" style="max-width: 100%;"></a></p>

<p dir="auto">the program always crash on here:<br>
cv::resize(*srcImg, mat2bitmap_img, cv::Size(draw_rect.Width(), draw_rect.Height()));<br>
I think this problem is memory leak, resize function too many memory allocation, resulting in memory fragmentation and management problems.</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">the program always run on loop,for example:<br>
while(1) {<br>
cv::resize...<br>
}</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
/*! display Mat on Picture Control in MFC
*! Mat  img: the image that to display
*! UINT nID: the ID of control
*! support BGR(Mat default),BGRA,GARY
*! other type need use cvtColor to convert
*/
void ImageDlg::DrawMat(cv::Mat *srcImg, UINT nID)
{
	if (srcImg-&gt;empty() || srcImg-&gt;data == nullptr) {
		return;
	}

	CDC *pDC = nullptr;
	CWnd *pWnd = GetDlgItem(nID);
	pWnd-&gt;GetClientRect(&amp;draw_rect);
	pDC = pWnd-&gt;GetDC();
	cv::resize(*srcImg, mat2bitmap_img, cv::Size(draw_rect.Width(), draw_rect.Height()));
	switch (srcImg-&gt;channels())
	{
	case 1:
		cv::cvtColor(mat2bitmap_img, mat2bitmap_img, CV_GRAY2BGRA); // GRAY --&gt; BGRA(CV_8UC4)
		break;
	case 3:
		cv::cvtColor(mat2bitmap_img, mat2bitmap_img, CV_BGR2BGRA);  // BGR --&gt; BGRA(CV_8UC4)
		break;
	default:
		break;
	}

	// why convert to CV_8UC4
	// because windows need 4-byte aligned in a row
	// if there are 3 pixels in a row,
	// CV_8UC3: 3 pixel = 9 bytes,   9 % 4 = 1(no alignment)
	// CV_8UC4: 3 pixel = 12 bytes, 12 % 4 = 0(it's ok)

	// calculate how many bytes a pixel
	int  pixelBytes = mat2bitmap_img.channels()*(mat2bitmap_img.depth() + 1);

	// create a header by using BITMAPINFO structure
	draw_bitmapInfo.bmiHeader.biBitCount = 8 * pixelBytes;
	draw_bitmapInfo.bmiHeader.biWidth = mat2bitmap_img.cols;
	draw_bitmapInfo.bmiHeader.biHeight = -mat2bitmap_img.rows;

	// display Mat
	// Mat data + BITMAPINFO --&gt; MFC DigItem
	::StretchDIBits(
		pDC-&gt;GetSafeHdc(),
		draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
		0, 0, draw_rect.Width(), draw_rect.Height(),
		mat2bitmap_img.data,
		&amp;draw_bitmapInfo,
		DIB_RGB_COLORS,
		SRCCOPY
	);
	ReleaseDC(pDC);
	pDC = nullptr;
	pWnd = nullptr;
}
"><pre class="notranslate"><code class="notranslate">
/*! display Mat on Picture Control in MFC
*! Mat  img: the image that to display
*! UINT nID: the ID of control
*! support BGR(Mat default),BGRA,GARY
*! other type need use cvtColor to convert
*/
void ImageDlg::DrawMat(cv::Mat *srcImg, UINT nID)
{
	if (srcImg-&gt;empty() || srcImg-&gt;data == nullptr) {
		return;
	}

	CDC *pDC = nullptr;
	CWnd *pWnd = GetDlgItem(nID);
	pWnd-&gt;GetClientRect(&amp;draw_rect);
	pDC = pWnd-&gt;GetDC();
	cv::resize(*srcImg, mat2bitmap_img, cv::Size(draw_rect.Width(), draw_rect.Height()));
	switch (srcImg-&gt;channels())
	{
	case 1:
		cv::cvtColor(mat2bitmap_img, mat2bitmap_img, CV_GRAY2BGRA); // GRAY --&gt; BGRA(CV_8UC4)
		break;
	case 3:
		cv::cvtColor(mat2bitmap_img, mat2bitmap_img, CV_BGR2BGRA);  // BGR --&gt; BGRA(CV_8UC4)
		break;
	default:
		break;
	}

	// why convert to CV_8UC4
	// because windows need 4-byte aligned in a row
	// if there are 3 pixels in a row,
	// CV_8UC3: 3 pixel = 9 bytes,   9 % 4 = 1(no alignment)
	// CV_8UC4: 3 pixel = 12 bytes, 12 % 4 = 0(it's ok)

	// calculate how many bytes a pixel
	int  pixelBytes = mat2bitmap_img.channels()*(mat2bitmap_img.depth() + 1);

	// create a header by using BITMAPINFO structure
	draw_bitmapInfo.bmiHeader.biBitCount = 8 * pixelBytes;
	draw_bitmapInfo.bmiHeader.biWidth = mat2bitmap_img.cols;
	draw_bitmapInfo.bmiHeader.biHeight = -mat2bitmap_img.rows;

	// display Mat
	// Mat data + BITMAPINFO --&gt; MFC DigItem
	::StretchDIBits(
		pDC-&gt;GetSafeHdc(),
		draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
		0, 0, draw_rect.Width(), draw_rect.Height(),
		mat2bitmap_img.data,
		&amp;draw_bitmapInfo,
		DIB_RGB_COLORS,
		SRCCOPY
	);
	ReleaseDC(pDC);
	pDC = nullptr;
	pWnd = nullptr;
}

</code></pre></div>
<p dir="auto"><strong>my idea:</strong><br>
I think resize function input params is piont,it will not need memory allocation<br>
original:<br>
void cv::resize( InputArray _src, OutputArray _dst, Size dsize,<br>
double inv_scale_x, double inv_scale_y, int interpolation )<br>
maybe fixed:<br>
void cv::resize( InputArray *_src, OutputArray *_dst, Size dsize,<br>
double inv_scale_x, double inv_scale_y, int interpolation )<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/peters/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/peters">@peters</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eruffaldi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eruffaldi">@eruffaldi</a></p>