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


The libxml2 library can be downloaded at† .

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/ undefined reference to `pthread_getspecific'
./.libs/ undefined reference to `pthread_once'
./.libs/ undefined reference to `pthread_key_create'
./.libs/ undefined reference to `pthread_setspecific'
make[2]: *** [xmllint] Error 1


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.


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.
For more complete information about compiler optimizations, see our Optimization Notice.

1 comment

anonymous's picture

This article is helpful.
Thanks a lot.

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.