Installing gfortran-14

2024-08-20 Thread John Harper

I did this in my Ubuntu 22.04 system with no trouble:

(lf) john:~$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

but the next step failed:

(lf) john:~$ sudo apt install gfortran-14
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package gfortran-14 is not available, but is referred to by another 
package.

This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gfortran-14' has no installation candidate
(lf) john:~$

What should I have done?

-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz


Re: Installing gfortran-14

2024-08-21 Thread John Harper
Thank you Damian. Tried the first suggestion. It said I already had 
gfortran; it turned out to be version 13. Tried the second suggestion. My 
system has not heard of git. Managed to find gcc-14.2.0.tar so I am now 
struggling to do something with that.


On Tue, 20 Aug 2024, Damian Rouson wrote:


Date: Tue, 20 Aug 2024 23:34:50 +
From: Damian Rouson 
To: John Harper 
Cc: "fortran@gcc.gnu.org" 
Subject: Re: Installing gfortran-14
Resent-Date: Wed, 21 Aug 2024 11:35:39 +1200 (NZST)
Resent-From: 

You don't often get email from damian@archaeologic.codes. Learn why this is 
important<https://aka.ms/LearnAboutSenderIdentification>
It has been a few years since I used Ubuntu. If I recall correctly, I think you 
can just use

sudo apt install gcc

and that will install gcc, g++, and gfortran.  My Linux knowledge is limited.  
I never figured out how to install a specific version of GCC on Ubuntu so I 
think you just get what you get.  However, what I liked about Ubuntu was that 
it seemed to be aggressive about installing more up-to-date versions of GCC 
than some other Linux distributions, so if it's an option, you might get a 
newer version of GCC by updating your Ubuntu kernel and then the above apt 
command again.  I think the latest version is Ubuntu 24.  FWIW, I mostly used 
the Lubuntu lightweight Ubuntu distribution.

If you really need GCC 14 and the above advice doesn't help, you might try 
running the OpenCoarrays installer script to build whatever version you want 
from source:

git clone https://github.com/sourceryinstitute/opencoarrays
cd opencoarrays
./install.sh --package gcc --install-version 14 --install-prefix 
 --num-threads 4

or run ./install.sh. --help for additional options or shorter versions of the 
above options.

I hope this is all helpful.

Damian



On Tue, Aug 20, 2024 at 4:08 PM John Harper 
mailto:john.har...@vuw.ac.nz>> wrote:
I did this in my Ubuntu 22.04 system with no trouble:

(lf) john:~$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

but the next step failed:

(lf) john:~$ sudo apt install gfortran-14
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package gfortran-14 is not available, but is referred to by another
package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gfortran-14' has no installation candidate
(lf) john:~$

What should I have done?

-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz<mailto:john.har...@vuw.ac.nz>




-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz

Re: Installing gfortran-14

2024-08-28 Thread John Harper

Hi Thomas

Thank you! I got part of the way there after discovering that 
download-prerequisites had to be download_prerequisites, but make -j12

had a fatal error. What I did was

$ cd
% mkdir Gcc
% cd ~/Gcc
$ tar xvjf  ../Downloads/gmp-6.2.1.tar.bz2
$ tar -zxvf ../Downloads/mpc-1.2.1.tar.gz
$ tar xvjf  ../Downloads/mpfr-4.1.0.tar.bz2
$ tar -x -f ../Downloads/gcc-14.2.0.tar
$ cd gcc-14.2.0
$ contrib/download_prerequisites 
$ cd

$ mkdir Gcc-build
$ cd Gcc-build
$ ../Gcc/gcc-14.2.0/configure --prefix=$HOME --enable-multilib 
--enable-languages=c,c++,fortran

$ make -j12

After several minutes of checking and compilation, that ended with

In file included from 
../../../../Gcc/gcc-14.2.0/libgcc/../gcc/tsystem.h:95,

 from ../../../../Gcc/gcc-14.2.0/libgcc/libgcov.h:42,
 from 
../../../../Gcc/gcc-14.2.0/libgcc/libgcov-merge.c:26:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such 
file or directory

   27 | #include 
  |  ^~
compilation terminated.
make[5]: *** [Makefile:931: _gcov_merge_add.o] Error 1
make[5]: Leaving directory 
'/home/john/Gcc-build/x86_64-pc-linux-gnu/32/libgcc'

make[4]: *** [Makefile:1221: multi-do] Error 1
make[4]: Leaving directory 
'/home/john/Gcc-build/x86_64-pc-linux-gnu/libgcc'

make[3]: *** [Makefile:127: all-multi] Error 2
make[3]: *** Waiting for unfinished jobs
make[3]: Leaving directory 
'/home/john/Gcc-build/x86_64-pc-linux-gnu/libgcc'

make[2]: *** [Makefile:24838: all-stage1-target-libgcc] Error 2
make[2]: Leaving directory '/home/john/Gcc-build'
make[1]: *** [Makefile:30438: stage1-bubble] Error 2
make[1]: Leaving directory '/home/john/Gcc-build'
make: *** [Makefile:1108: all] Error 2

That error message is puzzling because the offending file seems to exist:

