"Problem" when installing a RPM

Hi,

I’m trying to make my own rpm and I did so. It has succeeded to build the rpm and at the same time has installed it (rpmbuild -ba).
But when I build only the source and the binary and I try to install it with rpm -i *.rpm, it says it has installed the rpm, but it is nowhere and I can’t launch it.

When I try to “reinstall” it, it prompt me that the package is already installed…

Did someone have an answer ?

Thanks :slight_smile:

On 2013-10-24 19:46, kamikaz92 wrote:
>
> Hi,
>
> I’m trying to make my own rpm and I did so. It has succeeded to build
> the rpm and at the same time has installed it (rpmbuild -ba).
> But when I build only the source and the binary and I try to install it
> with rpm -i *.rpm, it says it has installed the rpm, but it is nowhere
> and I can’t launch it.

What can’t you launch, the install or your program?


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

I can’t launch the program, it says that it doesn’t exist.

When I enter

$ rpm -ivh test-1.0-1.x86_64.rpm

for example, “test” is installed but I can’t run it :

$ test(-1.0)
Command not found...]

So, why ? :wink:

Is the file really named ‘test(-1.0)’? (I doubt it)

You don’t tell us the files contained in test-1.0-1.x86_64.rpm

rpm -ql test-1.0

Maybe the executable is not in the path.

The rpm is called “test-1.0-1.x86_64.rpm” :

$ rpm -ivh /usr/src/packages/RPMS/x86_64/test-1.0-1.x86_64.rpm
Preparating...                       ################################# [100%]
Updating / installing...
   1:test-1.0-1                       ################################# [100%]
$ test-1.0
bash: /usr/local/bin/test-1.0: no such file or directory

Try getting debugging output when you do that:

Code:

set -x
test-1.0


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

The output :

$ test-1.0
+ test-1.0
bash: /usr/local/bin/test-1.0: no such file or directory
++ ppwd
++ true
$

Didn’t say anything helpful :slight_smile:

Here is my spec file :


#
# spec file for package 
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# ...]

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:          test
Version:        1.0
Release:       1
License:        MIT-like
Summary:     Test
Url:               -
Group:          System Environment/Libraries
Source:         test-1.0.tar.bz2
BuildRoot:     %{_tmppath}/%{name}-%{version}-build

%description
Test

%prep
%setup -q

%build
make

%install
%make_install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(755,root,root)

Have been on this for weeks

According to your spec file, the resulting rpm is empty, i.e. it contains no files. (run “rpm -ql test” to verify this as already was suggested)

You have to add the files that should be included in the rpm to the %files section.

Good point, I thought it already had included the executable file in the rpm when building it.

Now, how can I include this file ? It is in my “/usr/src/packages/SOURCES/test-1.0” directory and the %file section look in the “/usr/src/packages/BUILDROOT” directory. Does that mean I have to copy my rpm in the buildroot ?

Thank you

Well, apparently you never created an RPM before, have you? :wink:

Here’s an overview: Building RPMs
For this case, have a look at “6.8 Files” especially.

So in short: That “%make_install” in the %install section copies your files to buildroot (it “installs” them during the build). For the files to actually be in the RPM (and be copied by RPM into the system when you install it), you have to list those files in the %files section, as I already said.
F.e. let’s say, compiling your tarball results in a program /usr/bin/test (during the build with rpmbuild it will not be copied to /usr/bin/ but %buildroot/usr/bin/ instead, but just forget about that detail for now). For /usr/bin/test to be in the RPM, you would have a %files section like this:

%files
%defattr(755,root,root)
/usr/bin/test

There are rpm macros you can use though, so this could f.e. also be:

%files
%defattr(755,root,root)
%{_prefix}/bin/test

or

%files
%defattr(755,root,root)
%{_bindir}/test

You have to do this for all other files that are installed by “make install” as well. In fact if you build your RPM on OBS it will fail if it creates any files not listed in %files (rpmbuild should give a warning by default). If you specify a directory there, all the files in that directory get included as well.

HTH. Maybe also have a look at existing spec files.

Or just use “checkinstall” to create an RPM from the source tarball, you don’t need to write a spec file then.

Nope. You have right ^^

I did have a look, and I understood in 3 sec :slight_smile: I did found the same website but slightly different.

Now it works great.

Thank you very much

You’re welcome.
Btw, that documentation is included in the rpm package as well.
Just point your browser to /usr/share/doc/packages/rpm/RPM-HOWTO/index.html :wink: