LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-10-2017, 01:24 PM   #1
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Rep: Reputation: Disabled
Smile 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
 
Old 02-10-2017, 01:28 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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.
Old 02-10-2017, 01:31 PM   #3
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 02-10-2017, 01:45 PM   #4
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by r3sistance View Post
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.
 
Old 02-10-2017, 01:51 PM   #5
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-10-2017, 01:52 PM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 02-10-2017, 01:56 PM   #7
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-10-2017, 02:11 PM   #8
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
Redhat which I'm not root user. Command is rpmbuild -ba demo.spec
 
Old 02-10-2017, 02:12 PM   #9
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-10-2017, 02:15 PM   #10
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-10-2017, 02:26 PM   #11
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
there is an edit button. What does `tar -tf ~/rpmbuild/SOURCES/test-1.0.tar.gz` return?
 
Old 02-10-2017, 02:29 PM   #12
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
It returns
test-1.0/
test-1.0/test.sh
 
Old 02-10-2017, 02:59 PM   #13
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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.
Old 02-10-2017, 03:47 PM   #14
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] tar.gz: Cannot stat: No such file or directory windstory Linux - Newbie 3 04-14-2020 05:08 AM
cp: cannot stat '*': No such file or directory Tachtory Linux - Newbie 5 01-10-2014 10:09 AM
Tar problem; Cannot stat: No such file or directory rn-pro Programming 3 10-07-2010 03:53 AM
cannot stat /etc/X11/X (no such file or directory) theabyyss Linux - Software 2 02-12-2008 08:15 PM
lsattr: no such file or directory while trying to stat... acampbell Linux - General 6 12-01-2003 03:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:49 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