Bug 1288717 - Build of R packages with gcc and gfortran fails with redhat-hardened-cc1
Build of R packages with gcc and gfortran fails with redhat-hardened-cc1
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: R (Show other bugs)
23
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Tom "spot" Callaway
Fedora Extras Quality Assurance
:
Depends On: 1192183
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-05 09:41 EST by traderbeckola
Modified: 2016-11-09 08:07 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-09 08:07:57 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description traderbeckola 2015-12-05 09:41:46 EST
Description of problem:

(note that gcc was picked as the component for this bug because R and R-Core (the stat packages) were not in the component drop-down list).

Version-Release number of selected component (if applicable):
R-3.2.2-2.fc23.x86_64


How reproducible:
Start R
Install a package that will require compilation (many, but not all)
{Note that in my case I tried to build the package EGRET [install.packages("EGRET"), but this should fail for many packages}

Steps to Reproduce:
1. Install R on fairly clean/new Fedora 23 
2. Run R
3. Try to install packages which require compilation (gcc, gfortran, likely others)

Actual results:
Error messages result from the compiler because of use of flags. For example:

gcc -m64 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic  -c bit-ops.c -o bit-ops.o
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
/usr/lib64/R/etc/Makeconf:134: recipe for target 'bit-ops.o' failed
make: *** [bit-ops.o] Error 1
ERROR: compilation failed for package ‘bitops’

  and

gfortran -m64   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c bckslvmodified.f -o bckslvmodified.o
gfortran: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
/usr/lib64/R/etc/Makeconf:158: recipe for target 'bckslvmodified.o' failed
make: *** [bckslvmodified.o] Error 1


Expected results:
R packages compile and install successfully.

Additional info:

Proposed solution:

Add redhat-rpm-config as a dependency to either R, or the compiler packages (gcc, gfortran).  Installing this package seems to fix the problem.

See indirectly related issue and fix at https://community.gns3.com/thread/22847.
Comment 1 Jakub Jelinek 2015-12-08 06:49:41 EST
GCC itself does not add -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 , so it must come either from the rpm configuration, or some other tool like libtool or pkgconfig.
Comment 2 Pavel Raiskup 2015-12-08 09:11:37 EST
You probably know, but '%undefine _hardened_build' should work-around this
issue.
Comment 3 Panu Matilainen 2016-11-08 05:29:52 EST
Reassigning to R, if it sets -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 on builds then it needs to require it too.

BTW see also bug 1218294, there appears to be a common theme here.
Comment 4 Tom "spot" Callaway 2016-11-09 08:07:57 EST
I'm not sure how you managed this. 

From the R.spec:

%if 0%{?fedora}
%global modern 1
%global hardening 1
%endif

%package core
Summary: The minimal R components necessary for a functional runtime
Group: Applications/Engineering
Requires: xdg-utils, cups
# R inherits the compiler flags it was built with, hence we need this on hardened systems
%if 0%{hardening}
Requires: redhat-rpm-config
%endif

*****

Looking at the R-core-3.3.2-2.fc23 package:

http://koji.fedoraproject.org/koji/rpminfo?rpmID=8470725

redhat-rpm-config shows up under Requires.

Note You need to log in before you can comment on or make changes to this bug.