LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rpmbuild error --- Symlink points to BuildRoot: (https://www.linuxquestions.org/questions/linux-software-2/rpmbuild-error-symlink-points-to-buildroot-912115/)

alexzander1211 11-06-2011 01:38 AM

rpmbuild error --- Symlink points to BuildRoot:
 
hi all,
i am trying to create rpm for bzip2,
in building i am getting following error message. also i am building as non-root user.

{{{
+ rm -rf /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzcmp
+ ln -s -f /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzdiff /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzcmp
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
Processing files: bzip2-1.0.6-6.i386
error: Symlink points to BuildRoot: /usr/local/bin/bzcmp -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzdiff
error: Symlink points to BuildRoot: /usr/local/bin/bzegrep -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzgrep
error: Symlink points to BuildRoot: /usr/local/bin/bzfgrep -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzgrep
error: Symlink points to BuildRoot: /usr/local/bin/bzless -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzmore


RPM build errors:
Symlink points to BuildRoot: /usr/local/bin/bzcmp -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzdiff
Symlink points to BuildRoot: /usr/local/bin/bzegrep -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzgrep
Symlink points to BuildRoot: /usr/local/bin/bzfgrep -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzgrep
Symlink points to BuildRoot: /usr/local/bin/bzless -> /home/rpmuser/rpmbuild/BUILDROOT/bzip2-1.0.6-6.i386/usr/local/bin/bzmore

}}}

It seams it is creating sybilic links in BUILDROOT.
I have seen similar threads before.But i am still not getting how to solve this problem. perhaps i need to a add some changes to install section of my spec file.
install section sample of my bzip2.spec file is as follows
{{{
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr/local

%clean

}}}
any help will be usefull :confused:

unSpawn 11-06-2011 04:54 AM

Theres hard links and symbolic links but I've never heard of sibyllic links... And unless you're certain you only need to change details best post your complete .spec file, more efficient. Anyway, %_buildroot (the "BuildRoot:" directive in your .spec file) shouldn't be in %_builddir but set to something like "%{_tmppath}/%{name}-%{version}" (if %_topdir defaults to /home/rpmuser/rpmbuild then %_builddir is set to %{_topdir}/BUILD and %_tmppath may be %{_topdir}/tmp or /var/tmp or whatever else you want to configure in your ~/.rpmmacros file). Then you should be able to 'make DESTDIR=$RPM_BUILD_ROOT install' as proposed.

alexzander1211 11-06-2011 06:25 AM

hi ,
my .rpmmacros file contains
%_topdir /home/rpmuser/rpmbuild
%_tmppath /home/rpmuser/rpmbuild/tmp

and my complete spec file is
{{{
Name:bzip2
Version:1.0.6
Release:6
Summary:bzip2

Group:compressing
License:GPL
URL: http://sources.redhat.com/bzip2/
Source0:bzip2-1.0.6.tar.gz
BuildRoot: %{_tmppath}/ %{name}-root


#BuildRequires:
#Requires:

%description
start compressing

%prep
%setup -q


%build
make

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr/local

%clean

rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc
/usr/local/bin/bunzip2
/usr/local/bin/bzcat
/usr/local/bin/bzcmp
/usr/local/bin/bzdiff
/usr/local/bin/bzegrep
/usr/local/bin/bzfgrep
/usr/local/bin/bzgrep
/usr/local/bin/bzip2
/usr/local/bin/bzip2recover
/usr/local/bin/bzless
/usr/local/bin/bzmore
/usr/local/include/bzlib.h
/usr/local/lib/libbz2.a
/usr/local/man/man1/bzcmp.1
/usr/local/man/man1/bzdiff.1
/usr/local/man/man1/bzegrep.1
/usr/local/man/man1/bzfgrep.1
/usr/local/man/man1/bzgrep.1
/usr/local/man/man1/bzip2.1
/usr/local/man/man1/bzless.1
/usr/local/man/man1/bzmore.1

%changelog
}}}

by still getting that Symlink points to BuildRoot error. what i need to change in spec file ?

unSpawn 11-06-2011 08:05 AM

2 Attachment(s)
Quote:

Originally Posted by alexzander1211 (Post 4517157)
by still getting that Symlink points to BuildRoot error. what i need to change in spec file ?

First, if you read BUILD/bzip2-1.0.6/README it tells you to use PREFIX and not DESTDIR. Second, the 'ln -s -f' part in the Makefile does not allow modification (which it should) as you do not want leading paths. I don't know how Red Hat accomplished this but I tried it the simple way. Maybe inform Julian Seward? Then your .spec file is also utterly incomplete, contains wrong information and does not adhere to ANY standard. Working with such a crippled .spec file causes all kinds of easily avoidable errors making the build process unnecessarily harder. Please read the RPM package builders documentation. Finally think twice if you're going to install this package on a host that gets updates from RHN as this is not SOP.

That said, find attached a 'diff -urN' with the .spec file you posted with comments and fix for the %install part and an example of how a .spec file could look like.

HTH


All times are GMT -5. The time now is 03:24 AM.