How do you use rpmbuild to make an rpm package when there are file not found or permission errors?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am trying to create an RPM file for the wget utility. Both of my attempts (with sudo and without sudo) to use the rpmbuild comman fail to create an .rpm file.



I run a "sudo rpmbuild" command to use a spec file. But I get these errors:




error: File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget error:
File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/share/man/man1/wget.1




If I manually create the directory paths and manually copy the files, I run into other problems down the road. I think something is wrong if the rpmbuild command expects key files to be in the locations above.



I read it was recommended to not use sudo. When I do not use sudo, the rpmbuild command (rpmbuild -v -bb --clean SPECS/wget.spec) shows this:




Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NiuIFV
+ umask 022
+ cd /home/ec2-user/mywget/BUILD
+ cd /home/ec2-user/mywget/BUILD
+ rm -rf wget-1.19 rm: cannot remove 'wget-1.19/po/en@boldquot.header': Permission denied rm: cannot remove
'wget-1.19/po/zh_CN.po': Permission denied rm: cannot remove
'wget-1.19/po/id.gmo': Permission denied rm: cannot remove
'wget-1.19/po/gl.gmo': Permission denied ...




I see other "rm cannot remove ... Permission denied" lines. I expected the rpmbuild command to work. I have changed the permissions of the wget-1.19 folder to be 777 (via sudo chmod) with the owner and group being identical to the user running the rpmbuild command. I still had the problem.



What can I do to create an RPM package of the wget utility?



# This is a sample spec file for wget

%define _topdir /home/ec2-user/mywget
%define name wget
%define release 1
%define version 1.19
%define buildroot %_topdir/%name-%version-root

BuildRoot: %buildroot
Summary: GNU wget
License: GPL
Name: %name
Version: %version
Release: %release
Source: %name-%version.tar.gz
Prefix: /usr
Group: Development/Tools

%description
The GNU wget program downloads files from the Internet using the command-line.

%prep
%setup -q

%build
./configure
make

%install
make install prefix=$RPM_BUILD_ROOT/usr

%files
%defattr(-,root,root)
/usr/local/bin/wget

%doc %attr(0444,root,root) /usr/local/share/man/man1/wget.1


The above was modified but heavily based on the spec file example here: https://www.ibm.com/developerworks/library/l-rpm1/index.html







share|improve this question






















  • hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
    – thrig
    Nov 29 '17 at 2:00














up vote
0
down vote

favorite












I am trying to create an RPM file for the wget utility. Both of my attempts (with sudo and without sudo) to use the rpmbuild comman fail to create an .rpm file.



I run a "sudo rpmbuild" command to use a spec file. But I get these errors:




error: File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget error:
File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/share/man/man1/wget.1




If I manually create the directory paths and manually copy the files, I run into other problems down the road. I think something is wrong if the rpmbuild command expects key files to be in the locations above.



I read it was recommended to not use sudo. When I do not use sudo, the rpmbuild command (rpmbuild -v -bb --clean SPECS/wget.spec) shows this:




Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NiuIFV
+ umask 022
+ cd /home/ec2-user/mywget/BUILD
+ cd /home/ec2-user/mywget/BUILD
+ rm -rf wget-1.19 rm: cannot remove 'wget-1.19/po/en@boldquot.header': Permission denied rm: cannot remove
'wget-1.19/po/zh_CN.po': Permission denied rm: cannot remove
'wget-1.19/po/id.gmo': Permission denied rm: cannot remove
'wget-1.19/po/gl.gmo': Permission denied ...




I see other "rm cannot remove ... Permission denied" lines. I expected the rpmbuild command to work. I have changed the permissions of the wget-1.19 folder to be 777 (via sudo chmod) with the owner and group being identical to the user running the rpmbuild command. I still had the problem.



What can I do to create an RPM package of the wget utility?



# This is a sample spec file for wget

%define _topdir /home/ec2-user/mywget
%define name wget
%define release 1
%define version 1.19
%define buildroot %_topdir/%name-%version-root

BuildRoot: %buildroot
Summary: GNU wget
License: GPL
Name: %name
Version: %version
Release: %release
Source: %name-%version.tar.gz
Prefix: /usr
Group: Development/Tools

