libxslt uses too many libraries
Hi, I have libxslt 1.1.34 installed using MacPorts, and I find that xslt-config --libs --dynamic
and pkg-config libxslt --libs
both print too many libraries:
$ # actual
$ xslt-config --libs
-L/opt/local/lib -lxslt -lxml2 -licui18n -licuuc -licudata -lpthread -lz -llzma -liconv -lm
$ xslt-config --libs --dynamic
-L/opt/local/lib -lxslt -lxml2 -licui18n -licuuc -licudata -lpthread -lz -llzma -liconv -lm
$ pkg-config libxslt --libs
-L/opt/local/lib -lxslt -lxml2 -licui18n -licuuc -licudata -lpthread -lz -llzma -liconv -lm -lxml2
What I was expecting to see was something more like:
$ # expected
$ xslt-config --libs
-L/opt/local/lib -lxslt -lxml2 -licui18n -licuuc -licudata -lpthread -lz -llzma -liconv -lm
$ xslt-config --libs --dynamic
-L/opt/local/lib -lxslt
$ pkg-config libxslt --libs
-L/opt/local/lib -lxslt
(maybe with -lpthread
and/or -lm
added; I don't know)
In fact the libxslt library itself is also linked with all those unnecessary libraries:
$ # actual
$ otool -L /opt/local/lib/libxslt.dylib
/opt/local/lib/libxslt.dylib:
/opt/local/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.34.0)
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.9.0)
/opt/local/lib/libicui18n.65.dylib (compatibility version 65.0.0, current version 65.1.0)
/opt/local/lib/libicuuc.65.dylib (compatibility version 65.0.0, current version 65.1.0)
/opt/local/lib/libicudata.65.dylib (compatibility version 65.0.0, current version 65.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/opt/local/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
Since libxml2 is the only dependency mentioned in the libxslt INSTALL file, what I would have expected to see is more like this:
$ # expected
$ otool -L /opt/local/lib/libxslt.dylib
/opt/local/lib/libxslt.dylib:
/opt/local/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.34.0)
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
Yes my libxml2.dylib links with the icu, zlib, lzma and iconv libraries, but the only time that should be of any concern to libxslt is when creating the static library. When creating a dynamic library, those other libraries are not needed and should not be linked with.