Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-10-2017, 01:24 PM
|
#1
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Rep: 
|
cannot stat 'test.h': No such file or directory why?
Hi
I'm a new linux user and use ubuntu. I have tried to build a RPM package and followed the steps at http://searchenterpriselinux.techtar...kages-in-Linux
and I removed the following lines from spec
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date
But when Im building RMP I get "cannot stat 'test.h': No such file or directory"
Thanks in advane
Merh
|
|
|
02-10-2017, 01:28 PM
|
#2
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
sounds like a typo somewhere.
isnt it supposed to be 'test.sh'? so search your thing for 'test.h' and change it to 'test.sh'
Also - why are you building an RPM on a Ubuntu system?
Last edited by szboardstretcher; 02-10-2017 at 01:30 PM.
|
|
1 members found this post helpful.
|
02-10-2017, 01:31 PM
|
#3
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
Just before we go anyfurther, want to confirm that you know that RPM packages are generally meant for Red Hat or SUSE variants of Linux? whereas ubuntu is branched off from the Debian side. deb or dpkg would be the alternatives for ubuntu I believe.
|
|
|
02-10-2017, 01:45 PM
|
#4
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
Quote:
Originally Posted by r3sistance
Just before we go anyfurther, want to confirm that you know that RPM packages are generally meant for Red Hat or SUSE variants of Linux? whereas ubuntu is branched off from the Debian side. deb or dpkg would be the alternatives for ubuntu I believe.
|
Hi
I correct the type to .sh. but the same problem. I test in both Redhat and ubuntu. In Redhat I'm not root user.
|
|
|
02-10-2017, 01:51 PM
|
#5
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
Hi
I correct the type to .sh. but the same problem. I'm testing in the both Redhat and ubuntu. In Redhat I'm not root user.
|
|
|
02-10-2017, 01:52 PM
|
#6
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
Ok, so is this the redhat box or the ubuntu box you are testing this on? also can you supply the command you are running for when you see the issues? With output.
|
|
|
02-10-2017, 01:56 PM
|
#7
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not user.
I use the commond rpmbuild -ba demo.spec
|
|
|
02-10-2017, 02:11 PM
|
#8
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
Redhat which I'm not root user. Command is rpmbuild -ba demo.spec
|
|
|
02-10-2017, 02:12 PM
|
#9
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not root user.
I use the commond rpmbuild -ba demo.spec
|
|
|
02-10-2017, 02:15 PM
|
#10
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not roo user.
I use the commond rpmbuild -ba demo.spec
and get
cp test.sh /home/Merh/rpmbuild/BUILDROOT/test-1.0-1.el7.x86_64/home/Merh/bin
cp: cannot stat 'test.sh': No such file or directory
Last edited by Merh; 02-10-2017 at 02:27 PM.
Reason: More info.
|
|
|
02-10-2017, 02:26 PM
|
#11
|
Senior Member
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375
|
there is an edit button. What does `tar -tf ~/rpmbuild/SOURCES/test-1.0.tar.gz` return?
|
|
|
02-10-2017, 02:29 PM
|
#12
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
It returns
test-1.0/
test-1.0/test.sh
|
|
|
02-10-2017, 02:59 PM
|
#13
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Primary reason for the issue is that the article is crap. Its wrong. The spec file he uses is wrong.
So here. Here is my re-interpretation.
Code:
(Log in as a non-root user)
mkdir ~/test-1.0
cd ~/test-1.0
echo echo this is a test > test.sh
chmod +x test.sh
echo just launch the script > README
cd
mkdir -p ~/rpmbuild/SOURCES
mkdir -p ~/rpmbuild/SPECS
tar -cvzf ~/rpmbuild/SOURCES/test-1.0.tar.gz test-1.0
cp test-1.0/* ~/rpmbuild/BUILD
vim ~/rpmbuild/SPECS/demo.spec
The demo.spec file contents:
Code:
Name: test
Version: 1.0
Release: 1%{?dist}
Summary: A test package
Group: Test Packages
License: GPL
URL: http://test.example.com
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date
%description
Demo package for deployment of one single file
%prerp
%setup -q
%build
#configure
#make %{? _smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
cp test.sh $RPM_BUILD_ROOT/usr/local/bin
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(755,root,root,755)
#%doc
%attr(0755,root,root)/usr/local/bin/test.sh
%changelog
Build the thing:
Code:
rpmbuild -ba rpmbuild/SPECS/demo.spec
You can see all of my output here:
Code:
[user@tools ~]$ rpmbuild -ba rpmbuild/SPECS/demo.spec
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.jYpa1I
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.fxKNN2
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ '[' /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64 '!=' / ']'
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
++ dirname /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ mkdir -p /home/user/rpmbuild/BUILDROOT
+ mkdir /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ mkdir -p /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64/usr/local/bin
+ cp test.sh /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64/usr/local/bin
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: test-1.0-1.el7.centos.x86_64
Provides: test = 1.0-1.el7.centos test(x86-64) = 1.0-1.el7.centos
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
Wrote: /home/user/rpmbuild/SRPMS/test-1.0-1.el7.centos.src.rpm
Wrote: /home/user/rpmbuild/RPMS/x86_64/test-1.0-1.el7.centos.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.2fuu20
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ exit 0
Done.
|
|
1 members found this post helpful.
|
02-10-2017, 03:47 PM
|
#14
|
LQ Newbie
Registered: Feb 2017
Posts: 15
Original Poster
Rep: 
|
Thanks a lot. But when I install it nothing happens, I mean the directory bin under home/merh/ is not created and so on. I appreciate your help.
Name: test
Version: 1.0
Release: 1%{?dist}
Summary: A test package
Group: Test Packages
License: GPL
URL: http://test.example.com
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date
%description
Demo package for deployment of one single file
%prerp
%setup -q
%build
#configure
#make %{? _smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/home/mehr/bin
cp test.sh $RPM_BUILD_ROOT/home/mehr/bin
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(755,root,root,755)
#%doc
%attr(0755,root,root)/home/mehr/bin/test.sh
%changelog
|
|
|
All times are GMT -5. The time now is 05:49 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|