0

I tried to install gcc-9.1.0 version with gcc-5 and the following configure options:

../gcc-9.1.0/configure --prefix=local/gcc/9.1.0-all \
   --program-suffix='-10' \
   --without-included-gettext \
   --enable-threads=posix \
   --enable-libstdcxx-time=yes \
   --enable-shared \
   --enable-languages=c,c++,fortran,go,objc,obj-c++ \
   --with-mpfr="$MPFR_DIR" \
   --with-mpc=$MPC_DIR\
   --with-gmp=$GMP_DIR\
   --with-isl=$ISL_DIR\
   --enable-host-shared \
   --disable-libquadmath --disable-libquadmath-support --disable-werror\
   CC=gcc-5 CXX=g++-5

However, I always get the error:

../gcc-9.1.0/libgfortran/runtime/string.c:96:1: error: static declaration of ‘strnlen’ follows non-static declaration

How can I resolve this error? Can't I install gfortran under current system?

My installation system is Ubuntu 16.04.5 LTS (Xenial Xerus) and CPU is Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz.

After install gcc-9 and g++-9, I try to install only gfortran as following configuration:

../gcc-9.1.0/configure --prefix=$EXTERNALPACKAGES/$PACKAGE/$VER-fortran \
   --program-suffix='-9' \
   --without-included-gettext \
   --enable-threads=posix \
   --enable-libstdcxx-time=yes \
   --with-system-zlib \
   --disable-browser-plugin \
   --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu \
   --enable-shared \
   --enable-languages=fortran \
   --with-mpfr="$MPFR_DIR" \
   --with-mpc=$MPC_DIR\
   --with-gmp=$GMP_DIR\
   --with-isl=$ISL_DIR\
   --enable-host-shared \
   --disable-multilib \
   --disable-libquadmath --disable-libquadmath-support --disable-werror\
   CC=gcc-9 CXX=g++-9

However, I got same error:

../../../gcc-9.1.0/libgfortran/runtime/string.c:96:1: error: static dec
laration of ‘strnlen’ follows non-static declaration
veryreverie
  • 2,871
  • 2
  • 13
  • 26
  • If you're trying to build 9.1.0, why are you using --program-suffix='-10'? Shouldn't that be '-9'? Why are you using double quotes `--with-mpfr="$MPFR_DIR" ` here, but not elsewhere, for example, `--with-mpc=$MPC_DIR`? – steve Jul 31 '22 at 16:07
  • Forgot to mention, and SO won't allow me to edit previous comment. What happens if you remove the `--without-included-gettext` option? Finally, have you tried building just the C and C++ front-ends, e.g., ` --enable-languages=c,c++`? If yes, then, use the freshly built and installed gcc-9.1.0 to rebuild with all the other languages enables. – steve Jul 31 '22 at 16:14
  • Dear steve, 1. "--program-suffix-10": This is my mistake... 2. why are you using double quotes --with-mpfr="$MPFR_DIR" Under `bash` environment, there is not problem with using double quotes for specifying the install directory of MPFR. – MakeUbuntu Aug 02 '22 at 01:15
  • Although i remove bulit directory, this error comment is always triggered. Building `gcc` and `g++` do not trigger the error. However, only building gfortran, e.g. `--enable-lanuage=fortran` shows following error... – MakeUbuntu Aug 02 '22 at 01:20
  • If you can build gcc-9 and g++9, then install it. Once it is installed, then do CC=gcc-9 and CXX=g++9 with gfortran enable. Does this build? – steve Aug 02 '22 at 02:37
  • okay, I will try it. Wait.. – MakeUbuntu Aug 04 '22 at 00:40
  • @steve I got a same error building gfortran `--enable-lanuage=fortran` with `CC=gcc-9` and `CXX=g++-9` . – MakeUbuntu Aug 07 '22 at 14:22

0 Answers0