Package: src:manif
Version: 0.0.5-2
Severity: important
Tags: patch

Dear maintainer:

During a rebuild of all packages in unstable, I noticed that your package
fails to build easily due to lack of memory in the building machine.

A typical failure looks like this:

--------------------------------------------------------------------------------
[...]
/<<PKGBUILDDIR>>/test/bundle/../common_tester.h: In instantiation of ‘void 
manif::CommonTester<_LieGroup>::evalAvgBiInvariant() [with _LieGroup = manif::Bundle<double, 
manif::SE2, manif::R7, manif::SO3, manif::R2, manif::R2>]’:
/<<PKGBUILDDIR>>/test/bundle/gtest_bundle_large.cpp:13:1:   required from here
   85 |   { evalAvgBiInvariant(); }                                             
  \
      |     ~~~~~~~~~~~~~~~~~~^~
/<<PKGBUILDDIR>>/test/bundle/../common_tester.h:510:26: warning: ‘void std::random_shuffle(_RAIter, _RAIter) [with 
_RAIter = __gnu_cxx::__normal_iterator<manif::Bundle<double, manif::SE2, manif::R7, manif::SO3, manif::R2, 
manif::R2>*, vector<manif::Bundle<double, manif::SE2, manif::R7, manif::SO3, manif::R2, manif::R2>, 
Eigen::aligned_allocator<manif::Bundle<double, manif::SE2, manif::R7, manif::SO3, manif::R2, manif::R2> > > 
>]’ is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
  510 |       std::random_shuffle( mans.begin(), mans.end() );
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4491:5: note: declared here
 4491 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator 
__last)
      |     ^~~~~~~~~~~~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[4]: *** [test/rn/CMakeFiles/gtest_rn.dir/build.make:79: 
test/rn/CMakeFiles/gtest_rn.dir/gtest_rn.cpp.o] Error 1
make[4]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[3]: *** [CMakeFiles/Makefile2:320: test/rn/CMakeFiles/gtest_rn.dir/all] 
Error 2
make[3]: *** Waiting for unfinished jobs....
[ 63%] Linking CXX executable gtest_bundle_large
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/test/bundle && /usr/bin/cmake -E 
cmake_link_script CMakeFiles/gtest_bundle_large.dir/link.txt --verbose=1
/usr/bin/c++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security 
-fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now 
CMakeFiles/gtest_bundle_large.dir/gtest_bundle_large.cpp.o -o gtest_bundle_large  
/usr/lib/x86_64-linux-gnu/libgtest.a
make[4]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 63%] Built target gtest_bundle_large
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[2]: *** [Makefile:149: all] Error 2
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
dh_auto_build: error: cd obj-x86_64-linux-gnu && make -j2 "INSTALL=install 
--strip-program=true" VERBOSE=1 returned exit code 2
make[1]: *** [debian/rules:27: override_dh_auto_build] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:14: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------

The problem here is that even if the machines in the buildd network have
enough memory, the package is also built in reproducible-builds,
and also by people doing archive rebuilds like Lucas Nussbaum or myself.

In this particular case, the problem arises because the ratio

memory-spent / available-cpus

is too high (more than all the other 36000 source packages in trixie).


Possible ways to deal with this:

The llvm-toolchain-17 package (which had a similar problem) does something
like this:

NJOBS := $(shell mt=`awk '/^(MemAvail|SwapFree)/ { mt += $$2 } END {print mt}' 
/proc/meminfo`; \
                awk -vn=$(NCPUS) -vmt=$$mt -vm=$(MEM_PER_CPU) \
                  'END { mt/=1024; n2 = int(mt/m); print n==1 || n2<=1 ? 1 : n2<=n 
? n2 : n }' < /dev/null)

In this case, MEM_PER_CPU should be around 10 GB, so that a machine with 2 CPUs 
and 16 GB of RAM
would still use 1 CPU and the build would still succeed.

However, this is probably overkill for manif, because the build just takes
about 20 minutes, so I propose that we simply disable parallel build, as in
the attached patch (warning: untested).

Thanks.
--- a/debian/rules
+++ b/debian/rules
@@ -11,7 +11,7 @@ export SETUPTOOLS_SCM_PRETEND_VERSION = 
$(DEB_VERSION_UPSTREAM)
 export PYBUILD_AFTER_INSTALL = rm -r {destdir}{install_dir}/manifpy/include 
{destdir}{install_dir}/manifpy/share
 
 %:
-       dh $@
+       dh $@ --no-parallel
 
 override_dh_auto_configure:
        dh_auto_configure --buildsystem=pybuild

Reply via email to