#1148873 gtsam: Remove obsolete workarounds for mips and for libatomic linking

#1148873#5
Date:
2026-09-24 13:53:32 UTC
From:
To:
The patch below removes workarounds for:
- mips (no longer built anywhere)
- libatomic linking (done automatically by GCC 16)

(With the +test packages in experimental I tried more ambitious changes,
 not all of them worked as expected.)


diff -Nru gtsam-4.2.2+dfsg/debian/patches/fix-got-overflow-in-mips64el.patch gtsam-4.2.2+dfsg/debian/patches/fix-got-overflow-in-mips64el.patch
--- gtsam-4.2.2+dfsg/debian/patches/fix-got-overflow-in-mips64el.patch	2026-09-22 19:03:30.000000000 +0300
+++ gtsam-4.2.2+dfsg/debian/patches/fix-got-overflow-in-mips64el.patch	1970-01-01 02:00:00.000000000 +0200
@@ -1,35 +0,0 @@
-Description: Fix got overflow in mips64el
-Index: gtsam/wrap/cmake/PybindWrap.cmake
-===================================================================
---- gtsam.orig/wrap/cmake/PybindWrap.cmake
-+++ gtsam/wrap/cmake/PybindWrap.cmake
-@@ -112,6 +112,29 @@ function(
-   # https://lists.debian.org/debian-devel/2023/08/msg00156.html
-   target_compile_options(${target} PRIVATE -O0 -g0)
-
-+  # On mipsel I see linker errors when linking the Python bindings:
-+  #
-+  #   /usr/bin/c++ ... -o gtsam/gtsam.cpython-311-mips64el-linux-gnuabi64.so ...
-+  #
-+  #   CMakeFiles/gtsam_py.dir/gtsam.cpp.o: in function `PyObject_TypeCheck':
-+  #   gtsam.cpp:(.text+0x13c): relocation truncated to fit: R_MIPS_CALL16 against `PyType_IsSubtype'
-+  #   CMakeFiles/gtsam_py.dir/gtsam.cpp.o: in function `Py_DECREF':
-+  #   gtsam.cpp:(.text+0x210): relocation truncated to fit: R_MIPS_CALL16 against `_Py_Dealloc'
-+  #   CMakeFiles/gtsam_py.dir/gtsam.cpp.o: in function `gtsam::utilities::createKeyList(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)':
-+  #   gtsam.cpp:(.text+0x558): relocation truncated to fit: R_MIPS_GOT_DISP against `__stack_chk_guard@@GLIBC_2.4'
-+  #   gtsam.cpp:(.text+0x664): relocation truncated to fit: R_MIPS_GOT_DISP against `__stack_chk_guard@@GLIBC_2.4'
-+  #   gtsam.cpp:(.text+0x678): relocation truncated to fit: R_MIPS_CALL16 against `__stack_chk_fail@@GLIBC_2.4'
-+  #   gtsam.cpp:(.text+0x688): relocation truncated to fit: R_MIPS_CALL16 against `_Unwind_Resume@@GCC_3.0'
-+  #   ....
-+  #
-+  # A similar issue has been found and worked-around in a different Debian
-+  # package. I do something similar here:
-+  #
-+  #   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=827651
-+  if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "mips64")
-+     target_compile_options(${target} PRIVATE -mxgot)
-+  endif()
-+
-   if(APPLE)
-     # `type_info` objects will become "weak private external" if the templated
-     # class is initialized implicitly even if we explicitly export them with
diff -Nru gtsam-4.2.2+dfsg/debian/patches/series gtsam-4.2.2+dfsg/debian/patches/series
--- gtsam-4.2.2+dfsg/debian/patches/series	2026-09-22 19:03:30.000000000 +0300
+++ gtsam-4.2.2+dfsg/debian/patches/series	2026-09-22 19:03:30.000000000 +0300
@@ -16,7 +16,6 @@
 0002-Update-HessianFactor.cpp.patch
 0003-Update-HessianFactor.cpp.patch
 temporarily-disabled-test-for-built-on-32bit-arches.patch
-fix-got-overflow-in-mips64el.patch
 0001-Relax-unit-test-thresholds-to-fix-32bit-issues.patch
 include-bitset-for-compatibility-with-boost-1.83.patch
 cmake-3.5.patch
diff -Nru gtsam-4.2.2+dfsg/debian/rules gtsam-4.2.2+dfsg/debian/rules
--- gtsam-4.2.2+dfsg/debian/rules	2026-09-22 19:03:30.000000000 +0300
+++ gtsam-4.2.2+dfsg/debian/rules	2026-09-22 19:03:30.000000000 +0300
@@ -28,19 +28,6 @@
 # note: parameter passing for argument of type 'std::_Rb_tree_const_iterator<long long unsigned int>' changed in GCC 7.1
 export DEB_CXXFLAGS_MAINT_APPEND += -Wno-psabi

-# On some arches ld says:
-#   /usr/bin/ld: CMakeFiles/SolverComparer.dir/SolverComparer.cpp.o: undefined reference to symbol '__atomic_load_8@@LIBATOMIC_1.0'
-ifneq (,$(filter $(DEB_HOST_ARCH), armel powerpc sh4))
-export DEB_LDFLAGS_MAINT_APPEND += -latomic
-endif
-
-# On some arches there's simply too much debugging info. I turn it off. The
-# build log says:
-#   /usr/bin/ld: error: libgtsam.so.4.2.0(.debug_info) is too large (0x10e67cac bytes)
-ifneq (,$(filter $(DEB_HOST_ARCH), mipsel))
-export DEB_CXXFLAGS_MAINT_APPEND += -g0
-endif
-


 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))