Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu recognizes executable as shared library and won't run it by clicking

I am first experiencing this issue on my fresh installation of lubuntu 17.04. I have used to use Ubuntu before and I hadn't this issue before.

I compiled my qt application and I can execute it through command line by issuing with "./". However, I can't execute it by clicking on file manager (neither PCManFM, Nautilus...) Both recognizes it as shared library file type.

How can I run it by clicking directly on the file?

this is what happens when I double-click the executable through file manager: enter image description here

build-log:

11:20:05: Running steps for project APP_release...
11:20:05: Configuration unchanged, skipping qmake step.
11:20:05: Starting: "/usr/bin/make" 
/opt/Qt5.9.0/5.9/gcc_64/bin/uic ../APP_release/mainwindow.ui -o ui_mainwindow.h
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../APP_release -I. -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -o main.o ../APP_release/main.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../APP_release -I. -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -o mainwindow.o ../APP_release/mainwindow.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../APP_release -I. -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -o foldercompressor.o ../APP_release/foldercompressor.cpp
g++ -pipe -O2 -Wall -W -dM -E -o moc_predefs.h /opt/Qt5.9.0/5.9/gcc_64/mkspecs/features/data/dummy.cpp
/opt/Qt5.9.0/5.9/gcc_64/bin/moc -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include ./moc_predefs.h -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -I/home/spectrum/trunk/APP_release/APP_release -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -I/usr/include/c++/6 -I/usr/include/x86_64-linux-gnu/c++/6 -I/usr/include/c++/6/backward -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../APP_release/mainwindow.h -o moc_mainwindow.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../APP_release -I. -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -o moc_mainwindow.o moc_mainwindow.cpp
/opt/Qt5.9.0/5.9/gcc_64/bin/moc -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include ./moc_predefs.h -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -I/home/spectrum/trunk/APP_release/APP_release -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -I/usr/include/c++/6 -I/usr/include/x86_64-linux-gnu/c++/6 -I/usr/include/c++/6/backward -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../APP_release/foldercompressor.h -o moc_foldercompressor.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../APP_release -I. -I/opt/Qt5.9.0/5.9/gcc_64/include -I/opt/Qt5.9.0/5.9/gcc_64/include/QtWidgets -I/opt/Qt5.9.0/5.9/gcc_64/include/QtGui -I/opt/Qt5.9.0/5.9/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/opt/Qt5.9.0/5.9/gcc_64/mkspecs/linux-g++ -o moc_foldercompressor.o moc_foldercompressor.cpp
g++ -Wl,-O1 -Wl,-rpath,/opt/Qt5.9.0/5.9/gcc_64/lib -o APP_release main.o mainwindow.o foldercompressor.o moc_mainwindow.o moc_foldercompressor.o   -L/opt/Qt5.9.0/5.9/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
11:20:10: The process "/usr/bin/make" exited normally.
11:20:10: Elapsed time: 00:05
like image 742
meetnick Avatar asked Jul 26 '17 14:07

meetnick


People also ask

Is a shared library an executable?

9.1. Dynamically linkable code is held in shared library files. These files are left on disk until required at run time. A shared library file is an executable file format produced by the system linker that, unlike a runnable system executable file, lacks an initial entry point.

How do I open a shared library application?

Click Applications > Application Types > WebSphere enterprise applications > application_name > Shared library references in the console navigation tree to access the Shared library references page. On the Shared library references page, select an application or module to which you want to associate a shared library.

Where are shared libraries in Ubuntu?

Shared libraries are compiled code which is intended to be shared among several different programs. They are distributed as . so files in /usr/lib/.

What is a library executable?

The general idea behind an executable library is to create a library that when used as a library does one thing; but has the ability to be run directly via command line.


1 Answers

I have fixed this behavior by adding the following line on my project's .pro file in QT:

QMAKE_LFLAGS += -no-pie

The behavior is occurring because newer ubuntu distros set GCC default link flag -pie, which marks e_type as ET_DYN on the binary file. Consequently, the Operating System recognizes as Shared Library.

To work around it, it may be necessary to add -no-pie on compiler option.

like image 196
meetnick Avatar answered Sep 24 '22 19:09

meetnick