Intel® C++ Compiler for Linux* - Undefined References Linking libxml2

Symptom(s):

The libxml2 library can be downloaded at http://xmlsoft.org† .

When building libxml version 2 2.6.22, you can get unresolved symbols to pthreads symbols such as:
$ ./configure CC=icc CXX=icpc
$ make
...

./.libs/libxml2.so: undefined reference to `pthread_getspecific'
./.libs/libxml2.so: undefined reference to `pthread_once'
./.libs/libxml2.so: undefined reference to `pthread_key_create'
./.libs/libxml2.so: undefined reference to `pthread_setspecific'
make[2]: *** [xmllint] Error 1

Cause:

Verified as of the libxml2 2.6.22 package, the configure script determines how to link in the pthread library, but for Linux* it assumes the compiler is the GNU gcc compiler and so assumes libpthread is linked in automatically.

Solution:

If you upgrade to a more recent version of libxml2, it will avoid this problem. Version 2.6.27 of libxml2 is known to resolve this problem.

If you are using an earlier version of libxml2, you can avoid the problem by adding this to when you run configure.
$ ./configure CC=icc CXX=icpc LIBS="-lpthread"

Another option is to run make with this command:
$ make LIBS="-lpthread"

† This link will take you off of the Intel Web site. Intel does not control the content of the destination Web Site.
 
Einzelheiten zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.