Bug 1288717

Summary: Build of R packages with gcc and gfortran fails with redhat-hardened-cc1
Product: [Fedora] Fedora Reporter: traderbeckola
Component: RAssignee: Tom "spot" Callaway <tcallawa>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 23CC: davejohansen, ffesti, jakub, jonathan, jwakely, law, mpolacek, pmatilai, praiskup, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-09 13:07:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1192183    
Bug Blocks:    

Description traderbeckola 2015-12-05 14:41:46 UTC
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 11:49:41 UTC
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 14:11:37 UTC
You probably know, but '%undefine _hardened_build' should work-around this
issue.

Comment 3 Panu Matilainen 2016-11-08 10:29:52 UTC
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 13:07:57 UTC
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.