public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiler problem with gfortran
@ 2022-04-24 16:58 C. David Whiteman
  2022-04-24 17:15 ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: C. David Whiteman @ 2022-04-24 16:58 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

Am having some trouble compiling a simple fortran program on my M1 MacBook Air. I am using the latest MacOS, Monterey 12.3.1, and the latest version of Xcode. I installed Homebrew and gcc to update my old version of gfortran. The fortran program on my desktop will compile when I use the command gfortran -c skippy.f, producing the executable file skippy.o on my desktop. But I can’t get the executable file to run. I am an amateur and am really not that familiar with the unix commands, etc. Can someone give me some advice on this? Thanks.

-Dave

~/Desktop 519 $ gfortran -o skippy.f
gfortran: fatal error: no input files; unwilling to write output files
compilation terminated.
~/Desktop 520 $ gfortran -c skippy.f
~/Desktop 521 $ ./skippy.o
-bash: ./skippy.o: Permission denied
~/Desktop 522 $ gfortran skippy.f
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
~/Desktop 523 $ g77 skippy.f
-bash: g77: command not found
~/Desktop 524 $ 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1403 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiler problem with gfortran
  2022-04-24 16:58 Compiler problem with gfortran C. David Whiteman
@ 2022-04-24 17:15 ` Jonathan Wakely
  2022-04-24 17:19   ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2022-04-24 17:15 UTC (permalink / raw)
  To: C. David Whiteman; +Cc: gcc-help

On Sun, 24 Apr 2022, 17:59 C. David Whiteman via Gcc-help, <
gcc-help@gcc.gnu.org> wrote:

> Am having some trouble compiling a simple fortran program on my M1 MacBook
> Air. I am using the latest MacOS, Monterey 12.3.1, and the latest version
> of Xcode. I installed Homebrew and gcc to update my old version of
> gfortran. The fortran program on my desktop will compile when I use the
> command gfortran -c skippy.f, producing the executable file skippy.o


That's not an executable file, it's an object file. You used the -c option
which says to stop after compilation and not link the object into an
executable.

If you remove the -c option you'll get an executable.




on my desktop. But I can’t get the executable file to run. I am an amateur
> and am really not that familiar with the unix commands, etc. Can someone
> give me some advice on this? Thanks.
>
> -Dave
>
> ~/Desktop 519 $ gfortran -o skippy.f
> gfortran: fatal error: no input files; unwilling to write output files
> compilation terminated.
> ~/Desktop 520 $ gfortran -c skippy.f
> ~/Desktop 521 $ ./skippy.o
> -bash: ./skippy.o: Permission denied
> ~/Desktop 522 $ gfortran skippy.f
> ld: library not found for -lSystem
> collect2: error: ld returned 1 exit status
> ~/Desktop 523 $ g77 skippy.f
> -bash: g77: command not found
> ~/Desktop 524 $

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiler problem with gfortran
  2022-04-24 17:15 ` Jonathan Wakely
@ 2022-04-24 17:19   ` Jonathan Wakely
       [not found]     ` <546813AC-1859-4DCC-A8CA-74F3CC0E4F83@mac.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2022-04-24 17:19 UTC (permalink / raw)
  To: C. David Whiteman; +Cc: gcc-help

On Sun, 24 Apr 2022, 18:15 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:

>
>
> On Sun, 24 Apr 2022, 17:59 C. David Whiteman via Gcc-help, <
> gcc-help@gcc.gnu.org> wrote:
>
>> Am having some trouble compiling a simple fortran program on my M1
>> MacBook Air. I am using the latest MacOS, Monterey 12.3.1, and the latest
>> version of Xcode. I installed Homebrew and gcc to update my old version of
>> gfortran. The fortran program on my desktop will compile when I use the
>> command gfortran -c skippy.f, producing the executable file skippy.o
>
>
> That's not an executable file, it's an object file. You used the -c option
> which says to stop after compilation and not link the object into an
> executable.
>
> If you remove the -c option you'll get an executable.
>

