I try to compile octave from source, on Ubuntu 20.04 following instructions here:
https://wiki.octave.org/Building
before which i have installed dependencies according here: https://wiki.octave.org/Octave_for_Debian_systems
Then I got the following error
checking g++ compiler version number... 9.4.0
checking whether stl_algo.h is broken... no
checking gcc compiler version number... 9.4.0
configure: defining __NO_MATH_INLINES avoids buggy GNU libc exp function
checking for sin in -lm... yes
checking for gfortran... gfortran
checking whether the compiler supports GNU Fortran 77... yes
checking whether gfortran accepts -g... no
checking whether a usable Fortran compiler was found... yes
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran... -L/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-pc-linux-gnu/13 -L/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib/gcc/current -L/home/linuxbrew/.linuxbrew/lib -lgfortran -lm -lquadmath
checking for dummy main to link with Fortran 77 libraries... unknown
configure: error: in `/home/sunxd/octave-8.3.0/.build':
configure: error: linking to Fortran libraries from C fails
Inside the config.log, I found
configure:18457: gcc -o conftest -g -O2 conftest.c -lm -L/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-pc-linux-gnu/ 13 -L/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/home/linuxbrew/.linuxbrew/lib/gcc/current -L/home/linuxbrew/.linuxbrew/lib -lgfortran -lm -lquadmath >&5 ¬
2160 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':¬
2161 (.text+0x16): undefined reference to `__libc_csu_fini'¬
2162 /usr/bin/ld: (.text+0x1d): undefined reference to `__libc_csu_init'¬
2163 collect2: error: ld returned 1 exit status¬
2164 configure:18457: $? = 1¬
2165 configure: failed program was:¬
2166 | /* confdefs.h */¬
using env |grep PATH (advice from Vladimir)
MANPATH=/home/linuxbrew/.linuxbrew/share/man:/home/linuxbrew/.linuxbrew/share/man::
WINDOWPATH=2
INFOPATH=/home/linuxbrew/.linuxbrew/share/info:/home/linuxbrew/.linuxbrew/share/info:
PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/sunxd/
I have commented out the script of linuxbrew from .profile already but still linuxbrew is there.
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
log out and log in again linux brew is away now.
following advice from Ian, I have get rid of f2c alreay.
now the configuration passed.