Search
Support & Downloads
All of Support
This Category
This Product
Software Products
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 applies to:
Intel® C++ Compiler for Linux*

Solution ID: CS-021834
Date Created: 21-Nov-2005
Last Modified: 02-May-2007
Back to Top