Linker issues migrating from v6 to v8

Linker issues migrating from v6 to v8

I'm currently trying to test Ipp 8.0 on a Linux platform (Ubuntu 12.04) where I've been using version 6.0.1

I'm trying to link statically but I always get: 'unresolvable R_386_GOTOFF relocation against symbol `ippJumpIndexForMergedLibs' which prompted me to try the nonpic libraries. 

This worked well enough for one simple application but another, more complex ones fails linking with a host of errors similar to this (full list attached):

/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32/nonpic/libippi.a(piresset_p8---ownResize16plLz3.o): In function `p8_ownResize16plLz3':
piresset_p8---ownResize16plLz3.i:(.text+0xd1): undefined reference to `p8_ippsCopy_32f'
piresset_p8---ownResize16plLz3.i:(.text+0xdf): undefined reference to `p8_ippsCopy_32f'
piresset_p8---ownResize16plLz3.i:(.text+0x17b): undefined reference to `p8_ippsCopy_32f'
piresset_p8---ownResize16plLz3.i:(.text+0x25b): undefined reference to `p8_ippsCopy_32f'
piresset_p8---ownResize16plLz3.i:(.text+0x266): undefined reference to `p8_ippsCopy_32f'
/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32/nonpic/libippi.a(piresset_p8---ownResize16plLz3.o):piresset_p8---ownResize16plLz3.i:(.text+0x2c4): more undefined references to `p8_ippsCopy_32f' follow

Help on identifying the issues would be much appreciated 

linker command g++ -o build-host-debug/bin/xrp -L/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32/nonpic -Xlinker --copy-dt-needed-entries -L./build-host-debug/lib -Wl,-rpath  .... long list of .o files and libs

 

Fichier attachéTaille
Télécharger ipp_linker_errors.txt42.45 Ko
29 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi Tomas,

You probably don't need to link with non-pic libraries, unless you build a kernel-mode application like a driver. Regarding unresolved references, please check the order of IPP libs in linker command line: -lippi -lipps -lippvm -lippcore. The other ordering may lead to unresolved symbols.

Regards,
Sergey

Regards,
Sergey

Thank you Sergey - that did the trick

I'm still unable to use anything other than nonpic due to 'unresolvable R_386_GOTOFF relocation against symbol `ippJumpIndexForMergedLibs'

Is there a downside to using the nonpic libs?

Could you provide the full R_386 diagnostics message? What object file or library module produces that relocation reference?

That's unpleasant diagnostics, because the relocation looks like compiler-generated.

Regards,
Sergey

Regards,
Sergey

/usr/bin/ld: /opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32//libippi.a(jmp_ippiAndC_8u_C1IR_as.o)(.text+0x10): unresolvable R_386_GOTOFF relocation against symbol `ippJumpIndexForMergedLibs'

 

I'm still a bit curious as to what the downside to nonpic libraries is. Although I'm not building drivers there are some real-time deterministic demands on my system.

Citation :

Tomas T. a écrit :

/usr/bin/ld: /opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32//libippi.a(jmp_ippiAndC_8u_C1IR_as.o)(.text+0x10): unresolvable R_386_GOTOFF relocation against symbol `ippJumpIndexForMergedLibs'

I have asked our QAs regarding this topic. They are trying to reproduce and answer.

As for pic/non-pic libraries, you can use them both - they are tested equally during package preparation. But major area of non-pic libraries usage is kernel-mode execution. Though, I don't know much here.

Regards,
Sergey
 

Regards,
Sergey

Hi Tomas,

I try to reproduce your example:

Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:        12.04
Codename:       precise
#36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux

g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 

cat ipptwo.cpp
#include <stdio.h>
#include "ipp.h"
 
int main( void )
{
    ippInit();
 
    const IppLibraryVersion* libver;       /* library info structure ptr */
 
    /* first print the version of the libraries */
    libver = ippsGetLibVersion();
    printf( " %s %s \n", libver->Name, libver->Version );
    libver = ippiGetLibVersion();
    printf( " %s %s \n\n", libver->Name, libver->Version );
 
    return 0;
}
 

g++ -o ipptwo ipptwo.cpp -I $IPPROOT/include $IPPROOT/lib/ia32/libippi.a $IPPROOT/lib/ia32/libipps.a $IPPROOT/lib/ia32/libippcore.a                                                              
 

 

./ipptwo
 ippSP SSE4.1/4.2 (p8) 8.0.0 (r40040)
 ippIP SSE4.1/4.2 (p8) 8.0.0 (r40040)
 

 

As you can see it works. So let investigate why you can't link IPP libraries. Please start to build this simple example.

 

Pavel

Sorry I didn't point that I used IPP PIC libraries which are placed in $IPPROOT/lib/ia32 folder.

Pavel

Let's show more relevant example with Tomas' function:


	#include <stdio.h>

	#include <ippi.h>

	int main()

	{

	    IppiSize roi = {0, 0};

	    ippiAndC_8u_C1IR(0, NULL, 0, roi);

	    printf("Test passedn");

	}

	

The command line for compiler/linker is:

gcc -O0 -w -I$IPPROOT/include test.cpp $IPPROOT/lib/ia32/libippi.a $IPPROOT/lib/ia32/libippcore.a -Xlinker -Map=output.map

The output.map shows that ippiAndC is really included from various IPP libs (px, w7, etc.). O0 used just to deny compiler optimizations.

./a.out gives "Test passed". AndC function doesn't work, because address is NULL.

Tomas, please do the same.

Regards,
Sergey

 

Regards,
Sergey

First thing first

