Skip to content

Commit

Permalink
science/libkml: Fix linking with CMake >= 3.27
Browse files Browse the repository at this point in the history
Due to changes [1] in the FindEXPAT module, this was failing to link
with newer versions of CMake.

FAILED: bin/example_balloonwalker
: && /usr/bin/c++ -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing -std=c++11 -O2 -pipe
-fstack-protector-strong -fno-strict-aliasing -std=c++11 -DNDEBUG -lz -fstack-protector-strong
examples/engine/CMakeFiles/example_balloonwalker.dir/balloonwalker.cc.o -o bin/example_balloonwalker
-Wl,-rpath,/wrkdirs/usr/ports/science/libkml/work/.build/lib:/usr/local/lib  lib/libkmlengine.so.1.3.1
lib/libkmldom.so.1.3.1  lib/libkmlbase.so.1.3.1  /usr/local/lib/libminizip.so  /usr/local/lib/liburiparser.so && :
ld: error: lib/libkmldom.so.1.3.1: undefined reference to XML_StopParser [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserCreateNS [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserCreate [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetUserData [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetElementHandler [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetCharacterDataHandler [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetEntityDeclHandler [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetNamespaceDeclHandler [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_StopParser [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserFree [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_Parse [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetBuffer [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParseBuffer [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetParsingStatus [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetErrorCode [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ErrorString [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetCurrentLineNumber [--no-allow-shlib-undefined]
ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetCurrentColumnNumber [--no-allow-shlib-undefined]
c++: error: linker command failed with exit code 1 (use -v to see invocation)

[1] Kitware/CMake@13079f3

PR:		274225
  • Loading branch information
BSDKaffee committed Nov 8, 2023
1 parent 3e11db2 commit baf3577
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions science/libkml/files/patch-src_kml_base_CMakeLists.txt
@@ -0,0 +1,12 @@
Fix linking with CMake >= 3.27 due to changes [1] in the FindEXPAT module.

[1] https://github.com/Kitware/CMake/commit/13079f382b480c8fe6a68d98afc2cec716a75e59

--- src/kml/base/CMakeLists.txt.orig 2017-01-15 08:52:06 UTC
+++ src/kml/base/CMakeLists.txt
@@ -49,4 +49,4 @@ build_target(
SRCS ${SRCS}
INCS ${INCS}
DEPENDS ${KMLBASE_DEPENDS}
- LINKS ${ZLIB_LIBRARY} ${MINIZIP_LIBRARIES} ${URIPARSER_LIBRARY} ${EXPAT_LIBRARY} )
+ LINKS ${ZLIB_LIBRARY} ${MINIZIP_LIBRARIES} ${URIPARSER_LIBRARY} EXPAT::EXPAT )

0 comments on commit baf3577

Please sign in to comment.