0
votes

When I was compiling a new software, I encountered a bunch of errors emitted by ld.

/usr/lib/libstreamanalyzer.so.0: undefined reference to `xmlSAXUserParseMemory@LIBXML2_2.4.30'
/usr/lib/libstreamanalyzer.so.0: undefined reference to `xmlCtxtResetPush@LIBXML2_2.6.1'
/usr/lib/libstreamanalyzer.so.0: undefined reference to `xmlCreatePushParserCtxt@LIBXML2_2.4.30'

This seems to be confusing. Linker is supposed to be looking for symbols in objects, not library names, but it seems in this case those before the @ is the function name/symbol, and LIBXML2_2.6.1 is a library name. And for dynamic library, the soname x.y.z version should only matter in dynamic linking stage, that is when the executable actually runs.

So what does this error really means, and what part of the above assumptions are wrong?

Edit:

The problem appears after installing libxml2 2.7.8. It is gone after libxml2 is upgraded to 2.9.1.

1

1 Answers

1
votes

When I was compiling a new software, I encountered a bunch of errors

No, you didn't. You encountered errors when linking, which is different from compiling.

Linker is supposed to be looking for symbols in objects

UNIX linkers also look for symbols in libraries (both archive and shared).

LIBXML2_2.6.1 is a library name

No, it's not. It's a symbol version, which happens to reflect the library in which that symbol was defined.

So what does this error really means

This error means: when libstreamanalyzer.so.0 was linked, it was linked against a library (most likely libxml2.so) that provided versioned symbols xmlSAXUserParseMemory@LIBXML2_2.4.30, etc.

You are now linking your binary against some other version of libxml2, one which does not provide these symbols, and your binary will not work.