Error Launching Executables from Desktop or Caja - Mint 19

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
very

Error Launching Executables from Desktop or Caja - Mint 19

Post by very »

This is a matter of convince for me, but I would still like to get this resolved at some point. All executables are showing up as "Shared Library". I did research into this and it appears to be because they are compiled as Position-Independent Executables (PIE) and they are not read properly because of this.

For some distributions, this doesn't seem to be a new problem, but I have not found a solution yet. When I double click on an executable from either the Desktop or from Caja, i get this message:

Could not display "/path/to/executable".

There is no application installed for shared library files.
Do you want to search for an application to open this file?
No Yes

If you click yes, it can't find anything. Maybe someone knows of a solution to this, but it isn't me :D

Any and all help appreciated
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by all41 »

When I double click on an executable from either the Desktop or from Caja
Please provide an example 'executable'
Everything in life was difficult before it became easy.
very

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by very »

for example,

Code: Select all

$ which vlc
/usr/bin/vlc
when you double click on that file in caja, it won't execute giving the mentioned error message.

Because it is compiled as a PIE executable, it isn't properly showing up as an ELF executable, but as a shared library.

Code: Select all

$ hexdump -C -v /usr/bin/vlc | head -n 2
00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  03 00 3e 00 01 00 00 00  e0 15 00 00 00 00 00 00  |..>.............|
The "0x03" byte at the 0x10 position means that it's type is dynamic

Code: Select all

$ readelf -h /usr/bin/vlc | grep 'Type:'
  Type:                              DYN (Shared object file)
Most executable ELF's are like this. One important note: running the ELF from a terminal works just fine.

Code: Select all

$ /usr/bin/vlc
VLC media player 3.0.3 Vetinari
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by all41 »

Maybe someone knows of a solution to this, but it isn't me :D
I'll double down on this--it's not me either. :?
The discussions on this subject are well beyond the ozone layer technically,
even speaking in tongues--unless you are a programmer. :shock:
Everything in life was difficult before it became easy.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by smurphos »

A bit of googling suggest this is related to a change in default gcc compile actions - affecting a lot of file managers.

See -

https://stackoverflow.com/questions/453 ... y-clicking
https://www.raspberrypi.org/forums/view ... p?t=204543
https://github.com/nwjs/nw.js/issues/5287

Same thing affects Cinnamon/Nemo - although a desktop launcher targeting /usr/bin/vlc works fine, launching by directly clicking /usr/bin/vlc in the file manager or a symlink to /usr/bin/vlc on the desktop does not.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
gm10

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by gm10 »

very wrote: Mon Aug 20, 2018 5:19 pm Maybe someone knows of a solution to this, but it isn't me :D
Never doubt, there's a solution for everything. Certainly on MATE. :D

Since I'll probably have to explain it again in the future, let me make this pretty:

Create Launcher
What you do is you go to the file you want to execute (or any file of that type), right click > Open With Other Application and then set up a custom command like this:
exe-launcher-short.png

GUI applications
That's all, you can now just double click any executable of that type to run.

Text-mode applications
While the above will also run text mode applications, you won't see their output. If you need that, you'll need to edit the launcher, which was created in in ~/.local/share/applications, Its name begins with userapp-sh-. You can edit it in a text editor. If you add the line Terminal=true to it you will now see output from text mode applications.

This solution will also briefly pop up a terminal when launching GUI applications but this cannot be helped. The only way around that is point the launcher to a script you'll have to create instead which detects the application type and launches the target binary accordingly. How to set that up exceeds the scope of this guide and should really not be necessary, anyway.

Persistent terminal
If you enabled the terminal for text-mode applications, note that it will close once the text-mode application exits. If you want the terminal window to stay open you'll have to add ;bash to the end of the Exec= line. You'll then get a normal bash shell prompt after the output of the binary so you can continue working with it.

Customization
I set Name=Executable Launcher. I also added Icon=application-x-executable. You can see the result in my screenshot, my pre-existing Executable Launcher is in the list of applications to pick from. Helps you identify it in the future.
Locked

Return to “MATE”