(lf) john:~/Gcc-build$ ls -l /usr/*/*/bits/libc*
-rw-r--r-- 1 root root 4286 May  7 08:34 
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h


(I know Fortran much better than bash and make)

John

On Thu, 22 Aug 2024, Thomas Koenig wrote:


Date: Thu, 22 Aug 2024 05:19:16 +
From: Thomas Koenig 
To: John Harper ,
Damian Rouson 
Cc: "fortran@gcc.gnu.org" 
Subject: Re: Installing gfortran-14
Resent-Date: Thu, 22 Aug 2024 17:19:33 +1200 (NZST)
Resent-From: 

[You don't often get email from tkoe...@netcologne.de. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hi John,


Thank you Damian. Tried the first suggestion. It said I already had
gfortran; it turned out to be version 13. Tried the second suggestion.
My system has not heard of git. Managed to find gcc-14.2.0.tar so I am
now struggling to do something with that.


Assuming you have the top level of the gcc sources (where the configure
script resides) in the ~/Gcc directory, you can do the following:

$ cd ~/Gcc
$ contrib/download-prerequisites
$ cd
$ mkdir Gcc-build
$ cd Gcc-build
$ ../Gcc/configure --prefix=$HOME --enable-languages=c,c++,fortran
$ make -j8
$ make -j4 install

The --prefix=$HOME option will install binaries, support libraries etc
under your home directory; if you want to put it somewhere else, specify
it as an alternative argument.

The build directory has to be separate from the source directory,
this is a frequent source of weird build errors.  Adjust directory
names to taste.

The "-j8" option will use eight parallel compilations if possible;
adjust to approximately the number of CPUs on your system. Having
2GB memory per job is quite sufficient.

Hope this helps

   Thomas






-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz


Re: Installing gfortran-14

2024-08-29 Thread John Harper

Hi Thomas & Damian

Thank you. I'm running Ubuntu 24.04 in an x86_64 system.
I do have dpkg and it said
(lf) john:~/Gcc-build$ dpkg -S libc-header-start.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h

So I tried

$ sudo apt install libc6-dev
$ ../Gcc/gcc-14.2.0/configure --prefix=$HOME --enable-multilib
  --enable-languages=c,c++,fortran
$ make -j4

but I still got the same error message from make.

John

On Thu, 29 Aug 2024, Thomas Koenig wrote:


Date: Thu, 29 Aug 2024 06:25:23 +
From: Thomas Koenig 
To: John Harper 
Cc: Damian Rouson ,
"fortran@gcc.gnu.org" 
Subject: Re: Installing gfortran-14
Resent-Date: Thu, 29 Aug 2024 18:25:38 +1200 (NZST)
Resent-From: 

[You don't often get email from tkoe...@netcologne.de. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hi John,


/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No
such file or directory
27 | #include 


I'm not sure what system you are running. On my Ubuntu system,
which is Debian-based, you can search for the package that provides a
file with

$ dpkg -S libc-header-start.h

which, for me, returns libc6-dev.  You can then install that with

$ apt install libc6-dev

If your system does not provide dpkg and apt, you'll have to use
whatever tool there is.

Best regards

   Thomas





-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz


Re: Installing gfortran-14

2024-08-31 Thread John Harper

Dear Jerry, Thomas and Damian,

Not knowing what to do with libc6-i386 libc6-dev-i386 I tried instead
to do without multilib by disabling it:

$ ../Gcc/gcc-14.2.0/configure --prefix=$HOME --disable-multilib 
--enable-languages=c,c++,fortran

$ make -j4
$ make -j4 install

That ran for over an hour, without obvious error messages though 
occasional warnings flashed up for milliseconds on the screen while

configure and make were running. I now have a gfortran-14 compiler -
thank you all!

Now to discover how to remove all the out-of-date gfortran stuff 
cluttering up my computer. (I don't intend ever to run gfortran-9 to 
gfortran-12 again.)


John

 On Fri, 30 Aug 2024, Jerry D wrote:


Date: Fri, 30 Aug 2024 03:19:37 +
From: Jerry D 
To: John Harper , Thomas Koenig 
Cc: Damian Rouson ,
"fortran@gcc.gnu.org" 
Subject: Re: Installing gfortran-14
Resent-Date: Fri, 30 Aug 2024 15:19:51 +1200 (NZST)
Resent-From: 

[You don't often get email from jvdelis...@gmail.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

On 8/29/24 7:53 PM, John Harper wrote:

Hi Thomas & Damian

Thank you. I'm running Ubuntu 24.04 in an x86_64 system.
I do have dpkg and it said
(lf) john:~/Gcc-build$ dpkg -S libc-header-start.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h

So I tried

$ sudo apt install libc6-dev
$ ../Gcc/gcc-14.2.0/configure --prefix=$HOME --enable-multilib
   --enable-languages=c,c++,fortran
$ make -j4

but I still got the same error message from make.

John



I am reminded. When using --enable-multilib you need both the 32-bit and
the 64-bit libraries.

Possibly libc6-i386 libc6-dev-i386.

Jerry


-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.har...@vuw.ac.nz