Source: simgear
Version: 1:2024.1.4+dfsg-1
Severity: minor
The debian/rules file specifies the following option to CMake:
-DCMAKE_BUILD_TYPE="RelWithDebInfo"
This causes CMake to use its "release with debug info" set of compiler
flags. However, the build flags normally used in Debian builds come from
dpkg-buildflags(1), and this responds to settings like "noopt" in the
DEB_BUILD_OPTIONS environment variable.
If I try to build the package that way (which I needed to do to debug a
segfault in the test suite), I see compile lines like
$ DEB_BUILD_OPTIONS=noopt dpkg-buildpackage -b
[...]
[ 0%] Building CXX object
simgear/CMakeFiles/SimGearCore.dir/debug/logstream.cxx.o
cd /tmp/simgear-2024.1.4+dfsg/build/simgear && /usr/bin/c++ -DHAVE_CONFIG_H
-I/tmp/simgear-2024.1.4+dfsg -I/tmp/simgear-2024.1.4+dfsg/build
-I/tmp/simgear-2024.1.4+dfsg/build/simgear -g -O0 -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer -ffile-prefix-map=/tmp/simgear-2024.1.4+dfsg=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection
-fdebug-prefix-map=/tmp/simgear-2024.1.4+dfsg=/usr/src/simgear-1:2024.1.4+dfsg-1xtradeb1.2510.1
-Wdate-time -D_FORTIFY_SOURCE=0 -msse2 -mfpmath=sse -ftree-vectorize
-ftree-slp-vectorize -Wall -fPIC -Wno-unused-local-typedefs
-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG
-DBOOST_NO_AUTO_PTR -DBOOST_NO_CXX98_BINDERS -O3 -g -DNDEBUG -std=gnu++17 -MD
-MT simgear/CMakeFiles/SimGearCore.dir/bucket/newbucket.cxx.o -MF
CMakeFiles/SimGearCore.dir/bucket/newbucket.cxx.o.d -o
CMakeFiles/SimGearCore.dir/bucket/newbucket.cxx.o -c
/tmp/simgear-2024.1.4+dfsg/simgear/bucket/newbucket.cxx
Notice how both -O0 (from dpkg-buildflags) and -O3 (from CMake) are
being passed to the compiler.
My suggested fix is to use
-DCMAKE_BUILD_TYPE="None"
which will cause CMake to use only the flags passed in through the
standard environment variables, and add none of its own.
P.S.: The same issue appears in flightgear 1:2024.1.4+dfsg-2.