Hello,
I have a bash script that compiles a program as well on older versions of Ubuntu (14.04 and 16.04) than on the last one (18.04) as well as on other distributions and therefore with different gcc settings.
To obtain an executable that can be launched (among other things) by a double click, I compile this program without the "-no-pie" option with older versions of gcc when I have to use this option for the new version (gcc 7.3 and higher).
The problem is that with the new configuration of gcc having the option "--enable-default-pie" of the last version of gcc, if I compile my program without the option "-no-pie", the result is an executable which is of the shared library type which can not be launched by a double click.
My question is either:
a) Is there a command that allows me to determine from this bash script if gcc is configured with the "--enable-default-pie" setting?
b) or if not, is there a command that allows me to determine from this bash script if the compiled file is of the shared library or executable type?
If I do not find an answer to my first option, the second (it is true less elegant but just as effective) would allow me to compile first without the "-no-pie" option and if the result is a shared library, of restart this compilation this time with the option "-no-pie" for, in one case as in the other, get an executable that can be launched by a double click whatever the setting of gcc.
Thank you in advance for your ideas and suggestions.
Best regards.
Bookmarks