Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NBeeze
Beginner
181 Views

Static linking errors on Linux

Jump to solution

Hi,

I'm trying to create a shared object that statically links to the ipp libraries. I am using IPP 2018.3.222 on Ubuntu 18.04 and Ubuntu 16.04. I'm getting a lot of multiple definition link errors related to the ipp libs. I have tried wrapping the static libs with the -Wl,--whole-archive/--Wl,--no-whole-archive flags. Whn I do this I get the following errors:

/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_y8.o):(.rodata+0x0): multiple definition of `__svml4ipp_z0_dexpla_data'
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_k0.o):(.rodata+0x0): first defined here
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_y8.o):(.rodata+0x500): multiple definition of `__svml4ipp_dexp_data'
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_k0.o):(.rodata+0x500): first defined here
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_s_exp_data_exla_y8.o):(.rodata+0x0): multiple definition of `__svml4ipp_z0_sexpla_data'
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_s_exp_data_exla_k0.o):(.rodata+0x0): first defined here
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_s_exp_data_exla_y8.o):(.rodata+0x4c0): multiple definition of `__svml4ipp_sexp_data'
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_s_exp_data_exla_k0.o):(.rodata+0x4c0): first defined here
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_l9.o):(.rodata+0x0): multiple definition of `__svml4ipp_z0_dexpla_data'
/ipp-2018.3.222/lib/intel64_lin/libippi.a(svml_d_exp_data_exla_k0.o):(.rodata+0x0): first defined here

 

I've also tried wrapping the static lins with the -Wl,-Bstatic/-Wl,-Bdynamic flags. My shared object builds but the ipp symbols are undefined:

nm libmyshared.so | grep ippi

                 U ippiBGRToCbYCr422_8u_AC4C2R
                 U ippiBGRToYCbCr422_8u_AC4C2R
                 U ippiCbYCr422ToBGR_8u_C2C4R
                 U ippiCFAToRGB_8u_C1C3R
                 U ippiDemosaicAHD_8u_C1C3R
                 U ippiGrayToRGB_8u_C1C4R
                 U ippiRGBToGray_8u_AC4C1R
                 U ippiRGBToYCbCr_8u_C3R
                 U ippiSwapChannels_8u_C3C4R
                 U ippiSwapChannels_8u_C3R
                 U ippiSwapChannels_8u_C4C3R
                 U ippiSwapChannels_8u_C4R
                 U ippiYCbCr422ToBGR_8u_C2C4R
                 U ippiYCbCrToRGB_8u_C3R

According to this article: https://software.intel.com/en-us/ipp-dev-guide-linking-options I should also be linking to the Intel C++ Compiler runtime libraries: libirc.a, libsvml.a, and libimf.a. I do not see these libraries in the IPP download directory or the IPP installation directory.

 

Thanks.

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
181 Views
4 Replies
NBeeze
Beginner
181 Views

I've also tried adding the linker flag -Wl,--allow-multiple-definition and my shared object now builds. The issue now is that when I build an application that links to my shared object, I get the following errors:

libmyshared.so: undefined reference to `own_ipps_sCbrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dPow2o3_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dInvCbrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sInvSqrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dPow3o2__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sSqrt__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sPow3o2_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dInvSqrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sInv_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sInv__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_dCbrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_sInvSqrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dInvCbrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_sSqrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dInvSqrt__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_dCbrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dInv__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sInvSqrt__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sCbrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dSqrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dPow2o3_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sInv_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_sInvCbrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dPow3o2_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sPow2o3_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_sPow3o2_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dPow3o2_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_sInvCbrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_sSqrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dInvSqrt_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dSqrt_EX_ttab'
libmyshared.so: undefined reference to `own_ipps_dInv_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dSqrt__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sPow3o2__VAL_CPU_ttab'
libmyshared.so: undefined reference to `own_ipps_sPow2o3_H8_ttab'
libmyshared.so: undefined reference to `own_ipps_dInv_EX_ttab'

 

My shared library statically links to the following ipp libs: 

libippcore.a
libippi.a
libippcc.a
libippch.a
libippcv.a
libippdc.a
libipps.a
libippvm.a

 

Thanks.

Gennady_F_Intel
Moderator
182 Views
Igor_A_Intel
Employee
181 Views

Hi NBeeze,

the unresolved symbols you see ("own_ipps_xxxxx_ttab") are from the "dead" code that is not used by any IPP function. To avoid these symbols you should create shared object with the export definition list. I think this approach will solve all mentioned above issues. Moreover - in this case the size of the shared object will have the minimum size, while with your current approach the dynamic library size will be equal to the sum of sizes of all libs you include.

"dead" code will be removed in the future IPP releases. As well as duplicated symbols.

regards, Igor

NBeeze
Beginner
180 Views

Hi Igor,

Thanks for the info about the source of the unresolved symbols errors and for the tip for reducing the size of my shared object.

 

Reply