linuxdeployqt
linuxdeployqt copied to clipboard
Deploying fails when including libnsl.so
When I try to deploy an app, I get the following error:
ERROR: Error reading rpath with patchelf "libnsl.so" : "cannot find section .dynamic\n"
ERROR: Error reading rpath with patchelf "libnsl.so" : ""
I tested on both Fedora 25 as well as CentOS 7.3. I used the linuxdeployqt version from here: https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
Please post the output of
file libnsl.so
ldd libnsl.so
readelf -e libnsl.so
On Fedora, I get the following:
Output of file:
file /usr/lib64/libnsl.so
/usr/lib64/libnsl.so: symbolic link to `../../lib64/libnsl.so.1'
file /usr/lib64/libnsl.so.1
/usr/lib64/libnsl.so.1: symbolic link to `libnsl-2.17.so'
file /usr/lib64/libnsl-2.17.so
/usr/lib64/libnsl-2.17.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1b7e10930ab3c14a9c6f159119a9a77462ecbe80, for GNU/Linux 2.6.32, not stripped
Output of ldd:
ldd /usr/lib64/libnsl-2.17.so
linux-vdso.so.1 => (0x00007ffd07fac000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3eddef1000)
/lib64/ld-linux-x86-64.so.2 (0x000055874c3ba000)
Output of readelf:
readelf -e /usr/lib64/libnsl-2.17.so
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x40a0
Start of program headers: 64 (bytes into file)
Start of section headers: 111472 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 7
Size of section headers: 64 (bytes)
Number of section headers: 33
Section header string table index: 32
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .note.gnu.build-i NOTE 00000000000001c8 000001c8
0000000000000024 0000000000000000 A 0 0 4
[ 2] .note.ABI-tag NOTE 00000000000001ec 000001ec
0000000000000020 0000000000000000 A 0 0 4
[ 3] .gnu.hash GNU_HASH 0000000000000210 00000210
0000000000000678 0000000000000000 A 4 0 8
[ 4] .dynsym DYNSYM 0000000000000888 00000888
00000000000016e0 0000000000000018 A 5 2 8
[ 5] .dynstr STRTAB 0000000000001f68 00001f68
0000000000000c5f 0000000000000000 A 0 0 1
[ 6] .gnu.version VERSYM 0000000000002bc8 00002bc8
00000000000001e8 0000000000000002 A 4 0 2
[ 7] .gnu.version_d VERDEF 0000000000002db0 00002db0
000000000000005c 0000000000000000 A 5 3 8
[ 8] .gnu.version_r VERNEED 0000000000002e10 00002e10
0000000000000050 0000000000000000 A 5 1 8
[ 9] .rela.dyn RELA 0000000000002e60 00002e60
00000000000001c8 0000000000000018 A 4 0 8
[10] .rela.plt RELA 0000000000003028 00003028
00000000000009c0 0000000000000018 AI 4 12 8
[11] .init PROGBITS 00000000000039e8 000039e8
000000000000001a 0000000000000000 AX 0 0 4
[12] .plt PROGBITS 0000000000003a10 00003a10
0000000000000690 0000000000000010 AX 0 0 16
[13] .text PROGBITS 00000000000040a0 000040a0
000000000000cc54 0000000000000000 AX 0 0 16
[14] .fini PROGBITS 0000000000010cf4 00010cf4
0000000000000009 0000000000000000 AX 0 0 4
[15] .rodata PROGBITS 0000000000010d00 00010d00
0000000000001480 0000000000000000 A 0 0 32
[16] .eh_frame_hdr PROGBITS 0000000000012180 00012180
0000000000000554 0000000000000000 A 0 0 4
[17] .eh_frame PROGBITS 00000000000126d8 000126d8
0000000000002404 0000000000000000 A 0 0 8
[18] .hash HASH 0000000000014ae0 00014ae0
0000000000000b24 0000000000000004 A 4 0 8
[19] .init_array INIT_ARRAY 0000000000215d50 00015d50
0000000000000008 0000000000000000 WA 0 0 8
[20] .fini_array FINI_ARRAY 0000000000215d58 00015d58
0000000000000008 0000000000000000 WA 0 0 8
[21] .jcr PROGBITS 0000000000215d60 00015d60
0000000000000008 0000000000000000 WA 0 0 8
[22] .data.rel.ro PROGBITS 0000000000215d68 00015d68
0000000000000008 0000000000000000 WA 0 0 8
[23] .dynamic DYNAMIC 0000000000215d70 00015d70
0000000000000210 0000000000000010 WA 5 0 8
[24] .got PROGBITS 0000000000215f80 00015f80
0000000000000080 0000000000000008 WA 0 0 8
[25] .got.plt PROGBITS 0000000000216000 00016000
0000000000000358 0000000000000008 WA 0 0 8
[26] .bss NOBITS 0000000000216360 00016358
0000000000002758 0000000000000000 WA 0 0 32
[27] .comment PROGBITS 0000000000000000 00016358
000000000000002d 0000000000000001 MS 0 0 1
[28] .shstrtab STRTAB 0000000000000000 00016385
000000000000017a 0000000000000000 0 0 1
[29] .symtab SYMTAB 0000000000000000 00016500
0000000000002d90 0000000000000018 30 244 8
[30] .strtab STRTAB 0000000000000000 00019290
0000000000001f98 0000000000000000 0 0 1
[31] .gnu_debuglink PROGBITS 0000000000000000 0001b228
000000000000001c 0000000000000000 0 0 4
[32] .shstrtab STRTAB 0000000000000000 0001b244
0000000000000125 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000015604 0x0000000000015604 R E 200000
LOAD 0x0000000000015d50 0x0000000000215d50 0x0000000000215d50
0x0000000000000608 0x0000000000002d68 RW 200000
DYNAMIC 0x0000000000015d70 0x0000000000215d70 0x0000000000215d70
0x0000000000000210 0x0000000000000210 RW 8
NOTE 0x00000000000001c8 0x00000000000001c8 0x00000000000001c8
0x0000000000000044 0x0000000000000044 R 4
GNU_EH_FRAME 0x0000000000012180 0x0000000000012180 0x0000000000012180
0x0000000000000554 0x0000000000000554 R 4
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 10
GNU_RELRO 0x0000000000015d50 0x0000000000215d50 0x0000000000215d50
0x00000000000002b0 0x00000000000002b0 R 1
Section to Segment mapping:
Segment Sections...
00 .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .hash
01 .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .bss
02 .dynamic
03 .note.gnu.build-id .note.ABI-tag
04 .eh_frame_hdr
05
06 .init_array .fini_array .jcr .data.rel.ro .dynamic .got
BTW: I used to be able to use linuxdeployqt on Fedora before (however, this is several weeks/months back).
So it seems to have a .dynamic section after all.
What happens if you try to run patchelf --set-rpath ... manually on that library?
If that fails, it may be a bug that should be reported to https://github.com/NixOS/patchelf/issues
First of all, a minor correction: The above output I provided is from CentOS, not Fedora. Anyway...
I tried the following (this time really in Fedora):
cd ~
cp /usr/lib64/libnsl-2.24.so ~
patchelf --set-rpath "." libnsl-2.24.so
After the final line, when I run readelf as above, I get this:
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x3ff0
Start of program headers: 114688 (bytes into file)
Start of section headers: 110256 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 8
Size of section headers: 64 (bytes)
Number of section headers: 34
Section header string table index: 27
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] NOTE 00000000000001c8 000001c8
0000000000000024 0000000000000000 A 0 0 4
[ 2] nu.version NOTE 00000000000001ec 000001ec
0000000000000020 0000000000000000 A 0 0 4
[ 3] u.version_d GNU_HASH 0000000000000210 00000210
0000000000000678 0000000000000000 A 4 0 8
[ 4] a.dyn DYNSYM 0000000000000888 00000888
00000000000016f8 0000000000000018 A 33 2 8
[ 5] ela.plt VERSYM 0000000000002bf2 00002bf2
00000000000001ea 0000000000000002 A 4 0 2
[ 6] d VERDEF 0000000000002de0 00002de0
000000000000005c 0000000000000000 A 33 3 8
[ 7] rodata VERNEED 0000000000002e40 00002e40
0000000000000050 0000000000000000 A 33 1 8
[ 8] RELA 0000000000002e90 00002e90
00000000000001c8 0000000000000018 A 4 0 8
[ 9] y RELA 0000000000003058 00003058
0000000000000918 0000000000000018 AI 4 24 8
[10] i_array PROGBITS 0000000000003970 00003970
0000000000000017 0000000000000000 AX 0 0 4
[11] r PROGBITS 0000000000003990 00003990
0000000000000620 0000000000000010 AX 0 0 16
[12] PROGBITS 0000000000003fb0 00003fb0
0000000000000038 0000000000000000 AX 0 0 8
[13] PROGBITS 0000000000003ff0 00003ff0
000000000000d121 0000000000000000 AX 0 0 16
[14] d PROGBITS 0000000000011114 00011114
0000000000000009 0000000000000000 AX 0 0 4
[15] .symtab PROGBITS 0000000000011120 00011120
0000000000001520 0000000000000000 A 0 0 32
[16] PROGBITS 0000000000012640 00012640
000000000000055c 0000000000000000 A 0 0 4
[17] .dynstr PROGBITS 0000000000012ba0 00012ba0
00000000000024b4 0000000000000000 A 0 0 8
[18] rsion_d HASH 0000000000015058 00015058
0000000000000b24 0000000000000004 A 4 0 8
[19] bug_aranges INIT_ARRAY 0000000000215d50 00015d50
0000000000000008 0000000000000000 WA 0 0 8
[20] .comment FINI_ARRAY 0000000000215d58 00015d58
0000000000000008 0000000000000000 WA 0 0 8
[21] e_hdr PROGBITS 0000000000215d60 00015d60
0000000000000008 0000000000000000 WA 0 0 8
[22] .text PROGBITS 0000000000215d68 00015d68
0000000000000008 0000000000000000 WA 0 0 8
[23] t.plt PROGBITS 0000000000215f80 00015f80
0000000000000080 0000000000000008 WA 0 0 8
[24] ta.rel.ro PROGBITS 0000000000216000 00016000
0000000000000320 0000000000000008 WA 0 0 8
[25] NOBITS 0000000000216320 00016320
0000000000002718 0000000000000000 WA 0 0 32
[26] PROGBITS 0000000000000000 00016320
000000000000002c 0000000000000001 MS 0 0 1
[27] b STRTAB 0000000000000000 0001634c
000000000000017e 0000000000000000 0 0 1
[28] .strtab SYMTAB 0000000000000000 000164d0
0000000000002e20 0000000000000018 29 249 8
[29] .shstrtab STRTAB 0000000000000000 000192f0
0000000000001a74 0000000000000000 0 0 1
[30] .version_r PROGBITS 0000000000000000 0001ad64
000000000000001c 0000000000000000 0 0 4
[31] b STRTAB 0000000000000000 0001ad80
0000000000000129 0000000000000000 0 0 1
[32] u.build-id DYNAMIC 00000000002191c0 0001c1c0
0000000000000220 0000000000000010 WA 33 0 8
[33] it_array STRTAB 00000000002193e0 0001c3e0
0000000000000c73 0000000000000000 A 0 0 8
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000015b7c 0x0000000000015b7c R E 200000
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 10
NOTE 0x00000000000001c8 0x00000000000001c8 0x00000000000001c8
0x0000000000000044 0x0000000000000044 R 4
GNU_EH_FRAME 0x0000000000012640 0x0000000000012640 0x0000000000012640
0x000000000000055c 0x000000000000055c R 4
LOAD 0x0000000000015d50 0x0000000000215d50 0x0000000000215d50
0x00000000000005d0 0x0000000000002ce8 RW 200000
GNU_RELRO 0x0000000000015d50 0x0000000000215d50 0x0000000000215d50
0x00000000000002b0 0x00000000000002b0 R 1
LOAD 0x000000000001c000 0x0000000000219000 0x0000000000219000
0x0000000000001058 0x0000000000001058 RW 1000
DYNAMIC 0x000000000001c1c0 0x00000000002191c0 0x00000000002191c0
0x0000000000000220 0x0000000000000220 RW 8
readelf: Error: no .dynamic section in the dynamic segment
Section to Segment mapping:
Segment Sections...
00 nu.version u.version_d a.dyn ela.plt d rodata y i_array r d .symtab .dynstr rsion_d
01
02 nu.version
03
04 bug_aranges .comment e_hdr .text t.plt ta.rel.ro
05 bug_aranges .comment e_hdr .text t.plt
06 u.build-id it_array
07 u.build-id
So using patchelf on that library seems to cause the actual issues, right?
Looks like it. But I am not sure that
patchelf --set-rpath "." libnsl-2.24.so
is what you want to do. If you want it to make look for other libraries in the same directory as itself, then it would be
patchelf --set-rpath '$ORIGIN' libnsl-2.24.so
I actually tried with different paths (and also using $ORIGIN) does not change anything - calling readelf on the modified library will reliably print the no .dynamic section in the dynamic segment error. So I guess this should be reported in patchelf itself.
Will do so later this evening and report the issue URL here for reference.
@mhoeher have you found a workaround for this issue by any chance? I'm getting the same error, and it seems like patchelf has not been fixed yet.
@sierdzio my current WA is to not use CentOS/Fedora, but instead Ubuntu. You can check out this Dockerfile which I use to create the build environment for one of my apps. With that, deployment works fine.
@mhoeher thanks. On Ubuntu indeed everything works, I have a working environment there already. However, RPM and AppImage created on Ubuntu don't work on CentOS (c/c++ runtime is too old there), hence my question.
I've just found out a way around it, in case anybody else is hit by this issue: I build on CentOS without -appimage, which means linuxdeployqt does not try to deploy libnsl. The package after this still runs fine (in my case at least) on CentOS, Fedora, Ubuntu and Debian.
@sierdzio Thanks for sharing your results. Regarding issues with running on CentOS: I also build my app on Ubuntu and run it on various other systems including both CentOS 7 and Fedora. Do you target CentOS 6 or earlier?
The only issue I experience so far is, that linuxdeployqt does not include libpng12.so so you have to install this dependency on the target system.
The only issue I experience so far is, that
linuxdeployqtdoes not includelibpng12.soso you have to install this dependency on the target system.
Please open an issue on this, including exact instructions on how to reproduce and ideally a log tile with maximum verbosity switched on. Thanks!
@probonopd sure, it's on my todo list already ;-)
I've this problem on Centos 7.4. The workaround for me is to exclude the lib: -exclude-libs=libnsl.so It works, seems that the lib is present on all systems I'm currently running...
@riviera-kid is it an option for you to build your AppImages on a non-RH/CentOS/Fedora-type system, e.g., Ubuntu? If you build them on an old enough build system, they should still be able to run on RH/CentOS/Fedora-type systems, too.
Yes, I'm currently using only Centos 7.4 and 7.6, so no problem :)
Isn't there solution yet? I'm using Fedora 30, I've installed libnsl library but still getting error when i try to run AppImage.
@Hryggjarsula which AppImage are you getting this problem with? What system was the AppImage built on and which system do you see the problem on when running the app? Both Fedora 30?
Sorry i wrote the comment under wrong repo. I'm trying to install MLV App https://github.com/ilia3101/MLV-App via AppImage but i'm getting missing libnsl.so.1 error. I've installed it but still same. So i didn't try anything with linuxdeployqt.
MLV-App works for me. Which distribution and version are you using? Please open an issue at https://github.com/ilia3101/MLV-App/issues, thanks.