Don't pre-strip binaries

Currently the binaries are stripped during linking through some settings in adm/cmake/occt_defs_flags.cmake. This can lead to issues on distributions, where the package manager applications is supposed to strip binaries[1] or extract debugging information for later usage in case of debug builds.

Would it be possible to add a cmake option, so at configuration time it could be decided whether the binaries are being stripped during linking stage or not?

[1] https://bugs.gentoo.org/831800

Kirill Gavrilov's picture

Fill free to propose patches improving CMake logic upon stripping symbols. There is a room for possible improvements here, like separate debug symbols from main libraries or postpone stripping to a later building / installing stage. But unfortunately, this is not just putting a flag to CMake - it requires some platform-specific adaptations.

If non-stripping of Release builds is the only thing you are looking for, then you may consider handling of BUILD_FORCE_RelWithDebInfo flag (currently implemented only for Windows - it asks to generate PDB debug files for Release build) to remove stripping from GCC/CLang arguments.

Bernd Waibel's picture

Thanks for your reply. Unfortunately just postponing this to a later stage wouldn't fulfill our needs, as the stripping will still be done by cmake which is discouraged on Gentoo systems. I don't know how other package managers, like e.g. rpm, or different OSes handle the stripping of binaries, so improving the handling of stripping symbols requires some research to find a way which can be used by all supported platforms. For now, we patched out the commands for stripping down the binaries to avoid this warning.

We're using RelWithDebInfo as the default CMAKE_BUILD_TYPE, so passing BUILD_FORCE_RelWithDebInfo is, apart from not being on Windows, not suitable for us.