I followed these instructions, and this is the result:
sas1 taxsim: gcc -static-libgfortran -static-libgcc hello.o
hello.o: In function `MAIN__':
hello.for:(.text+0x3f): undefined reference to `_gfortran_st_write'
hello.for:(.text+0x58): undefined reference to `_gfortran_transfer_character_write'
hello.for:(.text+0x67): undefined reference to `_gfortran_st_write_done'
hello.for:(.text+0x76): undefined reference to `_gfortran_stop_string'
hello.o: In function `main':
hello.for:(.text+0x96): undefined reference to `_gfortran_set_args'
hello.for:(.text+0xa5): undefined reference to `_gfortran_set_options'
collect2: error: ld returned 1 exit status
I take it there is at least one more library I need to specify.
It seems like libquadmath has been the cause of this known "won't fix" since 2010:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539
althugh a patch was proposed in 2014:
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00375.html
Note sure what the motivation is for keeping it this way. The argument here:
https://gcc.gnu.org/ml/fortran/2010-11/msg00273.html
that libquadmath is LGPL and gcc is GPL doesn't seem to make sense to me - surely the result of binding them together is GPL because that is the most restrictive license.
Daniel Feenberg