1

When I make a Fortran executable using make under 18.04.1, a shared library is made that is executable instead of an executable. I have attached images comparing 18.04 and 18.04.1 results. How do I make an executable instead of a shared library?

18.04.1 results 18.04 results

4
  • It hasn't made a shared library - it's made an executable that contains position independent code, which libmagic unfortunately misidentifies as a shared library - see this bug report PIE executables (e.g. /usr/bin/ls) are detected as application/x-sharedlib and/or this related question Impossible to launch graphic executables in nautilus Sep 2 '18 at 13:47
  • Is it possible to change this file type to executable? It runs in a terminal window, but it currently cannot be distinguished from normal text files in a window. Sep 2 '18 at 14:11
  • I guess you could revert to an older version of gfortran (that doesn't create position independent executables by default). Otherwise, it may be possible to recompile using appropriate flags - for gcc/g++ you can use -fno-pic (compile) and -no-pie (link), not sure what the equivalents are for gfortran Sep 2 '18 at 14:21
  • When I upgraded to 18.04.1, I could not compile because a shared library was missing. I assume that gfortran was updated during the upgrade to 18.04.1. I installed the shared library to fix the missing library. Sep 2 '18 at 14:36
0

If it can help someone. I had a similar problem. The program that I tried to compile was on an NTFS partition (shared btw windows and ubuntu). When I compile it on the NTFS partition, the output has a shared lib. I moved all my project (source code and MakeFile) on my linux partition (ext4) and I compile it again. This time the output was an exectuable file.

2
  • Good to hear this worked for you, but without an explanation of how or why it worked, this is not really a complete answer. Oct 27 '18 at 9:29
  • 1
    I am not sure why it works, but the permission system is not the same between NTFS and EXT. Maybe another person with more knowledge can explain it. Oct 27 '18 at 9:35

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.