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

Problem creating .lib that uses IPP functions

greekgoddj
Beginner
959 Views
Greetings,

I have been using IPP 4.1 for some time now and it all works fine. Recently I have tried to create a static lib of my class files which use the IPP. Unfortunately it doesn't work. The code all compiles fine, but then it says "Creating Library..", the CPU jumps to 100% and it stays there for what seems to be eternity. Eventually the computer becomes unusable. I am using Visual Studio .NET, and like I said the same class with the same project properties/settings, works fine. This problem only seems to appears when tryingto make a static library.

Any ideas?

Thanks,

Aristotel
0 Kudos
15 Replies
greekgoddj
Beginner
959 Views
Greetings again,

Here is an update on the situation. When compiling, if I leave the computer for about 5 minutes, it does actually compile. However it gives me 11751 warnings! The .lib is then 44MB!

Here is a "sample" of the warnings:
Creating library...
ippsmerged.lib(psthresht7as_split9.obj) : warning LNK4006: _t7_ownippsThreshGTValue_64f already defined in ippsmerged.lib(psthresht7as_split9.obj); second definition ignored
ippsmerged.lib(psthresht7as_split8.obj) : warning LNK4006: _t7_ownippsThreshLTValue_64f already defined in ippsmerged.lib(psthresht7as_split8.obj); second definition ignored
ippsmerged.lib(psthresht7as_split7.obj) : warning LNK4006: _t7_ownippsThresh_64fc_ASM already defined in ippsmerged.lib(psthresht7as_split7.obj); second definition ignored

I tried removing "ippsmerged.lib" and "ippcorel.lib" from the "Additional Dependencies" and it works fine. I don't see why it works without those there in the project properties as its how I had the code compiling in other non static lib projects, and its also one of the steps according to the "Intel Integrated Performance Primitives Using the Merged Static Libraries" document. Could somebody explain to me how it works without those additional dependencies listed in the properties?

Now that I can compile my class which uses IPP functions in a static library, when I use the library in another project, if I do not add "ippsmerged.lib" and "ippcorel.lib" to the Additional Dependencies property, I get errors such as:

MyLibrary.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippsAdd_32f@16
MyLibrary.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippsAdd_32f@16
MyLibrary.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippsAdd_32f@16

Is it not possible to use the static library I made with the IPP functions, withouth linking to IPP libraries again?

Thanks!

Aristotel
0 Kudos
Vladimir_Dudnik
Employee
959 Views
Hi,
seems something is wrong with your project. We have good document describing linking with IPP options, could you please take a look on it:
Regards,
Vladimir
0 Kudos
greekgoddj
Beginner
959 Views
Hello again,

Well after a few months I have come back to this problem :)

I have seen the link you posted about how to link to the IPP functions. I noticed that it differs from the instructions that come with the IPP. The document that comes with the IPP files says to include the ipp*merged.lib and ippcorel.lib. The one you gave me the link for suggests to also include the ipp*emerged.lib as well though. Either way none work. I have decided to start over and make sure I do everything step by step. So here it goes.

I want to create a .lib with functions and classes that use IPP functions. I create a new static lib project, and I follow the instructions and I write my functios which call some of the IPP functions of Signal Processing IPP.

When including ippsemerged.lib & ippsmerged.lib & ippcorel.lib as suggested in the link you gave me for dispatching static linking,
When I compile, after a long period of waiting, the compelation finishes with no errors. However the .lib I have made is 25MB!

When removing the ippsemerged.lib as int he documentation that comes with the IPP it does not mention including it for static linking dispatched, it takes ages to compile and results in a 23Mb .lib.

Now funny enough, if I remove ippcorel.lib and ippsmerged.lib also it still compiles but this time makes a .lib of arround 88kb.

So, first question is, is it logical to get a resulting .lib of 23MB/25??
Having looked at the size of ippsmerged.lib(23MB) and ippsemerged.lib(2MB), it seems that the entire libs are being used in the new .lib even though I want to use only a small number of the functions in IPP. Secondly, do I include ippsemerged.lib? i assume that I should, and that it was an error in the documentation that initially came with IPP.

Now I have made a tester console application to test the new .lib. I include the header for the new .lib, I include the .lib itself and compile. Compiling it like that works fine. As soon as I try to use a function from the included library and then compile i get the following:

ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiGetLibVersion@0
ClearecIPP.lib(ip pmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _InitStatic
ClearecIPP.lib(ippmerged.obj) : error LNK2019: unresolved external symbol __imp__MessageBeep@4 referenced in function _InitStatic
Debug/ClearecIPP Tester.exe : fatal error LNK1120: 22 unresolved externals


These errors happen in all cases where the .lib is 88kb, 23MB, or 25MB.

Any ideas would be welcome.
Thanks in advance!

Aristotel
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Aristotel,

There are several folders in IPP installation.

Folder with name "bin" contains IPP DLLs, both cpu-specific and dispatchers.
Folder with name "lib" contains IPP static libraries, cpu-specific with "merged" in the name and static dispatchers with "emerged" in the name.

cpu-specific libraries (doesn't matter DLL or static) contains actual function implementation and because of that they are the biggest IPP libraries in size. Dispathers contains only code to detect cpu in run-time and swith execution flow to the right branch. They are smaller in size.


Folder with name "stublib" contains DLL import libraries for IPP dispatcher DLLs.

If you are going to use IPP in DLLs, you need to link your application with DLL import libraries from "stublib" folder.

If you are using IPP in static libraries, you need to use only static libraries from "lib" folder. (In other words, you shouldn't mix IPP DLL and static libraries in one application).

You are going to create your own static library, which contains some code which callsIPP functions from IPP static libraries, correct?
So, you need to create standard static library project in MSVC, include only your code (not IPP libs), compile it and get small enough static library. But when you will build application linked with that small static library linker will ask you for big ~25Mb IPP static libraries (because of your calls toIPP functions). But finally, application executable of course will not be so big until you really call __ALL__ IPP functions. You know, linker is smart enough, and will include only that object code which is really needed to resolve external references.

Remember, when you use IPP static libraries, you need to call ippStaticInit function to initialize IPP static dispatcher from the beginning of your application.

Regards,
Vladimir

0 Kudos
greekgoddj
Beginner
959 Views
Hello Vladimir,

thanks for the exlanation. How is it that when compiling the application that uses my custom library, it is clever enough to include only the object code that will be used, yet when compiling my custom library in the first place, it is not clever enough to include only the code for the IPP functions that are used in my code?

Thanks and happy holidays,

Aristotel
0 Kudos
greekgoddj
Beginner
959 Views
Hello (yet again),

So after your advice, I have gone ahead and included the .libs in the creation of my custom lib. I rather have the lib with a big size, than having to link all future projects to both my custom lib, and the original IPP libs. However in my test application, I still get the following compilation errors.I have included my custom lib (the 25mb one), and the header for that custom lib, but no luck. What else could I possibly be doing wrong?

Thanks in advance,

Aristotel


ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _t7_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _w7_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _a6_ippiGetLibVersion@0
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiGetSpatialMoment_64f@28
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMoments64f_32f_C1R@20
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMomentFree_64f@4
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiMomentInitAlloc_64f@8
ClearecIPP.lib(ippmerged.obj) : error LNK2001: unresolved external symbol _px_ippiGetLibVersion@0
Debug/ClearecIPP Tester.exe : fatal error LNK1120: 20 unresolved externals
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Hi Aristotel,

happy holidays for you too.

I meant that usually, when you link you application with any static library, linker is smart enough to use only those functions from static library, which actually used in your application (it is not so difficult, just resolving external references for your application).

Regards,
Vladimir

0 Kudos
greekgoddj
Beginner
959 Views
Greetings, yet again! :)

OK...since the last post, I have gone ahead and made my custom .lib that uses IPP without including the .lib (s) themselves. As you said, I then get a small .lib but when I wish to use that .lib in my programs, I must then include the IPP .libs that my custom .lib uses.

I now want to make my custom .lib to be completely self contained and whenever I use it in other projects, not to have to also include the IPP .libs again.

I have gone ahead and as mentioned in the pdf you linked earlier in this thread, included ippsemerged.lib ippsmerged.lib and ippcorel.lib in my custom .lib project. It compiles and I get a large .lib, as expected now. When I use it in my other applications, it all works as expected without having to inlcude againt he IPP libs.

While it all goes fine, when compiling my custom .lib project, I do get warnings and it would be nice to get rid of them too. Simply, I get warnings for every IPP function that I have listed in funclist.h. For example:

ippmerged.obj : warning LNK4006: _ippsFFTFwd_RToCCS_64f@16 already defined in ippsemerged.lib(ipps00846.obj); second definition ignored

What can I do to resolve such linking warnings? Hopefully this is the last question I have regarding this matter :)

Thanks in advance,

Aristotel
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Hi Aristotel,

Let me try to explain it again

IPP uses code dispatchering mechanism to select best appropriate code at run-time. There are two kind of dispatchers: dynamic and static. Dynamic dispatcher it is ipps.dll, ippi.dll and so on. You link your appication with dispatchers and after, at a run-time dispatcher selects appropriate cpu-specific IPPDLL (ippsa6.dll,ippsw7.dll orippst7.dll in case of IA32).
There are also two kind of static dispatchers:
1. it is emerged libraries. You need to link your application with merged libraries and emerged libraries in order to get automatically worked static dispatching mechnism.
OR
2. it is static dispatcher in custom lib sample (it is actually two source files ippmerged.c and .h files). In that case you do not need to link emerged libraries as you already have dispatcher implemented.

Regards,
Vladimir

0 Kudos
greekgoddj
Beginner
959 Views
Hello Vladimir,

I do understand what you have explained and I am trying to make my custom library a static one WITH dispatching. It is for this reason that I have done as you have said in point #1 ( this is also what is mentioned in the .pdf in the link you have given me) and included ippsemerged.lib and ippsmerged.lib in my custom .lib project. I need both emerged and merged libs. This all is clear.

What I was saying earlier is that after compiling, when Visual Studio is trying to link, it finds functions (such as the following example) defined twice, once in the emerged and once in merged, and therefore comes up with a warning.

ippmerged.obj : warning LNK4006: _ippsFFTFwd_RToCCS_64f@16 already defined in ippsemerged.lib(ipps00846.obj); second definition ignored

I have understood the concept of the static linking with distatching, and my custom lib works fine when used in other projects. I am now simply trying to figure out how to avoid getting those warning messages in Visual Studio, as shown a few lines above. Do you know of any flag or setting in Visual Studio that supresses such warnings?

Thanks once again!

Aristotel
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Hi Aristotel,

I've never seen simiilar problem with IPP, could you please attach here some simple MSVC project which demonstrates this issue? (No need in IPP libraries of course, just source and project). I'll try to reproduce and find what we can do.

Regards,
Vladimir

0 Kudos
greekgoddj
Beginner
959 Views
Hello Vladimir,

I have created a simple visual studio(2003) project. I have followed the instructions found on page 9 of the .pdf you pointed me to earlier in this thead Strangly, when compling and then linking I get even more warnings now, even though the settings are identical to my main project.

Anyway you will find the test project attached. Thanks for offering to have a look into it.


Thanks,

Aristotel
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Aristotel,

I'm sorry, I did not understood you correctly. The sample "mergedlib" was intended to demonstrate how to implement static IPP dispatcher in your application (in other words, to get you possibility to link your app with merged libs and not link with emerged libs). In this way you can restrict support of processors, for example, you can include code only for W7 and T7 processors rather than the whole line supported with using default static dispatcher in emerged libs.

It is important to note that you can't create custome static library with this approach, you will get the whole IPP merged libs in your project.

If you need smaller IPP libraries you only can use custom DLL tool.

Regards,
Vladimir

0 Kudos
greekgoddj
Beginner
959 Views
Hello,

It is fine to get the whole IPP merged libs in my lib as I want all the processor capabilities in there. The code I have works...I can use my custom lib just fine. It is only when compiling/linking my custom lib in the first place that I would like to supress those "warnings." I thought perhaps there was a setting somewhere in VS2003 for that, but I guess not and will have to live with the warnings.

Thanks!!

:)
0 Kudos
Vladimir_Dudnik
Employee
959 Views

Hm-m-m, just can't understand what the difference you see between IPP merged/emerged libraries and your, which is actually the same, but linked with warnings? Why not to use just IPP libraries?

Regarding suppressing warnings, I think you can add /FORCE:multiple command line option to linker. There are also option to control warnings level /WARN:level see linker help. But note that it is not a good practice as you can miss some bugs.

Regards,
Vladimir

0 Kudos
Reply