Fortran and FreeBSD

Alternatively, you can install the meta port lang/gcc to avoid the symlinks.

1 Like

Thanks. If I have understood, “ports” must be compiled from source? (contrarily to “packages”)

Packages are just pre-compiled ports, distributed for convenience. To build ports locally, just fetch the ports tree and execute the Makefile of a specific port (make && make install). For a more pleasant experience, you probably want to use ports-mgmt/portmaster. And to create your own package distribution environment, you can set-up Poudriere. Packages built with Poudriere are installed the same way as the official FreeBSD packages (like pkg install foo/bar).

1 Like

In my FreeBSD virtual machine, one problem I had encountered was there was no plplot-fortran package (Fortran bindings) like in Ubuntu. So I had downloaded the PLplot sources from SourceForge and built them.

But on that page (PLplot | Programming in Modern Fortran), I read:

PLplot is available as a package on most Unix-like operating systems. Just install package math/plplot on FreeBSD: # pkg install math/plplot
Make sure that the package has to be built with Fortran support.

I will have to look how to proceed…

I forgot to say that I was surprised by the number of FreeBSD packages. I have not compared the statistics with Debian Linux, but it seems equivalent. Each time I wonder “Is there a package for my favourite xxxxxx application?”, I find it. And the versions are recent.

What I meant was that math/plplot requires the build option FORTRAN to be enabled:

$ cd /usr/local/ports/math/plplot
$ doas make config

If you have a look at the end of the port details on FreshPorts, you’ll see the available build options and their default values. Unfortunately, the Fortran language support is disabled by default, which is why your package has no Fortran modules included. You either have to switch to a public package repository that has the build option enabled, or compile from source (i.e., use FreeBSD ports). In general, it is recommended not to mix packages and ports (as sooner or later dependencies diverge and things will start to break), however, it’s probably okay in this case to install PLplot from ports.

1 Like

Thanks @interkosmos for your help.

I have made some progress. First I tried to use FreeBSD ports to build PLplot with Fortran support. I have failed but learned things about what are ports (essentially makefiles and patches applied after downloading the sources from the official software repository itself). I encountered problems because my packages come from the quaterly branch (July) and the ports tree I installed with # portsnap auto was using the lattest branch. Then I have found that script to install the quaterly ports: Using Quarterly Ports on FreeBSD :: Blog :: Chris Wells' Website
But I had still dependencies problems, so I finally decided to download the sources myself and built it. The last problem to fix was a build error related to the Qt driver, so I decided to build without Qt (useless for me as I use the Cairo/GTK driver) by adding the CMake option -D DEFAULT_NO_QT_DEVICES=ON (I have found that option in this list).

So it is half a success, half a failure (but bringing knowledge). I think I am not yet ready to explore the ports way :grin: I will retry it when I will be higher on my learning curve.