I have binutils-2.25.1 installed to /usr/local/binutils-2.25.1, configured with
../configure --prefix=/usr/local/binutils-2.25.1 --enable-plugins --enable-gold --disable-werror
And I want to build RPM package - gcc with LTO support that uses linker ld from /usr/local/binutils-2.25.1.
I try:
Summary: The GNU Compiler Collection
Name: gcc-custom
Version: 4.9.3
%define full_name gcc-%{version}
%define binutils_path /usr/local/binutils-2.25.1
Release: 0
...
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description
%prep
%setup -q -a0 -n %{full_name}
%build
AR=%{binutils_path}/bin/ar NM=%{binutils_path}/bin/nm RANLIB=@%{binutils_path}/bin/ranlib ./configure \
--prefix=/usr/local/%{full_name} \
--disable-multilib \
--enable-languages=c,c++ \
--enable-lto \
--enable-linker-build-id \
--enable-plugin \
--with-ld=%{binutils_path}/bin/ld \
--with-plugin-ld=%{binutils_path}/bin/ld \
--with-as=%{binutils_path}/bin/as
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/local/%{full_name}
%changelog
After installing this package I try:
/usr/local/gcc-4.9.3/bin/g++ -flto -fno-fat-lto-objects -fuse-linker-plugin test.cpp -o test
And get:
cc1plus: error: -fno-fat-lto-objects are supported only with linker plugin
But, ld from /usr/local/binutils-2.25.1 has plugin support
/usr/local/binutils-2.25.1/bin/ld --help | grep plugin
-plugin PLUGIN Load named plugin
-plugin-opt ARG Send arg to last-loaded plugin
Also, gcc-{ar,nm,ranlib} from /usr/local/gcc-4.9.3 have --plugin support
/usr/local/gcc-4.9.3/bin/gcc-ar --help | grep plugin
--plugin <p> - load the specified plugin
Need your help, guys
UPD I managed to solve the problem. Just replaced
./configure ...
with
mkdir build && cd build && ../configure ...
and also added
cd build
to %install begin
gcc-4.9.3/lto-plugin/congifure script isn't written correct !!!
-f
parameters matter? Does doing-fuse-linker-plugin -fno-fat-lto-objects
change anything? – Mohan