[mapguide-commits] r10277 - in branches/4.0/MgDev: . Server/RepositoryAdmin/app Server/src/Core cmake/configs
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Nov 7 23:04:03 PST 2026
Author: jng
Date: 2026-11-07 23:04:01 -0800 (Sat, 07 Nov 2026)
New Revision: 10277
Modified:
branches/4.0/MgDev/Server/RepositoryAdmin/app/MapGuide.RepositoryAdmin.csproj
branches/4.0/MgDev/Server/src/Core/CMakeLists.txt
branches/4.0/MgDev/Server/src/Core/mapguidectl
branches/4.0/MgDev/cmake/configs/mgserver.sh.in
branches/4.0/MgDev/cmake/configs/mgserverd.sh.in
branches/4.0/MgDev/cmake_linuxapt.sh
Log:
Remove build-host and host-distribution dependencies from the generic Linux output
The generic build targets glibc 2.28+ and bundles everything else, but several pieces still leaked
the build tree or assumed a Debian/Rocky host. This closes the gaps that live in this tree:
- Oem/dbxml/buildall.sh links the Berkeley DB XML tools and libdbxml/libxqilla with the build
tree's install/lib (and, for an internal-xerces build, the xerces source dir) in DT_RPATH, and
nothing rewrote it when they were installed through install(FILES)/install(PROGRAMS). The shipped
db_* and dbxml* tools could therefore only run with the build tree's LD_LIBRARY_PATH. Rewrite the
installed RPATH to $ORIGIN/../lib64, which is server/lib64 for both the server/bin tools and the
server/lib64 libraries. file(RPATH_SET) rewrites in place, so the new path has to be shorter than
the build path it replaces, and it needs a CMake that provides the command (the supported build
hosts do; older CMake leaves the path as it was).
- mapguidectl sourced /lib/lsb/init-functions unconditionally. That file is Debian/Ubuntu only, so
on the RHEL family, Arch and openSUSE the service script ran with undefined log_* helpers. Source
the LSB file if present, define those helpers otherwise, and fall back from pgrep to ps when
procps is absent.
- Xerces-C and Apache's APR transcoder fail to initialise when the process locale has no UTF-8
charset ("Could not load a transcoding service"), which is what a bare environment gets on
openSUSE. mgserver.sh, mgserverd.sh and the envvars written for apachectl now select a UTF-8
locale that the system actually has when the environment has none.
- PHP's configure recorded an rpath for every -L path, which put the build host's
/usr/local/lib64:/usr/local/lib into php, php-cgi and libphp.so. Configure with --disable-rpath,
and rebuild a tree whose config.nice does not have it, following the existing apxs/ZTS reuse
checks.
- MapGuide.RepositoryAdmin is published self-contained, but the .NET "self-contained" runtime is
still tied to the host: the single-file host links libz.so.1 unconditionally, and the runtime
needs the host's ICU unless globalization is invariant. Publish linux-x64 with
InvariantGlobalization and without PublishSingleFile, which removes both (the compression native
library is only loaded if System.IO.Compression is used, which this tool does not). Scope it to
that RID so the Windows publish keeps its single-file, culture-aware shape.
Verified on the Release generic artifacts. The server, the PHP binding under httpd and a
GETSITEVERSION MapAgent request work on Debian 12, Fedora 43, AlmaLinux 9, Arch Linux and
openSUSE Leap 15.6 (libxcrypt-compat/libcrypt1 installed where the distro does not provide
libcrypt.so.1 by default); Debian 10 (glibc 2.28) runs the server. Every FDO provider except
KingOracle loads under RTLD_NOW on Debian 12, Fedora 43 and AlmaLinux 9. The RepositoryAdmin
publish starts with libz.so.1 and libicu removed.
Modified: branches/4.0/MgDev/Server/RepositoryAdmin/app/MapGuide.RepositoryAdmin.csproj
===================================================================
--- branches/4.0/MgDev/Server/RepositoryAdmin/app/MapGuide.RepositoryAdmin.csproj 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/Server/RepositoryAdmin/app/MapGuide.RepositoryAdmin.csproj 2026-11-08 07:04:01 UTC (rev 10277)
@@ -21,6 +21,20 @@
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
</PropertyGroup>
+ <!-- Linux-only: make the published tool independent of the host's native libraries.
+ The .NET single-file host (singlefilehost) links libz.so.1 unconditionally, even with
+ EnableCompressionInSingleFile off, so a self-contained single-file tool still needs the
+ host's zlib. A normal self-contained publish has no libz DT_NEEDED entry; the compression
+ native library is a separate file, loaded only if the app uses System.IO.Compression,
+ which this tool does not. The runtime also requires the host's ICU (libicu) at startup
+ unless globalization is invariant; this tool does no culture-sensitive work beyond
+ invariant file-name matching. Neither applies to the Windows publish, which keeps the
+ single-file, culture-aware shape the Windows installer records. -->
+ <PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
+ <PublishSingleFile>false</PublishSingleFile>
+ <InvariantGlobalization>true</InvariantGlobalization>
+ </PropertyGroup>
+
<ItemGroup>
<PackageReference Include="DotMake.CommandLine" Version="2.4.2" />
</ItemGroup>
Modified: branches/4.0/MgDev/Server/src/Core/CMakeLists.txt
===================================================================
--- branches/4.0/MgDev/Server/src/Core/CMakeLists.txt 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/Server/src/Core/CMakeLists.txt 2026-11-08 07:04:01 UTC (rev 10277)
@@ -142,6 +142,34 @@
install(PROGRAMS ${MG_OEM_WORK_DIR}/dbxml/install/bin/db_recover DESTINATION ${MG_SERVER_BIN_DIR})
install(PROGRAMS ${MG_OEM_WORK_DIR}/dbxml/install/bin/db_upgrade DESTINATION ${MG_SERVER_BIN_DIR})
install(PROGRAMS ${MG_OEM_WORK_DIR}/dbxml/install/bin/db_verify DESTINATION ${MG_SERVER_BIN_DIR})
+# Oem/dbxml/buildall.sh links the Berkeley DB XML tools and the libtool-built libdbxml/libxqilla
+# with the build tree's install/lib (and, for an internal-xerces build, the xerces source dir) in
+# DT_RPATH. Nothing rewrites that when they are installed through install(FILES)/install(PROGRAMS),
+# so the installed tools could only run with the build tree's LD_LIBRARY_PATH. Both the tools
+# (server/bin) and the libraries (server/lib64) resolve $ORIGIN/../lib64 to the installed
+# server/lib64. file(RPATH_SET) rewrites in place, so this only works because the new path is
+# shorter than the build path it replaces. The supported build hosts have a CMake that provides
+# it (Ubuntu 22.04 has 3.22, the generic thin image 3.26); on an older one the build-tree path is
+# left in place, which only means the installed tools keep needing LD_LIBRARY_PATH.
+if (UNIX AND NOT CMAKE_VERSION VERSION_LESS "3.21")
+ set(DBXML_INSTALL_RPATH "$ORIGIN/../lib64")
+ foreach(dbxml_tool
+ dbxml dbxml_dump dbxml_load
+ db_archive db_checkpoint db_dump db_hotbackup db_load db_recover db_upgrade db_verify)
+ install(CODE "file(RPATH_SET FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${MG_SERVER_BIN_DIR}/${dbxml_tool}\" NEW_RPATH \"${DBXML_INSTALL_RPATH}\")")
+ endforeach()
+ # DBXML_LIBS is libdb*.so, which also matches libdb/libdb_cxx - those are not built with
+ # libtool and carry no RPATH, so only libdbxml* may be rewritten.
+ foreach(dbxml_lib ${DBXML_LIBS})
+ get_filename_component(dbxml_lib_name "${dbxml_lib}" NAME)
+ if (dbxml_lib_name MATCHES "^libdbxml")
+ install(CODE "file(RPATH_SET FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${dbxml_lib_name}\" NEW_RPATH \"${DBXML_INSTALL_RPATH}\")")
+ endif()
+ endforeach()
+ foreach(xqilla_lib libxqilla.so libxqilla.so.5 libxqilla.so.5.0.4)
+ install(CODE "file(RPATH_SET FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${xqilla_lib}\" NEW_RPATH \"${DBXML_INSTALL_RPATH}\")")
+ endforeach()
+endif ()
# When installed into $PREFIX/server/bin, it will auto find libraries under $PREFIX/lib and $PREFIX/server/lib
if(MG_CPU EQUAL 64)
set_target_properties(mgserver PROPERTIES INSTALL_RPATH "$ORIGIN/../lib64:$ORIGIN/../../lib64")
Modified: branches/4.0/MgDev/Server/src/Core/mapguidectl
===================================================================
--- branches/4.0/MgDev/Server/src/Core/mapguidectl 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/Server/src/Core/mapguidectl 2026-11-08 07:04:01 UTC (rev 10277)
@@ -3,9 +3,24 @@
# description: MapGuide Server Daemon
# MapGuide init script
-. /lib/lsb/init-functions
-
-# Defined here for distributions that don't define log_end_msg
+# The LSB helpers are Debian/Ubuntu only; the RHEL family, Arch and openSUSE do not ship them, so
+# source them if present and define the messages they provide otherwise.
+for init_functions in /lib/lsb/init-functions /usr/lib/lsb/init-functions; do
+ if [ -r "${init_functions}" ]; then
+ . "${init_functions}"
+ break
+ fi
+done
+
+# Defined here for distributions that don't define the LSB log helpers
+type log_success_msg > /dev/null 2>&1 || log_success_msg () {
+ echo " ... done"
+ return 0
+}
+type log_failure_msg > /dev/null 2>&1 || log_failure_msg () {
+ echo " ... failed"
+ return 0
+}
type log_end_msg > /dev/null 2>&1 || log_end_msg () {
retval=$1
if [ $retval -eq 0 ]; then
@@ -19,9 +34,18 @@
progname="mgserver"
fullprogname="mgserver daemon"
+find_pid()
+{
+ if command -v pgrep > /dev/null 2>&1; then
+ pgrep -f -u root "${fullprogname}"
+ else
+ ps -u root -o pid=,args= 2>/dev/null | grep "${fullprogname}" | grep -v grep | awk '{ print $1 }'
+ fi
+}
+
do_start () {
echo -n "Starting MapGuide Server..."
- pid=$(pgrep -f -u root "${fullprogname}")
+ pid=$(find_pid)
ret=0
if [ -z "$pid" ]
then
@@ -36,7 +60,7 @@
do_stop () {
echo -n "Stopping MapGuide Server"
- pid=$(pgrep -f -u root "${fullprogname}")
+ pid=$(find_pid)
ret=0
if [ -z "$pid" ]
then
@@ -64,7 +88,7 @@
do_stop
;;
status)
- pid=$(pgrep -f -u root "${fullprogname}")
+ pid=$(find_pid)
[ -z "$pid" ] && echo "$progname is stopped" && RETVAL=3 && exit $RETVAL
echo "$progname (pid $pid) is running..."
;;
Modified: branches/4.0/MgDev/cmake/configs/mgserver.sh.in
===================================================================
--- branches/4.0/MgDev/cmake/configs/mgserver.sh.in 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/cmake/configs/mgserver.sh.in 2026-11-08 07:04:01 UTC (rev 10277)
@@ -3,6 +3,17 @@
export PATH=@MG_INSTALL_PREFIX@/server/bin:$PATH
export LD_LIBRARY_PATH=@FDO_LIBRARY_DIR@:@MG_INSTALL_PREFIX@/lib64:@MG_INSTALL_PREFIX@/server/lib64:"$LD_LIBRARY_PATH"
export NLSPATH=@FDO_NLS_DIR@/%N:"$NLSPATH"
+# Xerces-C needs a UTF-8 locale ("Could not load a transcoding service" otherwise), which a bare
+# environment does not provide. Pick one this system has.
+if [ "$(locale charmap 2>/dev/null)" != "UTF-8" ]; then
+ for mg_utf8 in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8; do
+ if LC_ALL="$mg_utf8" locale charmap 2>/dev/null | grep -qx "UTF-8"; then
+ export LANG="$mg_utf8"
+ export LC_ALL="$mg_utf8"
+ break
+ fi
+ done
+fi
mkdir -p /var/lock/mgserver
pushd @MG_INSTALL_PREFIX@/server/bin
./mgserver run
Modified: branches/4.0/MgDev/cmake/configs/mgserverd.sh.in
===================================================================
--- branches/4.0/MgDev/cmake/configs/mgserverd.sh.in 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/cmake/configs/mgserverd.sh.in 2026-11-08 07:04:01 UTC (rev 10277)
@@ -3,6 +3,17 @@
export PATH=@MG_INSTALL_PREFIX@/server/bin:$PATH
export LD_LIBRARY_PATH=@FDO_LIBRARY_DIR@:@MG_INSTALL_PREFIX@/lib64:@MG_INSTALL_PREFIX@/server/lib64:"$LD_LIBRARY_PATH"
export NLSPATH=@FDO_NLS_DIR@/%N:"$NLSPATH"
+# Xerces-C needs a UTF-8 locale ("Could not load a transcoding service" otherwise), which a bare
+# environment does not provide. Pick one this system has.
+if [ "$(locale charmap 2>/dev/null)" != "UTF-8" ]; then
+ for mg_utf8 in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8; do
+ if LC_ALL="$mg_utf8" locale charmap 2>/dev/null | grep -qx "UTF-8"; then
+ export LANG="$mg_utf8"
+ export LC_ALL="$mg_utf8"
+ break
+ fi
+ done
+fi
mkdir -p /var/lock/mgserver
pushd @MG_INSTALL_PREFIX@/server/bin
./mgserver daemon
Modified: branches/4.0/MgDev/cmake_linuxapt.sh
===================================================================
--- branches/4.0/MgDev/cmake_linuxapt.sh 2026-11-06 22:20:29 UTC (rev 10276)
+++ branches/4.0/MgDev/cmake_linuxapt.sh 2026-11-08 07:04:01 UTC (rev 10277)
@@ -218,6 +218,13 @@
echo "PHP is configured without thread safety; rebuilding with --enable-zts"
PHP_NEEDS_BUILD=1
fi
+ # libtool records an rpath for every -L path it links against, and this build links the
+ # internal OpenSSL/gd/jpeg from /usr/local. That path is build-host state and must not be
+ # baked into a package that has to run on another distribution.
+ if ! grep -q -- "--disable-rpath" "${PHP_WORKDIR}/config.nice"; then
+ echo "PHP is configured to embed build-host rpaths; rebuilding with --disable-rpath"
+ PHP_NEEDS_BUILD=1
+ fi
fi
if [ -z "$PHP_APXS_OPT" ] && test $PHP_NEEDS_BUILD -eq 1; then
echo "No apxs at ${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs: building PHP without the Apache module"
@@ -236,7 +243,7 @@
fi
echo "Configuring PHP"
cd "${PHP_WORKDIR}" || exit
- ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" $PHP_APXS_OPT $PHP_ZTS_OPT --with-openssl $PHP_MBSTRING_OPT --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
+ ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" $PHP_APXS_OPT $PHP_ZTS_OPT --disable-rpath --with-openssl $PHP_MBSTRING_OPT --enable-gd --with-jpeg --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
check_build
echo "Building PHP. Please wait"
make 2>&1 | tee "$LINUXAPT_WORK_DIR/make_php.log"
@@ -297,6 +304,17 @@
cat >> "${MG_INSTALL_WEB_PREFIX}/apache2/bin/envvars" <<END-OF-ENVVARS
export LD_LIBRARY_PATH=${MG_INSTALL_WEB_PREFIX}/${LIBNAME}:${MG_INSTALL_WEB_PREFIX}/php/lib:${MG_INST_PREFIX}/${LIBNAME}
export MENTOR_DICTIONARY_PATH=${MG_INST_PREFIX}/share/gis/coordsys
+# Xerces-C and Apache's APR transcoder need a UTF-8 locale ("Could not load a transcoding
+# service" otherwise), which a bare environment does not provide. Pick one this system has.
+if [ "\$(locale charmap 2>/dev/null)" != "UTF-8" ]; then
+ for mg_utf8 in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8; do
+ if LC_ALL="\$mg_utf8" locale charmap 2>/dev/null | grep -qx "UTF-8"; then
+ export LANG="\$mg_utf8"
+ export LC_ALL="\$mg_utf8"
+ break
+ fi
+ done
+fi
END-OF-ENVVARS
build_php
More information about the mapguide-commits
mailing list