Bug 266252 - science/libkml breakage (references to #266221)
Summary: science/libkml breakage (references to #266221)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-06 16:19 UTC by Robert Kruus
Modified: 2023-09-30 02:36 UTC (History)
4 users (show)

See Also:
thierry: maintainer-feedback?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Kruus 2022-09-06 16:19:23 UTC
Added info for bug #266221

The errors stem from improper linking -- the build does not link to the libkml libraries as it builds.
for example libkmlregionator.so.1 should link to libraries in PREFIX and
...
        libkmlconvenience.so.1
        libkmlengine.so.1
        libkmldom.so.1
        libkmlbase.so.1
....

but the latest reverted build did not do that, it was only linking to libraries in PREFIX and none of the required libkml libraries in the build directory.

Using the same lib as an example, the broken build ran:
/usr/bin/c++ -fPIC -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++98 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++98 -lz -fstack-protector-strong -shared -Wl,-soname,libkmlregionator.so.1 -o lib/libkmlregionator.so.1.3.1

I was able to manually relinking the libs fixed the issue before install, for the libkmlregionator.so.1 example adding in the build directory and libs to the rpath:

/usr/bin/c++ -fPIC -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++98 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=gnu++98 -lz -fstack-protector-strong -shared -Wl,-soname,libkmlregionator.so.1 -o lib/libkmlregionator.so.1.3.1 src/kml/regionator/CMakeFiles/kmlregionator.dir/feature_list_region_handler.cc.o src/kml/regionator/CMakeFiles/kmlregionator.dir/regionator.cc.o src/kml/regionator/CMakeFiles/kmlregionator.dir/regionator_util.cc.o
-Wl,-rpath,/usr/obj/usr/ports/science/libkml/work/.build/lib /usr/obj/usr/ports/science/libkml/work/.build/lib/libkmlbase.so.1 /usr/obj/usr/ports/science/libkml/work/.build/lib/libkmldom.so.1 /usr/obj/usr/ports/science/libkml/work/.build/lib/libkmlengine.so.1 /usr/obj/usr/ports/science/libkml/work/.build/lib/libkmlconvenience.so.1

resolved the issue.

Similar fixes were needed to be applied to relink all libkml libriaries, except libkmlbase.
Comment 1 Tom Pusateri 2022-09-07 21:49:59 UTC
Just upgraded my ports and now geo django (with postgis which depends on gdal) is broken too.

It was broken with pkg upgrade to libkml-1.3.0_24

File "/usr/local/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/libkmlregionator.so.1: Undefined symbol "_ZN14kmlconvenience11FeatureList11RegionSplitERKN5boost13intrusive_ptrIN6kmldom6RegionEEEmPS0_"

then I upgraded to libkml-1.3.0_25 via ports and it's still broken but just a different undefined symbol.

 File "/usr/local/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/libkmlbase.so.1: Undefined symbol "_ZN7kmlbase8ToStringENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE"
Comment 2 Robert Kruus 2022-09-07 21:52:56 UTC
(In reply to Tom Pusateri from comment #1)
See bug #266235

Need to delete the broken version first.
Comment 3 Tom Pusateri 2022-09-07 21:58:47 UTC
(In reply to Robert Kruus from comment #2)
I did delete the old version by running make deinstall in the ports tree before running make install. It didn't help.

I just downgraded to libkml-1.3.0_22 and everything is working again.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-09-29 16:21:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e17f183ac7cb12907ae44e3e4d71258de6e6afda

commit e17f183ac7cb12907ae44e3e4d71258de6e6afda
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-09-29 16:13:35 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-09-29 16:13:35 +0000

    science/libkml: Update to newer snapshot (916a801)

    - Re-apply 71a4cedd0383a76f847f0fa1ab32b9209df20959
    - Clean up BUILD_DEPENDS: all of them are in the ports tree for years
    - Bump PORTREVISION of dependent port (graphics/gdal) for shlib change
    - Bump PORTREVISION for package change

    Local patches have been merged by upstream in 916a801 [1].
    Tested all dependent ports of graphics/gdal in case of potential breakage.
    - math/openturns and science/paraview are skipped due to ceres-solver breakage
    - graphics/mapnik is skipped due to potential boost-libs breakage [2][3]

    Changes:        https://github.com/libkml/libkml/commits/master
    Reference:      https://github.com/libkml/libkml/commit/916a801ed3143ab82c07ec108bad271aa441da16 [1]
                    https://pkg-status.freebsd.org/beefy18/data/main-amd64-default/p3b548e384d0b_sfc4a676827/logs/mapnik-3.1.0_3.log [2]
                    https://pkg-status.freebsd.org/beefy16/data/132amd64-default/3b548e384d0b/logs/mapnik-3.1.0_3.log [3]
    PR:             266221, 266252

 graphics/gdal/Makefile                                    |  1 +
 science/libkml/Makefile                                   |  8 ++++----
 science/libkml/distinfo                                   |  6 +++---
 .../files/patch-examples-domviewer-CMakeLists.txt (gone)  |  7 -------
 .../files/patch-examples-engine-CMakeLists.txt (gone)     | 10 ----------
 .../libkml/files/patch-examples-gpx-CMakeLists.txt (gone) | 10 ----------
 .../libkml/files/patch-examples-gx-CMakeLists.txt (gone)  | 11 -----------
 .../files/patch-examples-hellonet-CMakeLists.txt (gone)   | 15 ---------------
 .../files/patch-examples-java-CMakeLists.txt (gone)       | 14 --------------
 .../libkml/files/patch-examples-kml-CMakeLists.txt (gone) | 10 ----------
 .../files/patch-examples-python-CMakeLists.txt (gone)     | 10 ----------
 .../files/patch-examples-regionator-CMakeLists.txt (gone) | 10 ----------
 .../libkml/files/patch-examples-xsd-CMakeLists.txt (gone) | 12 ------------
 science/libkml/pkg-plist                                  | 13 +++++++------
 14 files changed, 15 insertions(+), 122 deletions(-)
Comment 5 alexvpetrov 2023-09-30 01:49:05 UTC
(In reply to commit-hook from comment #4)
The last port(1.3.0_26) don't build.
[ 58% 74/127] /usr/bin/c++ -Dkmlxsd_EXPORTS -I/usr/ports/science/libkml/work/libkml-916a801/src -I/usr/local/include/uriparser -I/usr/local/include/minizip -I/usr/local/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -fPIC -MD -MT src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o -MF src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o.d -o src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o -c /usr/ports/science/libkml/work/libkml-916a801/src/kml/xsd/xsd_file.cc
FAILED: src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o 
/usr/bin/c++ -Dkmlxsd_EXPORTS -I/usr/ports/science/libkml/work/libkml-916a801/src -I/usr/local/include/uriparser -I/usr/local/include/minizip -I/usr/local/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -fPIC -MD -MT src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o -MF src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o.d -o src/kml/xsd/CMakeFiles/kmlxsd.dir/xsd_file.cc.o -c /usr/ports/science/libkml/work/libkml-916a801/src/kml/xsd/xsd_file.cc
/usr/ports/science/libkml/work/libkml-916a801/src/kml/xsd/xsd_file.cc:53:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
struct GetElement : public std::unary_function<NameElementPair, void> {
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function
/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
1 error generated.
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/science/libkml
*** Error code 1
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-09-30 02:36:11 UTC
The problem was caused by Clang 16 which uses c++17 by default. It should be fixed in ports a6a8311b884907cf8a6aac3b3b3038f5bdd34751 (tested on FreeBDSD 14).