DiscussionsIssue archiveOCCT:Configuration

Archived issue #0031614

Configuration, CMake - eliminate CLang -Wl,-s deprecated warning

Open CASCADEOCCT:Configurationclosed2 public notes

Search issues

Description

New warning on MacOS
ld: warning: option -s is obsolete and being ignored

Public activity

2 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Option -s has been marked as deprecated on macOS a long time ago and even not documented in "--help" output.
At the same time it still does work as expected, so that -s provides a cross-platform way for stripping symbols during build (on other platforms this option is not marked deprecated).

To eliminate the warning, we may update our CMake scripts to exclude -s during build and perform a dedicated step using a "strip" tool (CMAKE_STRIP).
The most reasonable place for this could be an installation step:
install(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_STRIP} --strip-unneeded \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/${target})")


Just removing symbols is suboptimal solution - macOS provides a way to separate debug symbols from .dylib into dedicated file .dSYM (similar to .pdb file for .dll on Windows), so that installation might perform an extra step of .dSYM generation which would allow making ReleaseWithDebugInfo builds - a preferred building configuration for any application (.pdb/.dSYM files could be just not distributed with application, but could be used to reconstruct crash information):
dsymutil libTKernel.dylib -o libTKernel.dSYM
strip -S libTKernel.dylib


Using "strip" tool as alternative to "-s" flag could be considered for macOS/iOS-only solution (just to avoid a warning) or for other platforms as well (Linux, Android).
For this, it would be desired analyzing the difference between approaches (e.g. on file size).

Note that there stipping might be done for unneeded symbols or/and on debug symbols (the latter should appear only for -g builds).
02Commenter 2
parents are closed

Related records