LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-06-2015, 03:47 PM   #1
newbie2015
LQ Newbie
 
Registered: May 2015
Posts: 3

Rep: Reputation: Disabled
RPM build errors: File not found error


Hello,

1. I am trying to create a rpm file on RHEL 6 using rpmbuild. I receive below error while running “rpmbuild –ba testfile.spec” (FYI - I am running the above command as non-root user)

RPM build errors:
File not found: /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64/home/makerpm/rpmbuild/SOURCES/httpd-2.4.12.tar.gz

2. Before running rpmbuild I did ensure there are source files in /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64/home/makerpm/rpmbuild/SOURCES directory.

The below are contents from the spec file

%define _topdir /home/makerpm/rpmbuild
%define name httpd
%define release 2.4
%define version 2.4.12
%define buildroot %{_tmppath}/%{name}-%{version}-root
BuildRoot: %{buildroot}
Summary: Create a test rpm file
Name: httpd
Version: 2.4.12
Release: 2.4
License: ATT
Vendor: ATT
Source: source1.tar.gz
Source1:source2.tar.gz
Source2:source3.tar.gz

%files
/home/makerpm/rpmbuild/SOURCES/source1.tar.gz
/home/makerpm/rpmbuild/SOURCES/source2.tar.gz
/home/makerpm/rpmbuild/SOURCES/source3.tar.gz
%defattr(-,root,root)

%build
./configure
make

%install
"make install

3. I noticed that once it enters %install it removes the $RPM_BUILD_ROOT directory which is “/home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64” and then recreates it. That is the reason I am losing the source files I had moved earlier.

Please see the messages below which were generated.

Executing(%install): /bin/sh -e /var/tmp/apache/rpm-tmp.oTHV01
+ umask 022
+ cd /home/makerpm/rpmbuild/BUILD
+ '[' /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64 '!=' / ']'
+ rm -rf /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64
++ dirname /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64
+ mkdir -p /home/makerpm/rpmbuild/BUILDROOT
+ mkdir /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make install
Making install in srclib


I tried putting files in a different directory but it always looks for the files in $RPM_BUILD_ROOT. Is there a way we can put the files in a directory different from $RPM_BUILD_ROOT?

Thank you,
 
Old 05-07-2015, 03:23 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
When you setup a default {rpmbuild environment} like ...
#13 http://www.linuxquestions.org/questi...1-a-766486/#13
... you will have this : $HOME/rpms/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

The sources.tar.** location is /home/<name>/rpms/SOURCES/.

Which you can also observe when unpacking an SRC RPM :
$ rpm -Uvh < any-of-these ftp://ftp.redhat.com/redhat/linux/en...r/en/os/SRPMS/ >


-
 
Old 05-07-2015, 09:13 AM   #3
newbie2015
LQ Newbie
 
Registered: May 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
1. I copied the files to the /home/makerpm/rpmbuild/SOURCES directory and once I add the below files to the files section I keep getting error.

/home/makerpm/rpmbuild/SOURCES/httpd-2.4.12.tar.gz
/home/makerpm/rpmbuild/SOURCES/apr-1.5.2.tar.gz
/home/makerpm/rpmbuild/SOURCES/apr-util-1.5.4.tar.gz

Error : RPM build errors:
File not found: /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64/home/makerpm/rpmbuild/SOURCES/httpd-2.4.12.tar.gz

3. After receiving the above error I tried copying the files to the /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64/home/makerpm/rpmbuild/SOURCES directory but the error persists. As mentioned earlier in my email even though I created directories in the $RPM_BUILD_ROOT once it enters %install it removes the $RPM_BUILD_ROOT directory which is /home/makerpm/rpmbuild/BUILDROOT/httpd-2.4.12-2.4.x86_64 and then recreates it. That is the reason I am losing the source files I had moved earlier.

How can we ensure the .tar.gz files are packaged in rpm?
 
Old 05-07-2015, 09:48 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #3, #1.

Please see this other simple build example :
http://www.linuxquestions.org/questi...-rhel6-928622/


? Why do you want the source files in the rpm package ?
Source files are for the src.rpm package .
I.e. 'rpmbuild -ba' means : Build binary and source packages
http://linux.die.net/man/8/rpmbuild


-
 
Old 05-07-2015, 11:24 AM   #5
newbie2015
LQ Newbie
 
Registered: May 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
/home/makerpm/rpmbuild/SOURCES/source1.tar.gz
/home/makerpm/rpmbuild/SOURCES/source2.tar.gz
/home/makerpm/rpmbuild/SOURCES/source3.tar.gz

I am performing following steps in prep section

a. Extracting source1.tar.gz
b. Extract the contents of source2.tar.gz and source3.tar.gz to source1/destfolder

In build section I browse to source1 folder and execute configure and make.
In install section I am running make install

I thought keeping these .tar.gz files in /SOURCES directory will package them in the rpm file.
 
  


Reply

Tags
rpmbuild



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error package rpm-build which installing rpm-build from RHN Satellite Server. johnabraham Linux - Server 1 10-05-2013 06:51 PM
RPM Build errors Kandasami S Linux - Newbie 1 12-17-2009 11:08 PM
Wrote spec file, installed RPM, binary gives relocation error and refers to build dir hollywoodb Red Hat 2 05-19-2007 10:27 AM
RPM build errors sharad Linux - General 1 10-04-2006 01:19 PM
rpm build errors iansoundz Linux - General 0 12-08-2005 03:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration