I am trying to get a 'hello world' type program compiled in FreeBSD 12 with flang.
This is my source code:
PROGRAM MAIN
INTEGER :: X
PRINT *, "Please, enter a number"
READ (*, *) X
PRINT *, "The square root of ", X, " is ", SQRT(X)
END PROGRAM MAIN
I try to compile it without success using:
$ flang -o test test.f90
/usr/local/bin/ld: /tmp/test-8e54ee.o: in function `MAIN_':
/usr/home/user/test/test.f90:6: undefined reference to `sqrt_'
/usr/local/bin/ld: /usr/local/flang/lib/libflangrti.so: undefined reference to `backtrace_symbols'
/usr/local/bin/ld: /usr/local/flang/lib/libflangrti.so: undefined reference to `backtrace'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
It has been a long time since last time I used Fortran and it is definitively the first time I try to compile it with FreeBSD. Any help/hint is welcomed.