F2c C code: undefined reference in "dot a" static library file

What do I do about this? Stated simply, it looks like the cc compiler is having trouble with gfortran keywords.

The library.a file was compiled with gfortran.

Compilation:

cc -o main main.c libf2c.a -lm -DLINUX -DSYSV -DNOHLA -g -Wall -Werror -fmax-errors=1 library.a

Compilation output:

library.a: In function `first_test_':
test.f:544: undefined reference to `_gfortran_runtime_error_at'
test.f:544: undefined reference to `_gfortran_runtime_error_at'
test.f:549: undefined reference to `_gfortran_runtime_error_at'
test.f:552: undefined reference to `_gfortran_st_write'
test.f:552: undefined reference to `_gfortran_transfer_character_write'
test.f:552: undefined reference to `_gfortran_st_write_done'
test.f:553: undefined reference to `_gfortran_stop_string'
test.f:557: undefined reference to `_gfortran_runtime_error_at'
test.f:557: undefined reference to `_gfortran_runtime_error_at'
test.f:556: undefined reference to `_gfortran_runtime_error_at'
test.f:564: undefined reference to `_gfortran_st_write'
test.f:564: undefined reference to `_gfortran_transfer_integer_write'
test.f:564: undefined reference to `_gfortran_st_write_done'
test.f:566: undefined reference to `_gfortran_st_write'
test.f:566: undefined reference to `_gfortran_runtime_error_at'
test.f:566: undefined reference to `_gfortran_transfer_character_write'
test.f:566: undefined reference to `_gfortran_st_write_done'
test.f:568: undefined reference to `_gfortran_st_read'
test.f:568: undefined reference to `_gfortran_runtime_error_at'
test.f:568: undefined reference to `_gfortran_transfer_character'
test.f:568: undefined reference to `_gfortran_st_read_done'
test.f:569: undefined reference to `_gfortran_runtime_error_at'

etc. etc. etc.

At runtime, the program is not able to find libasan.so.6. You would need to add the location of this library to the environment variable LD_LIBRARY_PATH

In this case entering export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:????/gfortran/gcc-11.1.0/lib64/
at the prompt should help
change ???? in the above command such that you get the absolute path to libasan.so.6. I am not able to tell where it is exactly on your system.

additionally you can do ldd ./main to check if it find all the libraries it needs

To stop the the gdb Dwarf errors, it looks like you can add -gdwarf-4 (or 3 or 2) to the compilation step to force a particular version. See this for reference: Debugging Options

Regarding the segmentation fault I don’t have an idea at the moment, unfortunately.