intel_sse2 problems when linking to gsl with icc

2019-05-27 13:01发布

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?

2条回答
孤傲高冷的网名
2楼-- · 2019-05-27 13:06

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).

查看更多
放荡不羁爱自由
3楼-- · 2019-05-27 13:32

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.

查看更多
登录 后发表回答