Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

link errors with IPP on cygwin

Jason
Beginner
427 Views

I've built a program that uses mkl and ipp that runs on mac and linux. I'm now building that program for Windows using cygwin and gcc, and can't get it to link.

The errors I'm getting are:

Warning: .drectve `-defaultlib:"uuid.lib" ' unrecognized
../../../bin/libMath.a(VectorUtility.cxx.o):VectorUtility.cxx:(.text+0x95): undefined reference to `_ippGetLibVersion'
../../../bin/libMath.a(VectorUtility.cxx.o):VectorUtility.cxx:(.text+0x157): undefined reference to `_ippsWinHann_32f_I'

(and many more like that).

I'm using link path:

/opt/intel/IPP/6.1.2.041/ia32/include

and linking to the following:

ippiemerged,ippimerged,ippmemerged,ippmmerged,ippsemerged,ippsmerged andippcorel.

Can someone point me to what I'm doing wrong?

Thanks,

Jason

0 Kudos
6 Replies
Ying_H_Intel
Employee
427 Views

Hello Jason,

Maybe the link path : /opt/intel/ipp/6.1.2.041/ia32/include

should be /opt/intel/IPP/6.1.2.041/ia32/lib?

Regards,

Ying

0 Kudos
Jason
Beginner
427 Views

Hi Ying,

Sorry, that was a typo in my message. I meant lib.

Any other ideas?

0 Kudos
Chao_Y_Intel
Moderator
427 Views

Hi Jason,

GCC and Windows lib use different call convention for lib name. If you use 'nm' command line, you can find:

> nm myobj.o

U _ippsGetLibVersion

U _ippsWinHann_16s

In IPP, the entry poist are:

_ippsWinHann_16s@12

_ippsGetLibVersion@0

that is why the link can not find the symbols.

There is some discussion at cywin site on how use Windows lib with GCC:

http://www.cygwin.com/faq/,

on "How do I link against a .lib file" section:

Following some hints there, the followings steps looks to work for me now.

1) Build a custom DLL with IPP static libraries. You can use IPP sample code (ipp-samples\advanced-usage\linkage\customdll),

add the functions you used into .def file: into customdll\src\export.def

build the sample code, it created the DLL file: Bin\win32-xx\usr.dll

2) In cgwin, use the DLL tool to create a .a lib:

dlltool --def export.def --dllname usr.dll --output-lib myipplib.a

3) link 'myipplib.a' with you application.

Thanks,

Chao

0 Kudos
Jason
Beginner
427 Views

Thanks, Chao.

Those instructions helped. However, now I get runtime errors. It looks like the stack pointer is being modified during a call to, e.g.ippsConv_32f, which causes crashes due to bad memory access. It's possible to hack around this by saving the stack pointer before the call to ippsConv_32f, and restoring it afterwards, but I think there must be something else going on?

Any help would be much appreciated,

Thanks,

Jason

0 Kudos
Chao_Y_Intel
Moderator
427 Views

Jason,

How about other functions work? Maybe you can post the code calling ippsCov_32f function here. so we can test what is the problem.

Thanks,

Chao

0 Kudos
Jason
Beginner
427 Views
Hi Chao,
Here's the code I'm using. I included the diagnostic code to print out the stack pointer, so you can see it getting changed.
Thanks,
Jason
/*
@param[in] pOutput Pointer to an allocated float buffer.
@param[in] pInput Convolution buffer
@param[in] nSize Size of buffer pointed to by pInput and pOutput.
@param[in] pFilter Convolution Filter
@param[in] nFilterSize Size of buffer pointed to by pFilter
*/
void Process(float* pOutput, const float* pInput, uint nSize, const float* pFilter, uint nFilterSize)
{
uint nWorkingSize = nSize + nFilterSize - 1;
float* pWorking = new float[nWorkingSize];
// print out stack pointer:
unsigned reg, reg2;
asm("movl %%esp, %0" : "=r" (reg) : :);
fprintf(stderr, "BEFORE: %%esp is %u\n", reg);
ippsConv_32f(pInput, nSize, pFilter, nFilterSize, pWorking);
// print out stack pointer again.
asm("movl %%esp, %0" : "=r" (reg2) : :);
fprintf(stderr, "AFTER: %%esp is %u (+%d)\n", reg2, reg2-reg);
// Copy the results from pWorking to pOutput.
const float* pResult = pWorking + nFilterSize / 2;
for (uint i = 0; i < nSize; i++)
pOutput = pResult;
delete [] pWorking;
}
0 Kudos
Reply