Oh but I see that when you tried that you got an error due to -lSystem
being absent.

That's not a gfortran library, so it looks like you need to install some
additional packages on your Mac. Maybe the xcode command line tools or
something.



>
>
>
> on my desktop. But I can’t get the executable file to run. I am an amateur
>> and am really not that familiar with the unix commands, etc. Can someone
>> give me some advice on this? Thanks.
>>
>> -Dave
>>
>> ~/Desktop 519 $ gfortran -o skippy.f
>> gfortran: fatal error: no input files; unwilling to write output files
>> compilation terminated.
>> ~/Desktop 520 $ gfortran -c skippy.f
>> ~/Desktop 521 $ ./skippy.o
>> -bash: ./skippy.o: Permission denied
>> ~/Desktop 522 $ gfortran skippy.f
>> ld: library not found for -lSystem
>> collect2: error: ld returned 1 exit status
>> ~/Desktop 523 $ g77 skippy.f
>> -bash: g77: command not found
>> ~/Desktop 524 $
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiler problem with gfortran
       [not found]     ` <546813AC-1859-4DCC-A8CA-74F3CC0E4F83@mac.com>
@ 2022-04-24 18:01       ` Jonathan Wakely
  2022-04-24 18:32         ` Iain Sandoe
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2022-04-24 18:01 UTC (permalink / raw)
  To: C. David Whiteman; +Cc: gcc-help

On Sun, 24 Apr 2022, 18:34 C. David Whiteman, <davidwhiteman@mac.com> wrote:

> I got on the Apple Developer website and downloaded
>
> Command Line Tools for Xcode 13.3
> Additional Tools for Xcode 13.3
>
> But I am still getting the following error when coming skippy.f
>
> ~/Desktop 526 $ gfortran skippy.f
> ld: library not found for -lSystem
> collect2: error: ld returned 1 exit status
>
> I guess the ld: suggests that the loader has not found a needed library.
> Not sure where that library comes from, where it would be in the directory
> structure, etc.
>

According to https://developer.apple.com/forums/thread/655588
I think it comes from an SDK for your version of macOS. But I've never used
macOS so I don't know how it's supposed to work.

Please keep your replies on the mailing list, so people who actually
understand macOS can help. Replying just to me isn't going to get you
anywhere because I don't know where libSystem comes from any more than you
do.



>
> On Apr 24, 2022, at 11:19 AM, Jonathan Wakely <jwakely.gcc@gmail.com>
> wrote:
>
>
>
> On Sun, 24 Apr 2022, 18:15 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:
>
>>
>>
>> On Sun, 24 Apr 2022, 17:59 C. David Whiteman via Gcc-help, <
>> gcc-help@gcc.gnu.org> wrote:
>>
>>> Am having some trouble compiling a simple fortran program on my M1
>>> MacBook Air. I am using the latest MacOS, Monterey 12.3.1, and the latest
>>> version of Xcode. I installed Homebrew and gcc to update my old version of
>>> gfortran. The fortran program on my desktop will compile when I use the
>>> command gfortran -c skippy.f, producing the executable file skippy.o
>>
>>
>> That's not an executable file, it's an object file. You used the -c
>> option which says to stop after compilation and not link the object into an
>> executable.
>>
>> If you remove the -c option you'll get an executable.
>>
>
> Oh but I see that when you tried that you got an error due to -lSystem
> being absent.
>
> That's not a gfortran library, so it looks like you need to install some
> additional packages on your Mac. Maybe the xcode command line tools or
> something.
>
>
>
>>
>>
>>
>> on my desktop. But I can’t get the executable file to run. I am an
>>> amateur and am really not that familiar with the unix commands, etc. Can
>>> someone give me some advice on this? Thanks.
>>>
>>> -Dave
>>>
>>> ~/Desktop 519 $ gfortran -o skippy.f
>>> gfortran: fatal error: no input files; unwilling to write output files
>>> compilation terminated.
>>> ~/Desktop 520 $ gfortran -c skippy.f
>>> ~/Desktop 521 $ ./skippy.o
>>> -bash: ./skippy.o: Permission denied
>>> ~/Desktop 522 $ gfortran skippy.f
>>> ld: library not found for -lSystem
>>> collect2: error: ld returned 1 exit status
>>> ~/Desktop 523 $ g77 skippy.f
>>> -bash: g77: command not found
>>> ~/Desktop 524 $
>>
>>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiler problem with gfortran
  2022-04-24 18:01       ` Jonathan Wakely
