probonopd / linuxdeployqt

Makes Linux applications self-contained by copying in the libraries and plugins that the application uses, and optionally generates an AppImage. Can be used for Qt and other applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails on Arch Linux with ERROR: Error stripping "libzstd.so" : "" (segfault)

cebtenzzre opened this issue · comments

Here is the end of the output from a failing run of linuxdeployqt:

Log:  copied: "/usr/lib/libzstd.so.1"
Log:  to "/home/jared/src/forks/gpt4all/gpt4all-chat/build/_CPack_Packages/Linux/IFW/gpt4all-installer-linux/packages/gpt4all/data/lib///libzstd.so.1"
Log: dpkg not found, hence not deploying copyright files
ERROR: Error stripping "libzstd.so" : ""
ERROR: Error stripping "libzstd.so" : ""

Information

OS: Arch Linux

$ ldd /usr/bin/strip
	linux-vdso.so.1 (0x00007fff997d2000)
	libbfd-2.42.0.so => /usr/lib/libbfd-2.42.0.so (0x00007fb59a6b9000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007fb59a4d5000)
	libz.so.1 => /usr/lib/libz.so.1 (0x00007fb59a4bc000)
	libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007fb59a3e9000)
	libsframe.so.1 => /usr/lib/libsframe.so.1 (0x00007fb59a3e1000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fb59a883000)

This is the LD_LIBRARY_PATH set when calling strip, found by replacing /usr/bin/strip with a shell wrapper that dumps the environment:

LD_LIBRARY_PATH=/home/jared/src/forks/gpt4all/gpt4all-chat/build/_CPack_Packages/Linux/IFW/gpt4all-installer-linux/packages/gpt4all/data/bin/../lib/:/usr/lib:/home/jared/src/forks/gpt4all/gpt4all-chat/build/_CPack_Packages/Linux/IFW/gpt4all-installer-linux/packages/gpt4all/data/bin:/usr/../lib

Analysis

strip can normally strip libzstd.so just fine, but because it links to libzstd.so and linuxdeploy sets LD_LIBRARY_PATH to include the local data/lib dir, strip tries to strip one of its own loaded shared libs and segfaults:

[26051.534584] strip[50517]: segfault at c100 ip 000000000000c100 sp 00007ffe633370b8 error 14 in strip[555bdf651000+3000] likely on CPU 21 (core 11, socket 0)
[26051.534593] Code: Unable to access opcode bytes at 0xc0d6.

Suggestion

strip does not crash when LD_LIBRARY_PATH is not set. Maybe LD_LIBRARY_PATH should only be set when calling ldd.

That's interesting you got strip to work on archlinux, here on artix I couldn't get it to work on aynthing and that is normal I think, it is meant to be used on debian stable, there my same scripts have no issue when doing the strip.

What I do is that I set NO_STRIP=true environment variable when testing on artix.

Please provide details about your build environment (distribution, version, compiler, libc, etc.). Thanks!
Does https://github.com/probonopd/go-appimage/tree/master/src/appimagetool work better for you?