Stripping a rust binary?
Hi all, I found hurl.dev recently and decided to try and package it.
https://build.opensuse.org/package/show/home:ojkastl_buildservice/hurl
I could get it to build, even though I had to disable the checks (for now). However, rpmlint complains that the binary is not stripped.
[ 217s] hurl.x86_64: W: unstripped-binary-or-object /usr/bin/hurl [ 217s] This executable should be stripped from debugging symbols, in order to take [ 217s] less space and be loaded faster. This is usually done automatically at [ 217s] buildtime by rpm.
As I have no clue from rust, and the Rust packaging documentation does not mention stripping, how would I do that properly for a SUSE/openSUSE package? Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Hi Johannes, with Cargo Version 1.58 you can strip the binary via cargo if you include this into the cargo config: [profile.release] strip = "symbols" However I am not sure if the warning can be omitted as the OBS strips binaries later on by itself? Best regards Jan-Luca
Hi Jan-Luca, On 21.04.22 at 07:45 opensuse@jlk.one wrote:
with Cargo Version 1.58 you can strip the binary via cargo if you include this into the cargo config:
[profile.release] strip = "symbols"
Thanks, that did the trick!
However I am not sure if the warning can be omitted as the OBS strips binaries later on by itself?
That is a question that others need to answer... Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Moin, Am Mittwoch, 20. April 2022, 21:52:05 CEST schrieb Johannes Kastl:
Hi all,
I found hurl.dev recently and decided to try and package it.
https://build.opensuse.org/package/show/home:ojkastl_buildservice/hurl
I could get it to build, even though I had to disable the checks (for now).
However, rpmlint complains that the binary is not stripped.
[ 217s] hurl.x86_64: W: unstripped-binary-or-object /usr/bin/hurl [ 217s] This executable should be stripped from debugging symbols, in order to take [ 217s] less space and be loaded faster. This is usually done automatically at [ 217s] buildtime by rpm.
As I have no clue from rust, and the Rust packaging documentation does not mention stripping, how would I do that properly for a SUSE/openSUSE package?
It looks like you debuginfo is disabled in the project: https://build.opensuse.org/repositories/home:ojkastl_buildservice/hurl That basically means it no longer passes "-g" to CFLAGS/CXXFLAGS, but it also skips stripping of binaries at the end of build. rust doesn't care about CFLAGS/CXXFLAGS and rpm-build/rust doesn't handle the debuginfo flag otherwise, so the binaries end up with debuginfo despite the debuginfo flag disabled and don't get stripped. If you just enable debuginfo in the project (usually the default), the binaries should be stripped again and the warnings disappear. Cheers, Fabian
Kind Regards, Johannes
-- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de
B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Hi Fabian, On 21.04.22 at 08:43 Fabian Vogt wrote:
Am Mittwoch, 20. April 2022, 21:52:05 CEST schrieb Johannes Kastl:
As I have no clue from rust, and the Rust packaging documentation does not mention stripping, how would I do that properly for a SUSE/openSUSE package?
It looks like you debuginfo is disabled in the project: https://build.opensuse.org/repositories/home:ojkastl_buildservice/hurl
That basically means it no longer passes "-g" to CFLAGS/CXXFLAGS, but it also skips stripping of binaries at the end of build. rust doesn't care about CFLAGS/CXXFLAGS and rpm-build/rust doesn't handle the debuginfo flag otherwise, so the binaries end up with debuginfo despite the debuginfo flag disabled and don't get stripped.
If you just enable debuginfo in the project (usually the default), the binaries should be stripped again and the warnings disappear.
Thanks for the information, I was not aware of the fact that disabling debuginfo on project level has influence on rpmlint warnings. Good to know. I just enabled debuginfo again on project level, no idea why I disabled it in the first place.... Kind regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
participants (3)
-
Fabian Vogt
-
Johannes Kastl
-
opensuse@jlk.one