GCC compiles programs to shared object instead of executable, preventing GUI file managers from executing programs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults |
Unknown
|
Medium
|
|||
shared-mime-info |
Unknown
|
Medium
|
|||
shared-mime-info (Ubuntu) |
Triaged
|
High
|
Unassigned | ||
Bug Description
Release of Ubuntu being used
=======
Description: Ubuntu 16.10
Release: 16.10
Version of the package being used
=======
gcc:
Installed: 4:6.1.1-1ubuntu2
Candidate: 4:6.1.1-1ubuntu2
Version table:
*** 4:6.1.1-1ubuntu2 500
500 http://
100 /var/lib/
What was expected
=================
Programs compiled using `gcc -o program program.c` should be runnable by double-clicking them from a GUI file manager.
Compiling a simple program (`void main() { }`) using Xubuntu 16.04's current version of `gcc` (`gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~
program: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/
This is correct behavior, allowing the executables to run from Nautilus and Thunar.
What happened instead
=======
Programs compiled using `gcc -o program program.c` are not runnable by double-clicking them from a GUI file manager, even though they are runnable from the terminal.
Compiling a simple program (`void main() { }`) using the current version of `gcc` (`6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)`) produces the following output from `/usr/bin/file program`:
program: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/
The program is also identified as a "shared library" instead of an "executable" in Thunar, causing it to not be runnable from the GUI. Others are unable to run such programs from Nautilus.
Changed in gcc-defaults: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in gcc-defaults: | |
status: | Confirmed → Unknown |
affects: | gcc-defaults (Ubuntu) → shared-mime-info (Ubuntu) |
Changed in shared-mime-info: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in shared-mime-info: | |
status: | Confirmed → Unknown |
/usr/bin/ls: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ ld-linux- x86-64. so.2, for GNU/Linux 3.0.0, BuildID[ sha1]=339279bda c0d1a8c98b6bbb9 2afc8d8edb185d9 f, stripped
This file is detected as application/ x-sharedlib instead of application/ x-executable, by the s-m-i test suite, if I add it there.
Patch for the test suite: http:// www.davidfaure. fr/kde/ smi.diff www.davidfaure. fr/kde/ ls into tests/.
+ downloading http://
Result: x-executable, got application/ x-sharedlib x-executable, got application/ x-sharedlib
ls, 'data' test: expected application/
ls, 'file' test: expected application/
There must be a bug in the ELF magic for application/ x-sharedlib and/or application/ x-executable.