[mapguide-commits] r10094 - in branches/4.0/MgDev: Common Common/Geometry Common/MapGuideCommon Common/Renderers Oem/DWFTK/develop/global/src/dwf Oem/DWFTK/develop/global/src/dwfcore Server/src/Common/Manager Server/src/Services/Drawing Server/src/Services/Feature Server/src/Services/Kml Server/src/Services/Resource Server/src/Services/Site
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Aug 13 04:27:37 PDT 2024
Author: jng
Date: 2024-08-13 04:27:36 -0700 (Tue, 13 Aug 2024)
New Revision: 10094
Modified:
branches/4.0/MgDev/Common/CMakeLists.txt
branches/4.0/MgDev/Common/Geometry/CMakeLists.txt
branches/4.0/MgDev/Common/MapGuideCommon/CMakeLists.txt
branches/4.0/MgDev/Common/Renderers/CMakeLists.txt
branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt
branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
branches/4.0/MgDev/Server/src/Common/Manager/CMakeLists.txt
branches/4.0/MgDev/Server/src/Services/Drawing/CMakeLists.txt
branches/4.0/MgDev/Server/src/Services/Feature/CMakeLists.txt
branches/4.0/MgDev/Server/src/Services/Kml/CMakeLists.txt
branches/4.0/MgDev/Server/src/Services/Resource/CMakeLists.txt
branches/4.0/MgDev/Server/src/Services/Site/CMakeLists.txt
Log:
Resolve the criss-crossing of symbol resolution on the Linux build if distro-provided versions of certain
thirdparty libraries we use are already present.
The main culprit is that the DWF Toolkit is being built with its internal sqlite3 symbols being made
public, which means that ld could bind sqlite3 symbols to this library even though a distro-provided
sqlite3 library may already be installed.
If MapGuide is built with internal GEOS on Linux, the same problem happens there too, which results
in cryptic segfaults on some usages of GEOS (through GDAL/OGR) if distro-provided gdal and geos libraries
are installed as ld would bind geos symbols to libMgGeometry.so, the sole consumer of the GEOS library
in MapGuide. Both cases were verified by running mgserver with LD_DEBUG=bindings and observing that ld
was binding sqlite3* and geos* symbols our MapGuide libraries instead of the distro-provided versions.
I suppose one could employ various LD_* environment variable trickery to workaround this, but I'd rather
we build our libraries in a way that such hacky workarounds are not required.
The fix for both cases is to make sure that these symbols are completely internalized and the best way
to ensure that happens is to ensure such symbols are provided in a static library and to ensure such
libraries are linked with -Wl,--exclude-libs,ALL preceding the static libraries to be linked. The symbols
in these libaries will be hidden in the final shared library as a result.
The alternative (and proper) solution would be to employ GCC symbol visibility (ie. the GCC equivalent of
__declspec(dllexport)) and build everything with -fvisibility=hidden but this solution requires much
more time investment as this is an invasive change and our codebase is not setup for this on Linux. Maybe
in the future we'll switch over, but not right now.
Internal GEOS is already a static library, but DWF Toolkit was not. So this commit changes the DWF
Toolkit to now be built as static libraries.
Various library targets in MapGuide have been modified to ensure any linkages of static libraries are
preceded with -Wl,--exclude-libs,ALL in their respective link lines.
Fixes #2874
Modified: branches/4.0/MgDev/Common/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Common/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Common/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -37,8 +37,8 @@
endif (INTERNAL_XERCES)
if (NOT MG_COMMON_SUBSET_ONLY)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../Oem/DWFTK/develop/global/src/dwfcore/libdwfcore-1.7.0.so DESTINATION ${LIB_INSTALL_DIR})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../Oem/DWFTK/develop/global/src/dwf/libdwftk-7.7.0.so DESTINATION ${LIB_INSTALL_DIR})
+ #install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../Oem/DWFTK/develop/global/src/dwfcore/libdwfcore-1.7.0.so DESTINATION ${LIB_INSTALL_DIR})
+ #install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../Oem/DWFTK/develop/global/src/dwf/libdwftk-7.7.0.so DESTINATION ${LIB_INSTALL_DIR})
else (NOT MG_COMMON_SUBSET_ONLY)
# The common subset profile is geared towards SWIG wrappers, so we need the relevant headers as well
install(
Modified: branches/4.0/MgDev/Common/Geometry/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Common/Geometry/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Common/Geometry/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -67,12 +67,24 @@
target_link_libraries(MgGeometry${MG_VERSION_SUFFIX}
MgFoundation${MG_VERSION_SUFFIX}
- CsMap
${ACE_LIBRARY}
- ${GEOS_LIBRARY}
pthread
)
+if (INTERNAL_GEOS)
+ # Internal GEOS and CsMap will be static, so ensure the static libs linked have symbols hidden
+ target_link_libraries(MgGeometry${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ CsMap
+ ${GEOS_LIBRARY})
+else ()
+ # Only CsMap will be static, so ensure the static libs linked have symbols hidden
+ target_link_libraries(MgGeometry${MG_VERSION_SUFFIX}
+ ${GEOS_LIBRARY}
+ -Wl,--exclude-libs,ALL
+ CsMap)
+endif ()
+
set_target_properties(MgGeometry${MG_VERSION_SUFFIX} PROPERTIES INSTALL_RPATH "$ORIGIN")
install( TARGETS MgGeometry${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT} )
Modified: branches/4.0/MgDev/Common/MapGuideCommon/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Common/MapGuideCommon/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Common/MapGuideCommon/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -24,6 +24,7 @@
MgMdfModel${MG_VERSION_SUFFIX}
MgFoundation${MG_VERSION_SUFFIX}
MgPlatformBase${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
MgSecurity${MG_VERSION_SUFFIX}
)
Modified: branches/4.0/MgDev/Common/Renderers/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Common/Renderers/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Common/Renderers/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -54,14 +54,15 @@
add_library(MgRenderers${MG_VERSION_SUFFIX} SHARED ${MgRenderers_SRCS})
target_link_libraries(MgRenderers${MG_VERSION_SUFFIX}
+ MgStylization${MG_VERSION_SUFFIX}
${GD_LIBRARY}
${FREETYPE_LIBRARY}
${JPEG_LIBRARY}
${PNG_LIBRARY}
${AGG_LIBRARY}
+ -Wl,--exclude-libs,ALL
dwfcore-1.7.0
dwftk-7.7.0
- MgStylization${MG_VERSION_SUFFIX}
)
install( TARGETS MgRenderers${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT} )
Modified: branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwf/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -334,7 +334,7 @@
xps/XPSFontResourceExtractor.cpp
)
-add_library(dwftk-${DWF_VERSION} SHARED ${dwftk_SRCS})
+add_library(dwftk-${DWF_VERSION} STATIC ${dwftk_SRCS})
target_link_libraries(dwftk-${DWF_VERSION}
-Wl,-Bsymbolic
dwfcore-${DWFCORE_VERSION})
Modified: branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -105,7 +105,7 @@
zlib/zutil.c
)
-add_library(dwfcore-${DWFCORE_VERSION} SHARED ${dwfcore_SRCS})
+add_library(dwfcore-${DWFCORE_VERSION} STATIC ${dwfcore_SRCS})
if (UUID_FOUND)
target_link_libraries(dwfcore-${DWFCORE_VERSION}
Modified: branches/4.0/MgDev/Server/src/Common/Manager/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Common/Manager/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Common/Manager/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -40,6 +40,8 @@
MgMapGuideCommon${MG_VERSION_SUFFIX}
MgServerThread${MG_VERSION_SUFFIX}
MgServerCache${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ MgSecurity${MG_VERSION_SUFFIX}
)
if(MG_CPU EQUAL 64)
Modified: branches/4.0/MgDev/Server/src/Services/Drawing/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Drawing/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Services/Drawing/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -20,5 +20,10 @@
)
add_library(MgServerDrawingService${MG_VERSION_SUFFIX} SHARED ${MgServerDrawingService_SRCS})
+target_link_libraries(MgServerDrawingService${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ dwfcore-1.7.0
+ dwftk-7.7.0
+)
install(TARGETS MgServerDrawingService${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT})
install_symlink(libMgServerDrawingService${MG_VERSION_SUFFIX}.so libMgServerDrawingService.so ${MG_COMPONENT})
\ No newline at end of file
Modified: branches/4.0/MgDev/Server/src/Services/Feature/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Feature/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Services/Feature/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -31,6 +31,8 @@
target_link_libraries(MgServerFeatureService${MG_VERSION_SUFFIX}
MgGwsCommon${MG_VERSION_SUFFIX}
MgGwsQueryEngine${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ MgSecurity${MG_VERSION_SUFFIX}
)
if(MG_CPU EQUAL 64)
Modified: branches/4.0/MgDev/Server/src/Services/Kml/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Kml/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Services/Kml/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -27,5 +27,10 @@
)
add_library(MgServerKmlService${MG_VERSION_SUFFIX} SHARED ${MgServerKmlService_SRCS})
+target_link_libraries(MgServerKmlService${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ dwfcore-1.7.0
+ dwftk-7.7.0
+)
install(TARGETS MgServerKmlService${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT})
install_symlink(libMgServerKmlService${MG_VERSION_SUFFIX}.so libMgServerKmlService.so ${MG_COMPONENT})
\ No newline at end of file
Modified: branches/4.0/MgDev/Server/src/Services/Resource/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Resource/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Services/Resource/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -37,8 +37,10 @@
${DBXML_LIBRARY}
${XQILLA_LIBRARY}
${XERCESC_LIBRARIES}
+ -Wl,--exclude-libs,ALL
${ZLIB_LIBRARY}
minizip
+ MgSecurity${MG_VERSION_SUFFIX}
)
install(TARGETS MgServerResourceService${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT})
install_symlink(libMgServerResourceService${MG_VERSION_SUFFIX}.so libMgServerResourceService.so ${MG_COMPONENT})
Modified: branches/4.0/MgDev/Server/src/Services/Site/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Services/Site/CMakeLists.txt 2024-08-05 16:28:05 UTC (rev 10093)
+++ branches/4.0/MgDev/Server/src/Services/Site/CMakeLists.txt 2024-08-13 11:27:36 UTC (rev 10094)
@@ -17,5 +17,11 @@
)
add_library(MgServerSiteService${MG_VERSION_SUFFIX} SHARED ${MgServerSiteService_SRCS})
+
+target_link_libraries(MgServerSiteService${MG_VERSION_SUFFIX}
+ -Wl,--exclude-libs,ALL
+ MgSecurity${MG_VERSION_SUFFIX}
+)
+
install(TARGETS MgServerSiteService${MG_VERSION_SUFFIX} DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${MG_COMPONENT})
install_symlink(libMgServerSiteService${MG_VERSION_SUFFIX}.so libMgServerSiteService.so ${MG_COMPONENT})
\ No newline at end of file
More information about the mapguide-commits
mailing list