%description
The GNU wget program downloads files from the Internet using the command-line.

%prep
%setup -q

%build
./configure
make

%install
make install prefix=$RPM_BUILD_ROOT/usr

%files
%defattr(-,root,root)
/usr/local/bin/wget

%doc %attr(0444,root,root) /usr/local/share/man/man1/wget.1


The above was modified but heavily based on the spec file example here: https://www.ibm.com/developerworks/library/l-rpm1/index.html







share|improve this question






















  • hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
    – thrig
    Nov 29 '17 at 2:00












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to create an RPM file for the wget utility. Both of my attempts (with sudo and without sudo) to use the rpmbuild comman fail to create an .rpm file.



I run a "sudo rpmbuild" command to use a spec file. But I get these errors:




error: File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget error:
File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/share/man/man1/wget.1




If I manually create the directory paths and manually copy the files, I run into other problems down the road. I think something is wrong if the rpmbuild command expects key files to be in the locations above.



I read it was recommended to not use sudo. When I do not use sudo, the rpmbuild command (rpmbuild -v -bb --clean SPECS/wget.spec) shows this:




Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NiuIFV
+ umask 022
+ cd /home/ec2-user/mywget/BUILD
+ cd /home/ec2-user/mywget/BUILD
+ rm -rf wget-1.19 rm: cannot remove 'wget-1.19/po/en@boldquot.header': Permission denied rm: cannot remove
'wget-1.19/po/zh_CN.po': Permission denied rm: cannot remove
'wget-1.19/po/id.gmo': Permission denied rm: cannot remove
'wget-1.19/po/gl.gmo': Permission denied ...




I see other "rm cannot remove ... Permission denied" lines. I expected the rpmbuild command to work. I have changed the permissions of the wget-1.19 folder to be 777 (via sudo chmod) with the owner and group being identical to the user running the rpmbuild command. I still had the problem.



What can I do to create an RPM package of the wget utility?



# This is a sample spec file for wget

%define _topdir /home/ec2-user/mywget
%define name wget
%define release 1
%define version 1.19
%define buildroot %_topdir/%name-%version-root

BuildRoot: %buildroot
Summary: GNU wget
License: GPL
Name: %name
Version: %version
Release: %release
Source: %name-%version.tar.gz
Prefix: /usr
Group: Development/Tools

%description
The GNU wget program downloads files from the Internet using the command-line.

%prep
%setup -q

%build
./configure
make

%install
make install prefix=$RPM_BUILD_ROOT/usr

%files
%defattr(-,root,root)
/usr/local/bin/wget

%doc %attr(0444,root,root) /usr/local/share/man/man1/wget.1


The above was modified but heavily based on the spec file example here: https://www.ibm.com/developerworks/library/l-rpm1/index.html







share|improve this question














I am trying to create an RPM file for the wget utility. Both of my attempts (with sudo and without sudo) to use the rpmbuild comman fail to create an .rpm file.



I run a "sudo rpmbuild" command to use a spec file. But I get these errors:




error: File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget error:
File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/share/man/man1/wget.1




If I manually create the directory paths and manually copy the files, I run into other problems down the road. I think something is wrong if the rpmbuild command expects key files to be in the locations above.



I read it was recommended to not use sudo. When I do not use sudo, the rpmbuild command (rpmbuild -v -bb --clean SPECS/wget.spec) shows this:




Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NiuIFV
+ umask 022
+ cd /home/ec2-user/mywget/BUILD
+ cd /home/ec2-user/mywget/BUILD
+ rm -rf wget-1.19 rm: cannot remove 'wget-1.19/po/en@boldquot.header': Permission denied rm: cannot remove
'wget-1.19/po/zh_CN.po': Permission denied rm: cannot remove
'wget-1.19/po/id.gmo': Permission denied rm: cannot remove
'wget-1.19/po/gl.gmo': Permission denied ...




I see other "rm cannot remove ... Permission denied" lines. I expected the rpmbuild command to work. I have changed the permissions of the wget-1.19 folder to be 777 (via sudo chmod) with the owner and group being identical to the user running the rpmbuild command. I still had the problem.



What can I do to create an RPM package of the wget utility?



# This is a sample spec file for wget