./ipptwo 
 ippSP AVX (g9) 8.0.0 (r40040) 
 ippIP AVX (g9) 8.0.0 (r40040) 

 

a.out gives test passed

Fichiers joints: 

Fichier attachéTaille
Télécharger output_2.txt57.64 Ko

Encouraging results, the libraries are ok. What about your case?

Regards,
Sergey

Regards,
Sergey

Are the scripts referred to in getting started crucial? 

They all return with errrors

 

There were supposed to be attchments ....

Fichiers joints: 

Fichier attachéTaille
Télécharger cv_csh_0.txt98 octets
Télécharger cv_sh_0.txt89 octets
Télécharger link_install_0.txt7.01 Ko

Sorry Tomas, I don't understand what did you do?  Which script did you use? Could you explain your steps?

The 'getting started' guide instructs to run appropriate scripts found under /opt/intel/compser.../bin

 

 

After installing Intel IPP, set the environment variables by running the script appropriate to your target platform architecture. The scripts are available in <install_dir>/ipp/bin.

<install_dir> is the installation directory, by default, it is:

    For super-users:      /opt/intel/composer_xe_2013_sp1

 

-rwxr-xr-x 1 root  root   1102 Feb  6 16:10 compilervars.csh*
-rwxr-xr-x 1 root  root   1035 Feb  6 16:10 compilervars.sh*
-rwxr-xr-x 1 pluto pluto 31578 Feb  6 16:09 link_install.sh*

 

The output of those is in the textfiles 

Ok, I understand.

In the IPP User Guide you see: "After installing Intel IPP, set the environment variables by running the script appropriate to your target platform architecture. The scripts are available in <install_dir>/ipp/bin."

So you should go to /opt/intel/composer/ipp/bin and run ippenv.sh script to set IPP environment

Pavel

OK - there was a missing /ipp in my folder path - sorry

Still get an error though

pluto@supertriton:/opt/intel/composer_xe_2013_sp1/ipp/bin$ sudo ./ippvars.sh
[sudo] password for pluto:
./ippvars.sh: 39: ./ippvars.sh: [[: not found

 

You should run:

. ippvars.sh ia32
. ippvars.sh intel64
or
. ippvars.sh ia32_intel64

in depends which architecture you use

Pavel

This is what I did (using the ia32 argument), and got the above error

Changed line 39 using two sets of single brackets instead of the double so now it runs. Still get the same error when linking.

Can you suggest further tests?

 

Please check how do you place IPP libraries in link string. You should keep dependances in IPP libraries, for example if you use functions from Image Processing (ippIP) library you should point:

$IPPROOT/lib/ia32/libippi.a $IPPROOT/lib/ia32/libipps.a $IPPROOT/lib/ia32/libippcore.a 

because ippIP depends on ippSP and ippSP depends on ippCore. The full list of dependances you can see in IPP User Guide.

Pavel

Thanks, still the same though.

I think I'll just evaluate using nonpic libraries 

 

Please check if you point IPP libraries in correct order. Could you provide link string (how do you point IPP libraries)

Ok - found a really stupid error on my part. I was linking to components linked to the old version of IPP.

Removed that but that brought me a different set of errors 

g++ -o build-host-debug/bin/SimpleXscanReader -pthread -L/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32/ -L/home/pluto/Downloads/xtk_simple/lib/ -L/opt/EDTpdv/ -Xlinker --copy-dt-needed-entries -L./build-host-debug/lib -Wl,-rpath ./ build-host-debug/obj/SimpleXscanReader.o build-host-debug/obj/SimpleXscanReader_impl.o build-host-debug/obj/SimpleXscanReader_version.o -lmversion -lappbase -lstorageconfig -lstoragestate -lplutoexcept -ltiff -lpng -lstringpin -lintegerpin -ldoublepin -ldigitaliopin -lsyncpin -lxtk_lib -lintf_edt -ldl -lboost_thread -lboost_filesystem -lpinwrappers -lopencv_core -lopencv_imgproc -lopencv_highgui -lsharedmalloc -lippcv -lippi -lipps -lippvm -lippcore -lrt
/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32//libipps.a(psdivh9l9cn_h9---ownippsDiv_32f.o): In function `h9_ownippsDiv_32f':
psdivh9l9cn_h9---ownippsDiv_32f.i:(.text+0x3ca): undefined reference to `__intel_ssse3_rep_memcpy'
/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32//libipps.a(pscopyca_px---ownsCopy_8u.o): In function `px_ownsCopy_8u':
pscopyca_px---ownsCopy_8u.i:(.text+0x28): undefined reference to `_intel_fast_memcpy'
/opt/intel/composer_xe_2013_sp1.0.061/ipp/lib/ia32//libipps.a(psdivg9e9cn_g9---ownippsDiv_32f.o): In function `g9_ownippsDiv_32f':
psdivg9e9cn_g9---ownippsDiv_32f.i:(.text+0x452): undefined reference to `__intel_ssse3_rep_memcpy'
collect2: ld returned 1 exit status

Also it seems like the environment vars set by the ippvars.sh script do not stay in my system

 

 

These functions are from Intel compiler's libs, probably from libirc. Try to add "-lirc" to the end of g++ command line. "icc" does this automatically, while "g++" requires explicit library reference.

Regards,
Sergey

Regards,
Sergey

Thanks - that did the trick.

Am I meant to run the ippvars script each time I want to work on my IPP projects?

ippvars.sh script setup  IPPROOT and LD_LIBRARY_PATH environment to simplify work with IPP libraries. You can setup this variables in your profile file and no necessary to run ippvars.sh each time in this case.

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui