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

abu_bua
  • 10,473
  • 10
  • 45
  • 62
Ocean Waves
  • 151
  • 1
  • 2
  • 10
  • 1
    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](https://bugs.freedesktop.org/show_bug.cgi?id=97226) and/or this related question [Impossible to launch graphic executables in nautilus](https://askubuntu.com/questions/871926/impossible-to-launch-graphic-executables-in-nautilus) – steeldriver Sep 02 '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. – Ocean Waves Sep 02 '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 – steeldriver Sep 02 '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](https://askubuntu.com/q/1071288/533194) to fix the missing library. – Ocean Waves Sep 02 '18 at 14:36

1 Answers1

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.

  • Good to hear this worked for you, but without an explanation of how or why it worked, this is not really a complete answer. – Tom Brossman Oct 27 '18 at 09: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. – digitalTrilunaire Oct 27 '18 at 09:35