%define _topdir /home/ec2-user/mywget
%define name wget
%define release 1
%define version 1.19
%define buildroot %_topdir/%name-%version-root

BuildRoot: %buildroot
Summary: GNU wget
License: GPL
Name: %name
Version: %version
Release: %release
Source: %name-%version.tar.gz
Prefix: /usr
Group: Development/Tools

%description
The GNU wget program downloads files from the Internet using the command-line.

%prep
%setup -q

%build
./configure
make

%install
make install prefix=$RPM_BUILD_ROOT/usr

%files
%defattr(-,root,root)
/usr/local/bin/wget

%doc %attr(0444,root,root) /usr/local/share/man/man1/wget.1


The above was modified but heavily based on the spec file example here: https://www.ibm.com/developerworks/library/l-rpm1/index.html









share|improve this question













share|improve this question




share|improve this question








edited Nov 29 '17 at 2:39

























asked Nov 29 '17 at 0:52









Jermoe

214




214











  • hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
    – thrig
    Nov 29 '17 at 2:00
















  • hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
    – thrig
    Nov 29 '17 at 2:00















hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
– thrig
Nov 29 '17 at 2:00




hard to say without seeing the contents of your wget.spec where did that file come from and how did you modify it?
– thrig
Nov 29 '17 at 2:00










1 Answer
1






active

oldest

votes

















up vote
1
down vote













This error:




error: File not found:
/root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget




means that you specified this file in %files section:



%files
/usr/local/bin/wget


so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.



You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.



I guess that either



%install
make install prefix=$RPM_BUILD_ROOT/usr/local


or



%files
%defattr(-,root,root)
/usr/bin/wget
%doc %attr(0444,root,root) /usr/share/man/man1/wget.1


will fix your error. (just one of those!)






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407624%2fhow-do-you-use-rpmbuild-to-make-an-rpm-package-when-there-are-file-not-found-or%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    This error:




    error: File not found:
    /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget




    means that you specified this file in %files section:



    %files
    /usr/local/bin/wget


    so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.



    You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.



    I guess that either



    %install
    make install prefix=$RPM_BUILD_ROOT/usr/local


    or



    %files
    %defattr(-,root,root)
    /usr/bin/wget
    %doc %attr(0444,root,root) /usr/share/man/man1/wget.1


    will fix your error. (just one of those!)






    share|improve this answer
























      up vote
      1
      down vote













      This error:




      error: File not found:
      /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget




      means that you specified this file in %files section:



      %files
      /usr/local/bin/wget


      so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.



      You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.



      I guess that either



      %install
      make install prefix=$RPM_BUILD_ROOT/usr/local


      or



      %files
      %defattr(-,root,root)
      /usr/bin/wget
      %doc %attr(0444,root,root) /usr/share/man/man1/wget.1


      will fix your error. (just one of those!)






      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        This error:




        error: File not found:
        /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget




        means that you specified this file in %files section:



        %files
        /usr/local/bin/wget


        so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.



        You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.



        I guess that either



        %install
        make install prefix=$RPM_BUILD_ROOT/usr/local


        or



        %files
        %defattr(-,root,root)
        /usr/bin/wget
        %doc %attr(0444,root,root) /usr/share/man/man1/wget.1


        will fix your error. (just one of those!)






        share|improve this answer












        This error:




        error: File not found:
        /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/usr/local/bin/wget




        means that you specified this file in %files section:



        %files
        /usr/local/bin/wget


        so rpmbuild is expecting this file in $RPM_BUILD_ROOT/usr/local/bin/wget path but it is not there. Therefore this error. Vice versa for the man page.



        You can run rpmbuild -bi which will stop just after %install phase and you can check the content of /root/rpmbuild/BUILDROOT/wget-1.19-1.x86_64/ where the make install actually put the files.



        I guess that either



        %install
        make install prefix=$RPM_BUILD_ROOT/usr/local


        or



        %files
        %defattr(-,root,root)
        /usr/bin/wget
        %doc %attr(0444,root,root) /usr/share/man/man1/wget.1


        will fix your error. (just one of those!)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '17 at 12:53









        msuchy

        74135




        74135



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407624%2fhow-do-you-use-rpmbuild-to-make-an-rpm-package-when-there-are-file-not-found-or%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?