2

My program links to both PETSc and gsl, and both libraries were compiled with icc. Here's the link command:

/usr/local/mpich2/bin/mpicc -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3 -I/usr/local/gsl-icc-1.15/include/ -I/usr/local/gsl-icc-1.15/include/ -L/usr/local/gsl-icc-1.15/lib/ -lgsl -lgslcblas prog_name.o -L/usr/local/petsc-3.2-p6/lib  -lpetsc -lX11 -lpthread -llapack -lblas -L/central/intel/Compiler-11.1.072/mkl/lib/em64t -L/central/intel/Compiler-11.1.072/lib/intel64 -L/central/intel/Compiler-11.1.072/tbb/intel64/cc3.4.3_libc2.3.4_kernel2.6.9/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -ldl -lgcc_s -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -lpthread -lirc_s -lm -lstdc++ -lstdc++ -ldl -lgcc_s -ldl  -o prog_name

MPICH_CC is set to icc, so mpicc calls the intel compiler.

When I try to link to the gsl .so file, I get the following errors:

gsl-icc-1.15/lib/libgsl.so: undefined reference to `__intel_sse2_strcpy'
gsl-icc-1.15/lib/libgsl.so: undefined reference to `__intel_sse2_strchr'
gsl-icc-1.15/lib/libgsl.so: undefined reference to `__intel_sse2_strncpy'

What could be the cause of this error? Is gsl incompatible with the intel compiler?

amanda
  • 21
  • 1
  • 3

3 Answers3

1

What could be the cause of this error?

You didn't show us your link command, but my crystall ball tells me that you are trying to link libgsl.so with ld (or perhaps with gcc), instead of icc.

In general, one should never link anything directly with ld on UNIX. Always use appropriate compiler driver (icc in this case).

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
1

I also get the same error message when linking some code with gcc against a PETSc version that was compiled with icc. Even more, when using the newest Intel 12.x compiler for the final code, and compiling PETSc with Intel 11.x results in the same error message as Intel 12.x uses 11.x.

So check, that mpicc really use the Intel 11.1.072 compiler. Check for mpic++ -show and which icc.

Thomas W.
  • 2,134
  • 2
  • 24
  • 46
0

Maybe the intel environment not set. Try the following environment setting:

source /etc/Intel_Compiler/10.0/XXXX/iccvars_intel64.sh
source /etc/Intel_Compiler/10.0/XXXX/ifortvars_intel64.sh

make the folder to your Intel Compiler folder. Some version's environment setting is different, you can also try:

source /etc/Intel_Compiler/10.0/XXXX/iccvars.sh intel64
source /etc/Intel_Compiler/10.0/XXXX/ifortvars.sh intel64

Hope helpfully.

Liang Zulin
  • 343
  • 4
  • 8