undefined reference with IPP and own .so

undefined reference with IPP and own .so

Hi,

I work with the IPP 5.1 and developed some stuff under Windows and put all this stuff in a DLL and the IPP stuff is linked statically with all that libs in that order:
ippacemerged.lib ippacmerged.lib ippalign.lib ippccemerged.lib ippccmerged.lib
ippchemerged.lib ippchmerged.lib ippcvemerged.lib ippcvmerged.lib ippdcemerged.lib
ippdcmerged.lib ippiemerged.lib ippimerged.lib ippjemerged.lib ippjmerged.lib
ippmemerged.lib ippmmerged.lib ippscemerged.lib ippscmerged.lib ippsemerged.lib
ippsmerged.lib ippsremerged.lib ippsrmerged.lib ippvcemerged.lib ippvcmerged.lib
ippvmemerged.lib ippvmmerged.lib ippcorel.lib

After that I build a test app which also needs some stuff of the IPP and this app uses the so I build before.
In Windows everything is fine.

Now I tried to build the same thing in Linux and I have some trouble while linking.
I build the shared obkect with this order of libs:
ippacemerged ippacmerged ippalign ippccemerged ippccmerged
ippchemerged ippchmerged ippcvemerged ippcvmerged ippdcemerged
ippdcmerged ippiemerged ippimerged ippjemerged ippjmerged
ippmemerged ippmmerged ippscemerged ippscmerged
ippsremerged ippsrmerged ippvcemerged ippvcmerged
ippvmemerged ippvmmerged ippsemerged ippsmerged ippcore

And building the so is no problem I also build a second so with IPP stuff.
Now I build the test app and I get:
undefined reference to `ippGetMaxCacheSizeB'
undefined reference to `ippGetStatusString'

Is there somebody who can tell me in which order I have to use the ipp libs and the so in the makefiles?
I also tried to put all ipp libs in the makefile then my so libs and then once more all ipp libs, but it doesnt help.

Thanx in advance,
Peter

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Peter,

undefined functions are located in ippcore library

Regards,
Vladimir

Thanx, I got it.

Now I have another problem with my individual so. I tried to build the so and link all ipp stuff static into this so. It works fine.

Now I tried to build a app that don't need IPP and shouldn't use it (e.g. sell the so as SDK and user should build apps with IPP libs).

While linking my so to my app, I get everytime undefined references to all the ipp functions used in the so.
I wonder about that, becuase I thought that linking my app there should be no refernce to ipp becuase everthing is finally in the so, right?

Under WIndoiws I do exactly the same and it works fine, I can use the DLL without additional IPP stuff, just link the import lib of my own DLL and everything is fine.

How can I do that with Linux?

Thnx,
Peter

Hi, Peter!

Which architecture do you build shared library for? Is it IA32 or Intel64 (x86_64)? And how do you link your shared library? Could you send linkage string?

Best regards, Pavel.

Hi, here the linking strings:

first the one for the so, the Release_gmm_dll/libgmm.so is my so

I tried:
-L../../../packages/ipp/5.1/lnx_gcc/lib/nonpic
and
-L../../../packages/ipp/5.1/lnx_gcc/lib

as path.


g++ -shared -s -m32 -o Release_gmm_dll/libgmm.so
Release_gmm_dll/gmm.o
-L../lib/Release -L../lib
-L../../../packages/ipp/5.1/lnx_gcc/lib -Wl,-Bstatic -lippacemerged
-lippacmerged -lippalign -lippccemerged -lippccmerged -lippchemerged
-lippchmerged -lippcvemerged -lippcvmerged -lippdcemerged -lippdcmerged
-lippiemerged -lippimerged -lippjemerged -lippjmerged -lippmemerged
-lippmmerged -lippscemerged -lippscmerged -lippsemerged -lippsmerged
-lippsremerged -lippsrmerged -lippvcemerged -lippvcmerged -lippvmemerged
-lippvmmerged -lippcore -Wl,-Bdynamic -lstdc++ -lpthread

The linking string for the app is:

Linking target Release_testttt_exe/testttt.out
-s -m32 -L../lib/Release -L../lib -Wl,-Bstatic -Wl,-Bdynamic -lstdc++
-lgmm -lpthread
../lib/Release/libgmm.so: undefined reference to `w7_ippsDiv_64f'
../lib/Release/libgmm.so: undefined reference to `a6_ippsMalloc_8u'
make[1]: Leaving directory
../lib/Release/libgmm.so: undefined reference to `w7_ippsSet_8u'
../lib/Release/libgmm.so: undefined reference to `px_ippsCopy_8u'
../lib/Release/libgmm.so: undefined reference to `px_ippsSet_32s'
../lib/Release/libgmm.so: undefined reference to `t7_ippsSet_32s'
../lib/Release/libgmm.so: undefined reference to `w7_ippsCopy_8u'

What could be wrong with that linking strategie? The nonpic is for kernel modules and not needed for normal applications, right?

Thx,
Peter

Hi, Peter!

Please use option "-z defs" in building your shared library:

-z defs:disallows undefined symbols. It helps you to make your library smaller (by default all functions of IPP will be embeded in your library).

The second: it is very important to keep order of linking libraries. You should set such order:

-lippacemerged -lippccmerged -lippccemerged -lippccmerged -lippchemerged
-lippchmerged -lippcvemerged -lippcvmerged -lippdcemerged -lippdcmerged
-lippjemerged -lippjmerged -lippmemerged -lippmmerged -lippscemerged -lippscmerged
-lippsremerged -lippsrmerged -lippvcemerged -lippvcmerged -lippvmemerged
-lippvmmerged-lippiemerged -lippimerged -lippsemerged -lippsmerged-lippcore

I hope it should solve your problem.

Pavel.

Leave a Comment

Please sign in to add a comment. Not a member? Join today