@ 2022-04-24 18:32         ` Iain Sandoe
       [not found]           ` <EF85E3DB-4263-4266-9DCC-76E75ADF0C7B@mac.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Iain Sandoe @ 2022-04-24 18:32 UTC (permalink / raw)
  To: C. David Whiteman; +Cc: gcc-help

Hi Dave,

> On 24 Apr 2022, at 19:01, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On Sun, 24 Apr 2022, 18:34 C. David Whiteman, <davidwhiteman@mac.com> wrote:
> I got on the Apple Developer website and downloaded 
> 
> Command Line Tools for Xcode 13.3

^ When this is installed, it provides the SDK that has the library,

> Additional Tools for Xcode 13.3

^ Not actually needed (but also harmless).
> 
> But I am still getting the following error when coming skippy.f
> 
> ~/Desktop 526 $ gfortran skippy.f
> ld: library not found for -lSystem
> collect2: error: ld returned 1 exit status
> 
> I guess the ld: suggests that the loader has not found a needed library. Not sure where that library comes from, where it would be in the directory structure, etc.

When the command line tools are installed, it would be found in an SDK installed as /LIbrary/Developer/CommandLineTools/SDKs.

Please check with the Homebrew folks, and double-check that you have everything installed as expected.

I am not aware of any general problem with the system library.

thanks,
Iain


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Compiler problem with gfortran
       [not found]             ` <D6936E54-88C0-4E7E-AA85-38A478BF77E9@mac.com>
@ 2022-04-24 19:20               ` Iain Sandoe
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Sandoe @ 2022-04-24 19:20 UTC (permalink / raw)
  To: C. David Whiteman; +Cc: gcc-help

Hello Dave,

> On 24 Apr 2022, at 20:10, C. David Whiteman <davidwhiteman@mac.com> wrote:
> 
> Thinking of trying another solution (screenshot follows)
> 
> <Screen Shot 2022-04-24 at 1.06.07 PM.png>
> 
> Does this seem to you like something worth trying??

Not something I am familiar with, and it seems highly unlikely that strange work-arounds would be needed if everything is properly installed.

The following occurs to me - on the basis that you have updated an existing Intel installation to an Arm64 / M1 one:

NOTE: the Arm64 (M1) installation of homebrew is in a different place from the Intel one.

(disclaimer; I’m not a homebrew dev) .. I would make sure that your PATH etc. are pointing to the Arm version (found in /opt/homebrew, I think) rather than the Intel install (which is usually in /usr/local) .. in case you copied across the Intel installation and/or configuration data.

I really would recommend raising a ticket with homebrew (if you are 100% sure that everything is installed as it should be) - since there is every reason to expect that a properly installed compiler will “just work" (there is no issue raised with me about this, from the homebrew folks).

thanks
Iain


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-24 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 16:58 Compiler problem with gfortran C. David Whiteman
2022-04-24 17:15 ` Jonathan Wakely
2022-04-24 17:19   ` Jonathan Wakely
     [not found]     ` <546813AC-1859-4DCC-A8CA-74F3CC0E4F83@mac.com>
2022-04-24 18:01       ` Jonathan Wakely
2022-04-24 18:32         ` Iain Sandoe
     [not found]           ` <EF85E3DB-4263-4266-9DCC-76E75ADF0C7B@mac.com>
     [not found]             ` <D6936E54-88C0-4E7E-AA85-38A478BF77E9@mac.com>
2022-04-24 19:20               ` Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).