Bug 220481 - math/R gcc-ar5 invokes ar from PATH not /usr/local/bin/ar
Summary: math/R gcc-ar5 invokes ar from PATH not /usr/local/bin/ar
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Joseph Mingrone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-05 13:46 UTC by Trond Endrestøl
Modified: 2017-09-30 16:15 UTC (History)
2 users (show)

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


Attachments
Typescript while building math/R, both without and with /usr/local/bin prepended to PATH (403.05 KB, text/plain)
2017-07-05 13:46 UTC, Trond Endrestøl
no flags Details
Patch for a short-term solution (311 bytes, patch)
2017-07-05 14:02 UTC, Trond Endrestøl
no flags Details | Diff
List of installed ports (54.83 KB, text/plain)
2017-07-05 16:13 UTC, Trond Endrestøl
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Trond Endrestøl 2017-07-05 13:46:24 UTC
Created attachment 184075 [details]
Typescript while building math/R, both without and with /usr/local/bin prepended to PATH

This probably belongs to lang/gcc5, but building math/R made me aware of this issue.

PATH is nominally set to: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin

This results in:

/usr/local/bin/gcc-ar5 -cr libtre.a regcomp.o regerror.o regexec.o tre-ast.o tre-compile.o tre-match-approx.o tre-match-backtrack.o tre-match-parallel.o tre-mem.o tre-parse.o tre-stack.o xmalloc.o
ar: unrecognized option `--plugin'
usage:  ar -d [-Tjsvz] archive file ...
        ar -m [-Tjsvz] archive file ...
        ar -m [-Tabijsvz] position archive file ...
        ar -p [-Tv] archive [file ...]
        ar -q [-TcDjsUvz] archive file ...
        ar -r [-TcDjsUuvz] archive file ...
        ar -r [-TabcDijsUuvz] position archive file ...
        ar -s [-jz] archive
        ar -t [-Tv] archive [file ...]
        ar -x [-CTouv] archive [file ...]
        ar -V
gmake[6]: *** [Makefile:53: libtre.a] Error 64
gmake[6]: Leaving directory '/usr/ports/workdirs/usr/ports/math/R/work/R-3.4.1/src/extra/tre'

In this case it's necessary to prepend /usr/local/bin to PATH. This way /usr/local/bin/gcc-ar5 invokes /usr/local/bin/ar with the required LTO plugin, and not /usr/bin/ar who are unaware of --plugin and LTO in the first place.

Maybe /usr/local/bin/gcc-ar5 should be hardcoded to run /usr/local/bin/ar and not look it up using PATH.

See attached typescript for further details.
Comment 1 Trond Endrestøl 2017-07-05 14:02:15 UTC
Created attachment 184077 [details]
Patch for a short-term solution

This patch is only a short-term solution.

If other users are affected by the issue, they can easily create math/R/Makefile.local and place the two lines there until a permanent solution exists.
Comment 2 Joseph Mingrone freebsd_committer freebsd_triage 2017-07-05 15:46:24 UTC
This works in poudriere testport where /usr/local/bin isn't listed before /usr/bin in PATH.  Also, with PATH set to /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin, make -C /usr/ports/math/R works here.

Could you list the full output of env?  Could you list what you have in /etc/make.conf?
Comment 3 Trond Endrestøl 2017-07-05 15:51:15 UTC
(In reply to Joseph Mingrone from comment #2)
root@freebsd-11-bios-zfs:/usr/ports/math/R # printenv
TERM=xterm-256color
BLOCKSIZE=K
MAIL=/var/mail/root
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SHELL=/bin/csh
HOME=/root
USER=root
HOSTTYPE=FreeBSD
VENDOR=amd
OSTYPE=FreeBSD
MACHTYPE=x86_64
SHLVL=1
PWD=/usr/ports/math/R
LOGNAME=root
GROUP=wheel
HOST=freebsd-11-bios-zfs.bsd.net
EDITOR=ee
PAGER=less
VISUAL=ee

Here's my /etc/make.conf:

#CC=clang
#CXX=clang++
#CPP=clang-cpp

KERNCONF=VBOX

# DTrace for both base and ports. See https://wiki.freebsd.org/DTrace/KernelSupport.
STRIP=
CFLAGS+=-fno-omit-frame-pointer
WITH_CTF=1

WITH_PKGNG=yes
WITH_BDB6_PERMITTED=yes
WITH_SSP_PORTS=yes
WRKDIRPREFIX=/usr/ports/workdirs

TEX_DEFAULT=texlive

DEFAULT_VERSIONS+=apache=2.4
DEFAULT_VERSIONS+=bdb=6
DEFAULT_VERSIONS+=firebird=2.5
DEFAULT_VERSIONS+=gcc=5
DEFAULT_VERSIONS+=ghostscript=agpl
DEFAULT_VERSIONS+=lua=5.2
DEFAULT_VERSIONS+=mysql=5.7
DEFAULT_VERSIONS+=perl5=5.26
DEFAULT_VERSIONS+=pgsql=9.6
DEFAULT_VERSIONS+=php=7.0
DEFAULT_VERSIONS+=python=2.7
DEFAULT_VERSIONS+=python2=2.7
DEFAULT_VERSIONS+=python3=3.6
DEFAULT_VERSIONS+=ruby=2.3
DEFAULT_VERSIONS+=ssl=base
DEFAULT_VERSIONS+=tcltk=8.6

# EOF
Comment 4 Joseph Mingrone freebsd_committer freebsd_triage 2017-07-05 16:08:53 UTC
Thanks.  I still can't reproduce this.  Could you also show the output of `make -C /usr/ports/math/R shownconfig` and `pkg info`?
Comment 5 Trond Endrestøl 2017-07-05 16:13:07 UTC
(In reply to Joseph Mingrone from comment #4)
root@freebsd-11-bios-zfs:~ # make -C /usr/ports/math/R showconfig
===> The following configuration options are available for R-3.4.1_1:
     ICU=on: Unicode support via ICU
     INFO=on: GNU info manuals
     LDOUBLE=off: Long double data type
     LETTER=off: US letter paper
     LIBR=on: Shared R library
     MEMPROF=off: Memory profiling via Rprofmem() and tracemem()
     NLS=off: Native Language Support
     RPROF=on: R profiling via Rprof()
     X11=on: X11 graphics device
====> Require GCC
     LTO=on: Use Link Time Optimization
     OPENMP=on: Parallel processing support via OpenMP
====> Require X11
     GHOSTSCRIPT=on: Graphics device for bitmap files via Ghostscript
     JPEG=on: JPEG graphics device
     CAIROPANGO=on: Cairo graphics device and Pango multi-language text
     PNG=on: PNG graphics device
     TCLTK=on: Tcl/Tk GUI toolkit support
     TEXDOCS=on: Build/Install TeX-dependent documentation files
     TIFF=on: TIFF image format support
====> Options available for the single BLAS: you have to select exactly one of them
     ATLAS=off: ATLAS BLAS implementation
     OPENBLAS=on: OpenBLAS BLAS implementation
     NETLIB=off: Netlib BLAS implementation
     RBLAS=off: Use R-bundled BLAS implementation
====> Fortran language support: you have to select exactly one of them
     GFORTRAN=on: Fortran support via gfortran
     FLANG=off: Experimental Fortran support via flang
===> Use 'make config' to modify these settings

See attachment for pkg info.
Comment 6 Trond Endrestøl 2017-07-05 16:13:35 UTC
Created attachment 184085 [details]
List of installed ports
Comment 7 Trond Endrestøl 2017-07-06 19:36:54 UTC
Curiously, I updated math/R to 3.4.1 on another VM running base/head amd64 r320597. The build went fine without the need for prepending /usr/local/bin to PATH. That's a bit strange as in fact all my FreeBSD VMs share, in turn, the same virtual drives for /usr/ports, and /var/db/ports, and a few other miscellaneous filesystems. And they all subscribe to the same local metaport.
Comment 8 Joseph Mingrone freebsd_committer freebsd_triage 2017-07-06 19:43:00 UTC
Strange indeed.  Someone else reported the same issue with the LTO option enabled.  Hopefully Gerald, whom I CCed, will have something to say soon.

As an aside, I have had better experience with R's internal Blas versus OpenBlas.  There were some stability issues in the past with OpenBlas.
Comment 9 david 2017-09-28 12:38:28 UTC
FWIW, for my "portmaster" invocations, the $PATH turns out to be:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin, so that would seem to corroborate the initial report here.

As noted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222553, though, I have circumvented the issue by disabling the LTO option.
Comment 10 Joseph Mingrone freebsd_committer freebsd_triage 2017-09-29 18:14:19 UTC
I hope this issue is now moot with the LTO option removed from 3.4.2.  If you think it is, could you close this issue (and re-open if the problem reappears)?
Comment 11 Trond Endrestøl 2017-09-30 16:15:38 UTC
Removal of LTO solved the issue. Users of ports-mgmt/portupgrade, like myself, can work around the previous issue by specifying a custom PATH enviroment variable in /usr/local/etc/pkgtools.conf when upgrading math/R.