LIBXML Not linking in

87 views
Skip to first unread message

dan

unread,
May 13, 2021, 2:29:44 PM5/13/21
to SpatiaLite Users

I know this has got to be something obvious, but libxml2 is not getting linked in.
I've got the environment flags specified in configure:
./configure --prefix=/usr/local --enable-geos --enable-proj --disable-freexl LIBXML2_CFLAGS=-I/usr/local/include/libxml2 LIBXML2_LIBS=-L/usr/local/lib

When the examples are built, I'm seeing link errors like:
/usr/bin/ld: /usr/local/src/libspatialite-5.0.1/src/.libs/libspatialite.so: undefined reference to `xmlXPathNewContext'
/usr/bin/ld: /usr/local/src/libspatialite-5.0.1/src/.libs/libspatialite.so: undefined reference to `xmlXPathFreeContext'
/usr/bin/ld: /usr/local/src/libspatialite-5.0.1/src/.libs/libspatialite.so: undefined reference to `xmlXPathRegisterNs'

I don't see the libxml2.so included in the gcc line:
/bin/bash ../libtool  --tag=CC   --mode=link gcc -I./../src/headers  -g -O2 -L../src -lspatialite -lm   -o demo1 demo1.o -L/usr/local/lib -lminizip -lrttopo -lproj -lsqlite3 -lz -lsqlite3  -L/usr/lib/x86_64-linux-gnu -lgeos_c
libtool: link: gcc -I./../src/headers -g -O2 -o .libs/demo1 demo1.o  -L../src /usr/local/src/libspatialite-5.0.1/src/.libs/libspatialite.so -L/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libsqlite3.so -L/usr/local/lib -lminizip -lrttopo /usr/lib/x86_64-linux-gnu/libproj.so /usr/local/lib/libsqlite3.so -lz -lm -ldl -lpthread -lgeos_c

If I manually put in the path to the libxml2.so file in the gcc above it compiles and links fine.

Anyone have any ideas?

Thanks,

Dan

a.fu...@lqt.it

unread,
May 14, 2021, 2:46:51 AM5/14/21
to spatiali...@googlegroups.com
Hi Dan,

the ./configure script supporting libspatialite has no idea
about flags named LIBXML2_CFLAGS or LIBXML2_LIB, so they'll
be completely ignored.

the local configuration of libxml2 is automatically detected
by pkg-config, that presumably is not installed or is badly
configured.

hint: you can try something like

export "CFLAGS=-I/usr/local/include"
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
./configure

bye Sandro

dan

unread,
May 14, 2021, 7:20:48 AM5/14/21
to SpatiaLite Users
I'll give that a try. Are those LIBXML flags just in configure by default?

a.fu...@lqt.it

unread,
May 15, 2021, 2:29:10 AM5/15/21
to spatiali...@googlegroups.com
On Fri, 14 May 2021 04:20:48 -0700 (PDT), dan wrote:
> I'll give that a try. Are those LIBXML flags just in configure by
> default?
>

Hi Dan,

the LIBXML* flags are absolutely not a standard, they simply are
an internal convention supported by several gis-like packages,
but they lacks any systemwide support.

libxml2 has nothing exceptional, it's just a library as many others,
and nicely supports a canonical configuration based on pkg-config,
a well known and widespread tool.
so there is no reason for supporting the ad hoc and non standard
LIBMXL* flags when a more general and systemwide approach is
available.

bye Sandro

dan

unread,
May 17, 2021, 8:22:59 AM5/17/21
to SpatiaLite Users
What is the configure check actually looking for? LIBXML resides on this system(Ubuntu 20.04.2) installed via apt install libxml2-dev.
Lib is here: /usr/lib/x86_64-linux-gnu/libxml2.so
Includes here:  /usr/include/libxml2

I tried using the CFLAGS and LIBS but it still does not find whatever it is looking for.

dan

unread,
May 17, 2021, 8:46:01 AM5/17/21
to SpatiaLite Users
Ok, I think I figured this out. Maybe it's common knowledge, but I didn't know. You have to have pkg-config installed. The check for LIBXML2 uses that for its check. Seems to be the only
piece that does that(GEOS doesn't for example).

a.fu...@lqt.it

unread,
May 17, 2021, 9:04:57 AM5/17/21
to spatiali...@googlegroups.com
On Mon, 17 May 2021 05:46:01 -0700 (PDT), dan wrote:
> Ok, I think I figured this out. Maybe it's common knowledge, but I
> didn't know. You have to have pkg-config installed. The check for
> LIBXML2 uses that for its check. Seems to be the only
> piece that does that(GEOS doesn't for example).
>

yes, pkg-config isn't always automatically installed by dafault,
but it's a well known and almost universally supported tool
and it's strongly supported by FreeDesktop.org

https://en.wikipedia.org/wiki/Pkg-config

https://www.freedesktop.org/wiki/Software/pkg-config/

bye Sandro



Reply all
Reply to author
Forward
0 new messages