Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: seandepagnier on March 16, 2020, 11:06:39 AM

Title: fortran compiler for scipy
Post by: seandepagnier on March 16, 2020, 11:06:39 AM
I noticed gcc has fortran (and many other languages) enabled but I cannot find "gfortran" and scipy fails to find fortran compiler while building.

What is the best way to get fortran (or scipy) on pi core?
Title: Re: fortran compiler for scipy
Post by: Juanito on March 16, 2020, 01:00:51 PM
If a gfortran extension doesn’t exist, you’ll need to compile it with gcc.
Title: Re: fortran compiler for scipy
Post by: seandepagnier on March 17, 2020, 11:35:28 AM
Could you point me to the build scripts for gcc?  I'm on picore 9, I can only find scripts for picore 4.
Title: Re: fortran compiler for scipy
Post by: Juanito on March 17, 2020, 12:35:15 PM
If you enter "gcc -v", it should tell you how it was configured - then it's just a matter of adding fortran to --enable-languages=
Title: Re: fortran compiler for scipy
Post by: Rich on March 17, 2020, 12:50:09 PM
Hi seandepagnier
Are these of any help:
http://tinycorelinux.net/7.x/x86/tcz/src/gfortran/
http://tinycorelinux.net/10.x/x86/tcz/src/gfortran/
Title: Re: fortran compiler for scipy
Post by: seandepagnier on March 17, 2020, 12:56:28 PM
I will build gcc from source now, but I am interested to see the build script for gcc.tcz.

@rich
I looked at the x86 version but it does not create a tcz.   What am I missing?

gcc -v shows:   "--enable-languages=c,c++,fortran,go"  for pi-core but obviously no fortran.  Was it split into a separate package?
Title: Re: fortran compiler for scipy
Post by: Rich on March 17, 2020, 01:11:40 PM
Hi seandepagnier
... I looked at the x86 version but it does not create a tcz.   What am I missing? ...
Creating a  .tcz  involves packaging the created files using  mksquashfs.  The first thing you should read is:
http://wiki.tinycorelinux.net/wiki:creating_extensions
Title: Re: fortran compiler for scipy
Post by: seandepagnier on March 18, 2020, 09:13:48 AM
Thank you, I know how squashfs is used, but I would like to see the script used to build gcc.tcz so it can be easily reproduced and I can see how fortran was carved out so I could make a package for just the missing fortran part.


I did compile gcc with gfortran but "make install" to ram runs out of disk space. 
Title: Re: fortran compiler for scipy
Post by: Rich on March 18, 2020, 09:26:26 AM
Hi seandepagnier
... I did compile gcc with gfortran but "make install" to ram runs out of disk space.
Then try pointing it to some persistent storage.Maybe something like:
Code: [Select]
mkdir /mnt/sda1/package
make DESTDIR=/mnt/sda1/package install
Title: Re: fortran compiler for scipy
Post by: Juanito on March 18, 2020, 10:23:03 AM
You can look at the following to see what needs packaging:

http://www.tinycorelinux.net/10.x/x86/tcz/gfortran.tcz.list
http://www.tinycorelinux.net/10.x/x86/tcz/gfortran-lib.tcz.list
Title: Re: fortran compiler for scipy
Post by: seandepagnier on March 19, 2020, 06:08:29 PM
Hi seandepagnier
... I did compile gcc with gfortran but "make install" to ram runs out of disk space.
Then try pointing it to some persistent storage.Maybe something like:
Code: [Select]
mkdir /mnt/sda1/package
make DESTDIR=/mnt/sda1/package install
I did this and unfortunately it lead to more errors because the c++ library is not found with the new compiler.   I think more hints to include directories are needed somehow.  Unfortunately scipy uses both c++ and fortran.

After changing PATH back and forth after each failure after a few times I got scipy to build but on loading it fails with unresolved externals.

I am trying again with a different gcc version and hopefully it will work.    It's difficult to build on tinycore because of the limited ram...   is there a way to have a larger ramdisk by adding more swap?   I already need to add a lot of swap to make this build but it's not giving me more space in /
Title: Re: fortran compiler for scipy
Post by: Rich on March 19, 2020, 08:17:44 PM
Hi seandepagnier
...   It's difficult to build on tinycore because of the limited ram...   is there a way to have a larger ramdisk by adding more swap?   I already need to add a lot of swap to make this build but it's not giving me more space in /
I should have also suggested you download and build the source in persistent storage. That should leave a lot more RAM available
for the build.
Title: Re: fortran compiler for scipy
Post by: Juanito on March 20, 2020, 01:43:08 AM
I am trying again with a different gcc version and hopefully it will work.

I think that, in order to avoid strange problems, you would need to compile gfortran with the same version of gcc in use with piCore.