Bug 240279 - math/R: fix build with GCC-based architectures
Summary: math/R: fix build with GCC-based architectures
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:
 
Reported: 2019-09-02 16:12 UTC by Piotr Kubaj
Modified: 2019-09-19 19:57 UTC (History)
3 users (show)

See Also:
jrm: maintainer-feedback-


Attachments
patch (1007 bytes, patch)
2019-09-02 16:12 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (jrm)
Details | Diff
Fix build on GCC archs (2.55 KB, patch)
2019-09-03 20:51 UTC, Joseph Mingrone
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2019-09-02 16:12:46 UTC
Created attachment 207104 [details]
patch

On GCC architectures, there's no need for installing libomp and since GCC9 it actually breaks build.

While here, also add USES=xorg.
Comment 1 Joseph Mingrone freebsd_committer 2019-09-02 20:42:54 UTC
Hello Piotr,

When I test in poudriere, the build does not break when depending on devel/openmp.

http://pkg.awarnach.mathstat.dal.ca/data/12amd64-default/2019-09-02_17h03m38s/logs/R-3.6.1_1.log

However, there are problems when I remove the dependency on devel/openmp.

- "checking for cc option to support OpenMP... unsupported".
- "checking for c++ -std=gnu++11 option to support OpenMP... unsupported"
- "checking whether OpenMP SIMD reduction is supported... no"

http://pkg.awarnach.mathstat.dal.ca/data/12amd64-default/2019-09-02_17h18m29s/logs/R-3.6.1_1.log

USES=xorg, should now be added, however, it should only be added when the X11 knob is on.  So, we should add X11_USES=xorg.

Please let me know if I am misunderstanding something.
Comment 2 Piotr Kubaj freebsd_committer 2019-09-02 20:55:43 UTC
(In reply to Joseph Mingrone from comment #1)
I don't think I understand what you mean.

You clearly use Clang. If you remove OpenMP dependency, you don't get OpenMP. Isn't that how it should be?
Comment 3 Joseph Mingrone freebsd_committer 2019-09-02 22:49:39 UTC
I thought you were referring to the knob for building the fortran code with gfortran or flang.  It's confusing because gfortran is part of gcc.

I just applied your patch, then added USE_GCC=yes, however devel/openmp is still pulled in and the build fails.

http://pkg.awarnach.mathstat.dal.ca/data/12amd64-default/2019-09-02_19h11m56s/logs/errors/R-3.6.1_1.log

Is my test inappropriate?  If not, could you check the logic in

.if ! ${PORT_OPTIONS:MFLANG} && ${PORT_OPTIONS:MOPENMP} && ${CHOSEN_COMPILER_TYPE} == clang
Comment 4 Piotr Kubaj freebsd_committer 2019-09-03 09:20:53 UTC
(In reply to Joseph Mingrone from comment #3)
Hm, you're right. It looks like LIB_DEPENDS can't be modified after bsd.port.pre.mk is included, but that's when CHOSEN_COMPILER_TYPE is defined.

Could you then exclude FLANG option on powerpc64? According to devel/flang/Makefile, it's only for amd64 anyway.
Comment 5 Joseph Mingrone freebsd_committer 2019-09-03 20:51:31 UTC
Created attachment 207167 [details]
Fix build on GCC archs

Piotr, could you test whether this patch fixes the problem?
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2019-09-03 23:54:08 UTC
I guess I have to admit that I am confused by the following in the latest patch:

+X11_USES=		xorg
 X11_USE=		xorg=ice,sm,x11,xext,xmu,xscrnsaver,xt
Comment 7 Joseph Mingrone freebsd_committer 2019-09-04 00:00:23 UTC
There was a recent change with the way xorg is handled in ports.  See the comment in https://svnweb.freebsd.org/ports?view=revision&revision=509895
Comment 8 Piotr Kubaj freebsd_committer 2019-09-15 10:31:58 UTC
(In reply to Joseph Mingrone from comment #5)
Yes, this patch works.
Comment 9 commit-hook freebsd_committer 2019-09-19 19:56:43 UTC
A commit references this bug:

Author: jrm
Date: Thu Sep 19 19:55:44 UTC 2019
New revision: 512371
URL: https://svnweb.freebsd.org/changeset/ports/512371

Log:
  math/R: Fix dependency condition for devel/openmp

  libomp is provided by
    - LLVM, which gets pulled in with FLANG
    - gcc

  So, we *must* only depend on devel/openmp when
    - the OPENMP knob is on
    - FLANG is off (guaranteed to be off for all archs except amd64)
    - clang is the C compiler.

  But, we cannot modify LIB_DEPENDS after CHOSEN_COMPILER_TYPE is defined, so
  for now, limit the OPENMP knob for i386 and amd64 where clang is the
  default compiler.

  This will be moot after 12.1 when openmp will be in base.

  PR:		240279
  Reported by:	pkubaj
  Reviewed by:	pkubaj

Changes:
  head/math/R/Makefile
Comment 10 Joseph Mingrone freebsd_committer 2019-09-19 19:57:18 UTC
Thanks for reporting.