0

After compiling software from source code, I can usually launch the compiled binary by double-clicking on it.

Recently however, most of my compiled binaries are not responding to double-click, even if they can be launched using ./MyBinary. This doesn't seem to be a permission problem because I have already done sudo chmod +x.

It appears that my Linux system identifies compiled binaries as shared library files, and so doesn't execute them.

enter image description here

Does anyone know why this happens? Is it possible to change the file type to an executable to avoid this problem? Thanks in advance.

System Info

Manjaro Linux x86_64

Kernel release: 5.6.19-2

5
  • It's an issue with your File Manager/Desktop Environment whatever it is. Maybe try using another one which doesn't have this issue. – Artem S. Tashkinov Aug 16 '20 at 18:38
  • Are these positions-independent ELFs? Check what file <BINARY> says. – Arkadiusz Drabczyk Aug 16 '20 at 18:45
  • For instance Thunar here on my PC refuses to run Bash scripts with proper permissions (0755) - it instead opens them in the default text editor. Looks like a serious bug to me but I don't use Thunar at all, so I don't care much. – Artem S. Tashkinov Aug 16 '20 at 18:48
  • @Artem S.Tashkinov Using KDE dolphin does partially solve the issue (I can double click to launch) but it's still considered a shared library – JS4137 Aug 16 '20 at 18:53
  • The output of the file command is ELF 64-bit LSB pie executable, x86-64 – JS4137 Aug 16 '20 at 18:55
0

ELF portable executables and libraries may have the same signatures and be identified identically. I wouldn't fret about that. If Dolphin works for you, use it.

E.g.

$ file `which file` /usr/lib64/libc-2.31.so
/bin/file:               ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e7df66a91efb28e483449a77221cb4242620541c, for GNU/Linux 3.2.0, stripped
/usr/lib64/libc-2.31.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=d278249792061c6b74d1693ca59513be1def13f2, for GNU/Linux 3.2.0, not stripped

Both the binary and the glibc library are "ELF 64-bit LSB shared object".

2
  • ELF portable executables - you mean position independent. As OP said in comments, this ELF is position independent so the e_type header member is set to ET_DYN. You seem to have an old version of file, new releases can correctly identify PIE executable: ./main: ELF 32-bit LSB pie executable, as OP said as well. – Arkadiusz Drabczyk Aug 16 '20 at 19:13
  • I use file from Fedora 32 which is quite recent: file-5.38-2.fc32.x86_64 however you're right: version 5.39 was released in January however Fedora hasn't yet mainlined it. – Artem S. Tashkinov Aug 16 '20 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.