LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   error in creating rpm package for a simple "Hello World" c program (https://www.linuxquestions.org/questions/linux-newbie-8/error-in-creating-rpm-package-for-a-simple-hello-world-c-program-772449/)

jayasekar 11-30-2009 09:01 AM

error in creating rpm package for a simple "Hello World" c program
 
hi friends,

Im new to this forum.
can anyone here tell me how to create a rpm package for simple "Hello world" c program.
I have created a spec file. It's giving error in Buildroot:
can any one help me,
Thanks in advance




Jayasekar

exvor 11-30-2009 07:29 PM

You might wanna ask a mod to put this in the programming forum they may be able to help you a bit more.

kbp 11-30-2009 07:39 PM

Can you please post your spec file ?

AwesomeMachine 11-30-2009 08:42 PM

Welcome to LQ.

I think if you install the package rpmdevtools you might have an easier time. There are also gui rpm creators, where you can fill in text boxes.

jayasekar 12-01-2009 12:14 AM

Quote:

Originally Posted by kbp (Post 3775038)
Can you please post your spec file ?

Thanks for your reply
This is my spec file:

#script to build sample rpm
%define ver 1.0
%define rel 1
%define prefix /usr

Name: Demorpm
Version: 1.0
Release: 1.0
Summary: To test the rpm package building process
Group: Applications
License: GPL
#URL:
Source0: %{name}-%{ver}.tar.gz
Source1: %{name}-%{ver}
BuildRoot: /tmp/%{name}-%{ver}-root

#BuildRequires:
#Requires:

%description
To test the sample rpm build

%prep
%setup
make

%build
#make

#%configure
#make configure

%install
rm -rf ${RPM_BUILD_ROOT}
make install


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc



#%changelog

knudfl 12-01-2009 09:50 AM

More answers in this closed thread :

http://www.linuxquestions.org/questi...rogram-772590/

kbp 12-01-2009 04:23 PM

As suggested by AwsomeMachine, please install rpmdevtools and take a look at /etc/rpmdevtools/spectemplate-minimal.spec, or simply do:

Code:

cd ~/rpmbuild
vi SPECS/myapp.spec

where 'myapp.spec' is a new file.. and it should be prepopulated by the above spec template

cheers

jayasekar 12-01-2009 11:22 PM

Quote:

Originally Posted by kbp (Post 3776211)
As suggested by AwsomeMachine, please install rpmdevtools and take a look at /etc/rpmdevtools/spectemplate-minimal.spec, or simply do:

Code:

cd ~/rpmbuild
vi SPECS/myapp.spec

where 'myapp.spec' is a new file.. and it should be prepopulated by the above spec template

cheers

Thanks for your reply friends.
rpmdevtools is installed first and then only i have started to build rpm.
Im using fedora-11, given below r the errors...

[root@js SPECS]# rpmbuild -bb Demorpm.spec
Executing(%prep): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.8xfvPl
+ umask 022
+ cd /root/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /root/rpmbuild/BUILD
+ rm -rf Demorpm-1.0
+ /bin/tar -xf /root/rpmbuild/SOURCES/Demorpm-1.0.tar.gz
+ cd Demorpm-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.MqnIYn
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd Demorpm-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make
gcc -Wall -O2 -I/usr/include -DVERSION="1.0" -c sample.c
gcc -Wall -O2 -I/usr/include -DVERSION="1.0" sample.o -o sample
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -I/root/rpmbuild/lib/gfortran/modules'
+ export FFLAGS
+ ./configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i586-redhat-linux-gnu --program-prefix= --prefix=/root/rpmbuild --exec-prefix=/root/rpmbuild --bindir=/root/rpmbuild/bin --sbindir=/root/rpmbuild/sbin --sysconfdir=/etc --datadir=/root/rpmbuild/share --includedir=/root/rpmbuild/include --libdir=/root/rpmbuild/lib --libexecdir=/root/rpmbuild/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
+ ./configure --prefix=/usr
+ exit 0
Executing(%install): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.gwEBhq
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd Demorpm-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /root/rpmbuild/BUILDROOT/Demorpm-1.0-1.0.i386
+ make install
removed `/usr/bin/sample'
`sample' -> `/usr/bin/sample'
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /root/rpmbuild/BUILD/Demorpm-1.0
find: `/root/rpmbuild/BUILDROOT/Demorpm-1.0-1.0.i386': No such file or directory
error: Bad exit status from /root/rpmbuild/tmp/rpm-tmp.gwEBhq (%install)


RPM build errors:
Bad exit status from /root/rpmbuild/tmp/rpm-tmp.gwEBhq (%install)

jayasekar 12-02-2009 12:53 AM

Problem solved
 
Quote:

Originally Posted by jayasekar (Post 3776563)
Thanks for your reply friends.
rpmdevtools is installed first and then only i have started to build rpm.
Im using fedora-11, given below r the errors...

[root@js SPECS]# rpmbuild -bb Demorpm.spec
Executing(%prep): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.8xfvPl
+ umask 022
+ cd /root/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /root/rpmbuild/BUILD
+ rm -rf Demorpm-1.0
+ /bin/tar -xf /root/rpmbuild/SOURCES/Demorpm-1.0.tar.gz
+ cd Demorpm-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.MqnIYn
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd Demorpm-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make
gcc -Wall -O2 -I/usr/include -DVERSION="1.0" -c sample.c
gcc -Wall -O2 -I/usr/include -DVERSION="1.0" sample.o -o sample
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -I/root/rpmbuild/lib/gfortran/modules'
+ export FFLAGS
+ ./configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i586-redhat-linux-gnu --program-prefix= --prefix=/root/rpmbuild --exec-prefix=/root/rpmbuild --bindir=/root/rpmbuild/bin --sbindir=/root/rpmbuild/sbin --sysconfdir=/etc --datadir=/root/rpmbuild/share --includedir=/root/rpmbuild/include --libdir=/root/rpmbuild/lib --libexecdir=/root/rpmbuild/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
+ ./configure --prefix=/usr
+ exit 0
Executing(%install): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.gwEBhq
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd Demorpm-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /root/rpmbuild/BUILDROOT/Demorpm-1.0-1.0.i386
+ make install
removed `/usr/bin/sample'
`sample' -> `/usr/bin/sample'
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /root/rpmbuild/BUILD/Demorpm-1.0
find: `/root/rpmbuild/BUILDROOT/Demorpm-1.0-1.0.i386': No such file or directory
error: Bad exit status from /root/rpmbuild/tmp/rpm-tmp.gwEBhq (%install)


RPM build errors:
Bad exit status from /root/rpmbuild/tmp/rpm-tmp.gwEBhq (%install)

hi friends, the problem is solved..

Modify the spec file as shown below

%prep
%setup -q

%build
make

%configure
./configure --prefix=/usr

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
make install _prefix=${RPM_BUILD_ROOT}
$RPM_BUILD_ROOT/usr/bin/%{name}

it will work as u think
useful link: http://articles.techrepublic.com.com...tag=rbxccnbtr1

Thanks for your help and spending time to analyse my problem..
Thank you very much.


All times are GMT -5. The time now is 04:22 PM.