Can't strip more than 256 symbols

I’m using this SFDK version 3.9.6 (Stable).

I’m compiling Whisperfish locally using this command (at the time of writing, please pull this commit instead of master):

sfdk -c target=SailfishOS-4.4.0.58-aarch64 build -- --with shareplugin_v2 --with lto

For convenience, I removed the path prefix /home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default from all outputs below.

I then see the following output:

/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: '/home/deploy/installroot/usr/bin/harbour-whisperfish,': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'too': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'many': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: 'notes': No such file
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: '(256)': No such file

After some searching, I found this bug report: find-debuginfo.sh fails on ELF with more than 256 notes. It has a link to a commit that fixes that: Fix stripping of binaries for changed file output. After installing vim and editing these three files to contain the changes in the commit, I now get these lines instead:

+ /[...]/usr/lib/rpm/meego/brp-strip /usr/bin/strip
/[...]/opt/cross/bin/aarch64-meego-linux-gnu-strip: warning: /home/deploy/installroot/usr/bin/harbour-whisperfish: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
(repeat the line above for hundreds of times)
+ /[...]/usr/lib/rpm/meego/brp-strip-static-archive /usr/bin/strip

As far as I know, the warning message is benign, and can be ignored here. Now the resulting binary is 5.1MB instead of 25MB, so the stripping process works.

For completeness; I edited these three files inside build-shell

/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip
/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip-comment-note
/home/matti/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-aarch64.default/usr/lib/rpm/meego/brp-strip-shared

making this change

-	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
+	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p'`; do

which fixed the issue. Athough this was triggered by a Rust application, it can happen to C/C++ applications, too.

Please include the commit or update rpm to newer version.

Thanks!

4 Likes

I think I’m missing something obvious here…

I made a patch from the commit above to fix the issue, but when I tried to apply it to the source, it claimed that it was already applied. The source points to RPM 4.16.1.3 which is the version installed in the SFDK build environment already… Why did I have to change the files manually then, if it’s supposed to be up-to-date already? Am I at the correct source repo even?

1 Like

Insidious. It took me a while too… check rpm -qf .../brp-strip :slight_smile: It comes from this repository https://github.com/sailfishos/meego-rpm-config.

1 Like

Pull request made!

Side note: the commit mentioned mentions yet another commit which does the same change for find_debuginfo.sh but I couldn’t find the file in the relevant repos nor in the sfdk build-shell.