Bug 220319 - math/R: Added the option to support the flang fortran
Summary: math/R: Added the option to support the flang fortran
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Joseph Mingrone
URL:
Keywords:
Depends on:
Blocks: 220359
  Show dependency treegraph
 
Reported: 2017-06-28 01:14 UTC by Yuri Victorovich
Modified: 2017-07-07 17:40 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (jrm)


Attachments
patch (3.46 KB, patch)
2017-06-28 01:14 UTC, Yuri Victorovich
no flags Details | Diff
patch adding FORTRAN options (3.46 KB, patch)
2017-06-28 20:06 UTC, Yuri Victorovich
no flags Details | Diff
patch switching fortran to flang (2.45 KB, patch)
2017-06-28 20:08 UTC, Yuri Victorovich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2017-06-28 01:14:38 UTC
Created attachment 183864 [details]
patch

This patch:
* Adds GFORTRAN and FLANG options
  - The FLANG option takes advantage of the newly proposed fortran:flang argument to build with llvm-based flang instead of the gcc-based gfortran
* Adds the patch patch-configure to prevent the configuration failure due to configure script expecting G77 fortran, test for which flang fails for some reason
  - This should probably be reported either upstream to flang, or upstream to R, depending on if flang is or isn't expected to be G77
* Adds the patch patch-src_main_complex.c because cpow and clog functions are missing for some reason with flang

Builds in poudriere. Passes simple tests.
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2017-06-28 01:35:30 UTC
Another way is to just switch to flang permanently.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2017-06-28 20:06:19 UTC
Created attachment 183893 [details]
patch adding FORTRAN options
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2017-06-28 20:08:26 UTC
Created attachment 183894 [details]
patch switching fortran to flang

Please use either one of the patches.
Comment 4 Joseph Mingrone freebsd_committer freebsd_triage 2017-07-04 17:14:00 UTC
Non-default Flang support was added directly to math/R in r445026.  Thanks for submitting.
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2017-07-04 18:00:26 UTC
devel/rstudio can't be built with default settings without flang being the default in math/R.
Comment 6 Joseph Mingrone freebsd_committer freebsd_triage 2017-07-04 18:46:04 UTC
I understand and I think flang could soon be the default (at least on amd64, but hopefully other architectures as well when they are supported), but let's first give a little time to confirm R works reliably with flang.  I am running with flang and so far so good, but I would like to have more time to test.

Also, with flang depending specifically on llvm39, I am seeing two versions of llvm being pulled in, llvm40 for some ports and then llvm39 for flang.  I think most users would not be pleased to need two different versions of llvm installed when they are each over 1 GB.
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2017-07-04 22:59:26 UTC
I first missed that flang doesn't support i386 yet.
It looks like it has some maturing to do.
We need to wait.
Comment 8 Johannes M Dieterich freebsd_committer freebsd_triage 2017-07-07 03:09:28 UTC
Thanks for the patch! Exciting to see uses for flang! I am hoping to clean up my patches soon and upstream them, after which i386 should be possible. However, I don't have any i386 to test on.

Concerning the llvm39 dependency: that's what upstream has and I really don't want to open the can of worms to change that. I am hoping that they will keep updating to newer llvm releases.
Comment 9 Yuri Victorovich freebsd_committer freebsd_triage 2017-07-07 17:40:45 UTC
(In reply to Johannes M Dieterich from comment #8)

You are welcome! Thanks for maintaining the flang port.

It looks like flang currently fails to build several packages, for example lapack. So it isn't too mature yet. I tried it with llvm40 and it worked fine. I created several upstream bug reports about build failures, llvm40, and i386 support.

IMO, patch in bug#220313 should be committed as an experimental feature for now to allow those who can benefit use it.