How to strip binary?

asked 2020-03-18 22:25:26 +0200

AndyWuest gravatar image

updated 2020-03-18 22:25:41 +0200

Hi,

when releasing the app to harbour you have to pass the rpm validator. When i run the rpm validator i always get a warning about the not stripped binary. How can i strip the binary in the build process? Could not find any information about that in the docs.

Thanks in advance, Cheers, Andreas

edit retag flag offensive close delete

Comments

See e.g. strip --helpor http://manpages.org/strip

olf ( 2020-03-18 22:30:04 +0200 )edit

Hi, yes i know that but when i run the build like this (as seen in documentation) :

mb2 --no-snapshot -t SailfishOS-3.2.1.20-armv7hl build

i get a rpm that contains the binary. Is it possible to tell the mb2 build to also strip the binary?

AndyWuest ( 2020-03-18 22:41:35 +0200 )edit
4

shouldn't it be strippe dby default? if no, strip in spec

coderus ( 2020-03-18 23:51:23 +0200 )edit

Look at the build process in the source. Normally it should strip in the 'make install' phase. Perhaps there is an option to switch from a "debug" to a "release" type build?

For example, if the build tool is cmake, you can use something like this in the CMakeFile:

set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")

or pass -DCMAKE_C_FLAGS_RELEASE="-s" or -DCMAKE_C_FLAGS="-s" to the call to make.

If not, you can in the %install section of an RPM spec file, use install(1) with the --strip option (e.g. install -s -p -D -m 755 foo.bin $RPM_BUILD_ROOT/%{_bindir}/foo) to place the binaries in the destdir and strip in the process. (Make sure you don't strip .so files though! ;) )

nephros ( 2020-03-20 09:46:19 +0200 )edit