Opened 4 years ago

Closed 4 years ago

#4626 closed defect (fixed)

Fails to build with libxml2 2.9.10 (uses xml2-config)

Reported by: Bas Couwenberg Owned by: pramsey
Priority: medium Milestone: PostGIS 2.5.4
Component: postgis Version: 2.5.x -- EOL
Keywords: Cc:

Description

As reported by Mattia Rizzolo in Debian Bug #949426:

your package is using xml2-config to detect and use libxml2. I'm removing that script, so please update your build system to use pkg-config instead.

The libxml2 package in experimental already doesn't ship the xml2-config script.

Attached is the full build log, hopefully relevant excerpt follows:

checking for xml2-config... no
configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.

Attachments (1)

libxml2.patch (3.7 KB ) - added by Bas Couwenberg 4 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by Algunenano, 4 years ago

libxml-2.0.pc was apparently introduced in 2000, so it shouldn't be an issue to default to using it if xml2-config is not passed.

This will also require changing how the libxml2 version is read to use LIBXML_DOTTED_VERSION instead. As far as I can see, that MACRO has existed at least since 2001.

comment:2 by Algunenano, 4 years ago

The main repo is still building and distributing xml2-config.in, in fact I have libxml2 2.9.10 currently installed and it builds Postgis without issues.

Bas, does this change come from upstream or from a change in Debian packaging? If it's the latter, then this isn't a bug but a feature request to support pkg-config for libxml2 (which is a good idea IMO).

comment:3 by Bas Couwenberg, 4 years ago

As stated in the Debian Bug the libxml2-dev package doesn't include xml2-config any more, upstream may still include it, but the Debian package won't.

by Bas Couwenberg, 4 years ago

Attachment: libxml2.patch added

comment:4 by Bas Couwenberg, 4 years ago

I hacked up a patch that uses pkg-config when libxml2-config is not found.

comment:5 by Algunenano, 4 years ago

Looks good to me. I'm going to remove an extra assignation in the patch (HAVE_LIBXML2="1") and push it to master, 3.0 and 2.5. I have no intention of going back to older stable releases unless someone explicitly ask for it.

comment:6 by Raúl Marín <git@…>, 4 years ago

In 8033b28/git:

Support pkg-config for libxml2

Patch by Bas Couwenberg
References #4626

comment:7 by Raúl Marín <git@…>, 4 years ago

In 1e1e6f0/git:

Support pkg-config for libxml2

Patch by Bas Couwenberg
References #4626

comment:8 by Raúl Marín <git@…>, 4 years ago

Resolution: fixed
Status: newclosed

In e1fab358/git:

Support pkg-config for libxml2

Patch by Bas Couwenberg
Closes #4626

comment:9 by Algunenano, 4 years ago

Pushed. Thanks, Bas!

comment:10 by Algunenano, 4 years ago

Resolution: fixed
Status: closedreopened

Not sure how but this seems to have broken Bessie's build. According to the logs it's not finding a known type so I think it migjt have some old liblwgeom headers installed and cunit test include some flags before including its parent directory.

I'll have a look at CUNIT_CPPFLAGS as its declared in the Makefile as CUNIT_CPPFLAGS=@CUNIT_CPPFLAGS@ -I.. @CPPFLAGS@

comment:11 by Bas Couwenberg, 4 years ago

The CUNIT part of configure.ac uses pkg-config if it's available, due to PKG_PROG_PKG_CONFIG being executed far after that it never actually used pkg-config.

My patch moved PKG_PROG_PKG_CONFIG before the first statements using pkg-config, hence CUNIT uses it too if available.

comment:12 by Algunenano, 4 years ago

That's correct.

I'm going to have a look around to make sure any local directory is added to the CPPFLAGS o CFLAGS before any external input (via CFLAGS, CUNIT_CPPFLAGS, etc). This has bitten us way too many times.

comment:13 by Algunenano, 4 years ago

This is everything I've found: https://github.com/postgis/postgis/pull/543

It looks right in my system, but I'll try to review it with a different setup to confirm I'm not breaking anything.

comment:14 by Raúl Marín <git@…>, 4 years ago

In 220be347/git:

Enforce local folders to be included first

References #4626

comment:15 by robe, 4 years ago

FYI the bessie build failing on raster, might have been some loose liblwgeom flaoting.

I found liblwgeom installed in /usr/local/include liblwgeom.h

and liblwgeom_topo.h

Also found in /usr/local/lib liblwgeom-2.4.so.0, liblwgeom-2.5.so .., liblwgeom.so

I deleted the non-versioned ones from here and the include files and reran and then bessie was fine. So I think it still might be picking up non-local first.

before: https://debbie.postgis.net/view/PostGIS/job/PostGIS_Worker_Run/label=bessie/1875/consoleFull

10:27:28   Test: test_raster_envelope_geom ...gmake[4]: *** [Makefile:77: check] Segmentation fault (core dumped)
10:27:28 gmake[4]: Leaving directory '/usr/home/jenkins/workspace/PostGIS_Worker_Run/label/bessie/220be347eeb5dea6a4a46f871e87779249353038/raster/test/cunit'

after: https://debbie.postgis.net/view/PostGIS/job/PostGIS_Worker_Run/label=bessie/1876/console

all tests pass

comment:16 by Algunenano, 4 years ago

Thanks a lot Robe, I'll review linker flags to see if I find anything out of place and backport the changes to 3.0 too

comment:17 by Raúl Marín <git@…>, 4 years ago

In 3a1e232/git:

test/cunit/: Include liblwgeom first

References #4626

comment:18 by Algunenano, 4 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.