LinuxQuestions.org
Help answer threads with 0 replies.
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 11-30-2009, 10:01 AM   #1
jayasekar
Member
 
Registered: May 2008
Posts: 39

Rep: Reputation: 16
Lightbulb 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
 
Old 11-30-2009, 08:29 PM   #2
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
You might wanna ask a mod to put this in the programming forum they may be able to help you a bit more.
 
Old 11-30-2009, 08:39 PM   #3
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Can you please post your spec file ?
 
Old 11-30-2009, 09:42 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
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.
 
Old 12-01-2009, 01:14 AM   #5
jayasekar
Member
 
Registered: May 2008
Posts: 39

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by kbp View Post
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

Last edited by jayasekar; 12-01-2009 at 01:15 AM.
 
Old 12-01-2009, 10:50 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
More answers in this closed thread :

http://www.linuxquestions.org/questi...rogram-772590/
 
Old 12-01-2009, 05:23 PM   #7
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
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
 
Old 12-02-2009, 12:22 AM   #8
jayasekar
Member
 
Registered: May 2008
Posts: 39

Original Poster
Rep: Reputation: 16
Lightbulb

Quote:
Originally Posted by kbp View Post
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)

Last edited by jayasekar; 12-02-2009 at 12:38 AM.
 
Old 12-02-2009, 01:53 AM   #9
jayasekar
Member
 
Registered: May 2008
Posts: 39

Original Poster
Rep: Reputation: 16
Problem solved

Quote:
Originally Posted by jayasekar View Post
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.

Last edited by jayasekar; 12-02-2009 at 01:55 AM. Reason: add few more links
 
  


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
Trouble compiling simple hello world program knightstreet Linux - Newbie 6 10-19-2009 08:03 PM
Error while creating RPM package kavinsiva Linux - Newbie 3 08-21-2009 07:54 AM
cannot compile simple hello world C++ program in Emacs Rafael.Pascual Linux - Newbie 1 05-30-2009 02:02 PM
RTAI - Can't compile simple.c with gcc (hello world program) mario-vallejo Linux - General 1 04-23-2008 09:13 AM
Creating an RPM package? WeNdeL Linux - Software 3 03-05-2003 10:30 AM

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

All times are GMT -5. The time now is 02:11 PM.

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