Rpm build errors %prep

rpm build errors %prep

iO4dbi (%prep) RPM build errors: Could not execute local: rpmbuild --define '_sourcedir /home/fede/src/sprers.eu'. When packages are built, various %buildroot directories are created here. This is useful for investigating a failed build if the logs output do not provide. rpmbuild --rebuild SymSnap/sprers.eu --define='_topdir Executing (%prep): /bin/sh -e /var/tmp/sprers.eu10n RPM Build error.

Related Videos

npm run build command #npm#run#build#npmrunbuild#command #npmcommand

Rpm build errors %prep - criticism

How to create a RPM Package

Sometimes you might have access to an open source application source code but might not have the RPM file to install it on your system.

In that situation, you can either compile the source code and install the application from source code, or build a RPM file from source code yourself, and use the RPM file to install the application.

There might also be a situation where you want to build a custom RPM package for the application that you developed.

This tutorial explains how to build a RPM package from the source code.

In order to build RPMs, you will need source code, which usually means a compressed tar file that also includes the SPEC file.

The SPEC file typically contains instructions on how to build RPM, what files are part of package and where it should be installed.

The RPM performs the following tasks during the build process.

  1. Executes the commands and macros mentioned in the prep section of the spec file.
  2. Checks the content of the file list
  3. Executes the commands and macros in the build section of the spec file. Macros from the file list is also executed at this step.
  4. Creates the binary package file
  5. Creates the source package file

Once the RPM executes the above steps, it creates the binary package file and source package file.

The binary package file consists of all source files along with any additional information to install or uninstall the package.

It is usually enabled with all the options for installing the package that are platform specific. Binary package file contain complete applications or libraries of functions compiled for a particular architecture. The source package usually consists of the original compressed tar file, spec file and the patches which are required to create the binary package file.

Let us see how to create a simple source and BIN RPM packages using a tar file.

If you are new to rpm package, you may first want to understand how to use rpm command to install, upgrade and remove packages on CentOS or RedHat.

1. Install rpm-build Package

To build an rpm file based on the spec file that we just created, we need to use rpmbuild command.

rpmbuild command is part of rpm-build package. Install it as shown show below.

rpm-build is dependent on the following package. If you don&#x;t have these installed already, yum will automatically install these dependencies for you.

2. RPM Build Directories

rpm-build will automatically create the following directory structures that will be used during the RPM build.

Note: The above directory structure is for both CentOS and RedHat when using rpmbuild package. You can also use /usr/src/redhat directory, but you need to change the topdir parameter accordingly during the rpm build. If you are doing this on SuSE Enterprise Linux, use /usr/src/packages directory.

If you want to use your own directory structure instead of the /root/rpmbuild, you can use one of the following option:

  • Use &#x;buildroot option and specify the custom directory during the rpmbuild
  • Specify the topdir parameter in the rpmrc file or rpmmacros file.

3. Download Source Tar File

Next, download the source tar file for the package that you want to build and save it under SOURCES directory.

For this example, I&#x;ve used the source code of icecase open source application, which is a server software for streaming multi-media. But, the steps are exactly the same for building RPM for any other application. You just have to download the corresponding source code for the RPM that you are trying to build.

4. Create the SPEC File

In this step, we direct RPM in the build process by creating a spec file. The spec file usually consists of the following eight different sections:

  1. Preamble &#x; The preamble section contains information about the package being built and define any dependencies to the package. In general, the preamble consists of entries, one per line, that start with a tag followed by a colon, and then some information.
  2. %prep &#x; In this section, we prepare the software for building process. Any previous builds are removed during this process and the source file(.tar) file is expanded, etc.
  3. One more key thing is to understand there are pre-defined macros available to perform various shortcut options to build rpm. You may be using this macros when you try to build any complex packages. In the below example, I have used a macro called %setup which removes any previous builds, untar the source files and changes the ownership of the files. You can also use sh scripts under %prep section to perform this action but %setup macro simplifies the process by using predefined sh scripts.
  4. %description &#x; the description section usually contains description about the package.
  5. %build &#x; This is the section that is responsible for performing the build. Usually the %build section is an sh script.
  6. %install &#x; the % install section is also executed as sh script just like %prep and %build. This is the step that is used for the installation.
  7. %files &#x; This section contains the list of files that are part of the package. If the files are not part of the %files section then it wont be available in the package. Complete paths are required and you can set the attributes and ownership of the files in this section.
  8. %clean &#x; This section instructs the RPM to clean up any files that are not part of the application&#x;s normal build area. Lets say for an example, If the application creates a temporary directory structure in /tmp/ as part of its build, it will not be removed. By adding a sh script in %clean section, the directory can be removed after the build process is completed.

Here is the SPEC file that I created for the icecast application to build an RPM file.

In %build section, you will see the CFLAGS with configure options that defines the options that can be using during RPM installation and the prefix option , mandatory directory to be present for the installation and sysconfig directory under which the system files needs to be copied over.

Below that line, you will see the make utility which determines the list of files needs to be compiled and compiles them appropriately.

In % install section, the line below the %install that says make install is used to take the binaries compiled from the previous step and installs or copies them to the appropriate locations so they can be accessed.

5. Create the RPM File using rpmbuild

Once the SPEC file is ready, you can start building your rpm with rpm &#x;b command. The &#x;b option is used to perform all the phases of the build process. If you see any errors during this phase, then you need to resolve it before re-attempting again. The errors will be usually of library dependencies and you can download and install it as necessary.

Note: If you are using SuSE Linux, if rpmbuild is not available, try using rpm -ba to build the rpm package.

During the above rpmbuild install, you might notice the following error messages:

Error 1: XSLT configuration could not be found

Solution 1: Install libxstl-devel

For the xslt-config, you need to install libxstl-devel package as shown below.

This will also install the following dependencies:

  • libgcrypt
  • libgcrypt-devel
  • libgpg-error-devel

Error 2: libvorbis Error

checking for libvorbis configure: error: must have Ogg Vorbis v or above installed error: Bad exit status from /var/tmp/rpm-tmp.m4Gk3f (%build)

Solution 2: Install libvorbis-devel

For the Ogg Vorbis v, install the libvorbis-devel package as shown below:

This will also install the following dependencies:

  • libogg
  • libogg-devel
  • libvorbis

6. Verify the Source and Binary RPM Files

Once the rpmbuild is completed, you can verify the source rpm and binary rpm is created in the below directories.

7. Install the RPM File to Verify

As a final step, you can install the binary rpm to verify that it installs successfully and all the dependencies are resolved.

After the above installation, you can verify that your custom created rpm file was installed successfully as shown below.


4 More Discussions You Might Find Interesting

1. Red Hat

RPM packaging a directory of files

Hi, I wonder if anyone can point me in the right direction I have a requirement to distribute a set of admin scripts that currently sit in an SVN repo by packaging them up in an RPM so that they can me unpacked to the correct location by simply installing the package .. e.g. 'yum install (0 Replies)

Discussion started by: hcclnoodles

0 Replies

2. Linux

rpm packaging issue for unixodbc driver manager

Hi All, I am trying to make rpm package for unixODBC driver manager using below spec file. During rpmbuild i am getting the error. Can you pls advice how we can overcome this issue %define name unixODBC %define ver %define prefix /usr %define sysconfdir /etc %define libdir (2 Replies)

Discussion started by: kamauv

2 Replies

3. Shell Programming and Scripting

build rpm with SPEC file for packaging .jar and some .sh files..

Good day people, Hereby wish to have your advise for below: I have some .jar files, some script files (sprers.eu, sprers.eu) , and a sprers.eu file. Basically, the .jar files compute the operation of my system and define the working directory for my system. My current scenario: i trigger (1 Reply)

Discussion started by: cielle

1 Replies

4. Red Hat

RPM Packaging doubt!

Hi, I need to create an RPM package for my java application. Already build package for that application avail;able. I need to create binary RPM package for my java application. For that in spec file, do I need to write any script kind of thing to install my package. any one have idea (1 Reply)

Discussion started by: sprers.eu

1 Replies

All times are GMT The time now is PM.

Unix & Linux Forums Content Copyright All Rights Reserved.

Privacy Policy

Make rpm-package fails


Attempts to build an RPM package with "make rpm-package" fail

Steps to reproduce

  1. Clone the repository
  2. mkdir build
  3. cmake ..
  4. make rpm-package

What is the current bug behavior?

Make fails after setting things up, it looks like it's at the spot where it is about to do the actual building. The error is a failure to find a directory:

`-- Build files have been written to: /home/paul_koning/wireshark/build/packaging/rpm/BUILD/wireshark/build

  • make -j12 -C build make[4]: *** build: No such file or directory. Stop. error: Bad exit status from /var/tmp/sprers.eu6N (%prep)

RPM build errors: Bad exit status from /var/tmp/sprers.eu6N (%prep) make[3]: *** [CMakeFiles/sprers.eu CMakeFiles/rpm-package] Error 1 make[2]: *** [CMakeFiles/Makefile CMakeFiles/sprers.eu] Error 2 make[1]: *** [CMakeFiles/Makefile CMakeFiles/sprers.eu] Error 2 make: *** [Makefile rpm-package] Error 2 `

What is the expected correct behavior?

An RPM build.

Sample capture file


Relevant logs and/or screenshots

(Paste any relevant screenshots here)

Build information

-rSTAGE -bc -tp --recompile SOURCEPKG When invoked this way, rpmbuild installs the named source package, and does a prep, compile and install. In addition, --rebuild builds a new binary package. When the build has completed, the build directory is removed (as in --clean) and the the sources and spec file for the package are removed. These options are now superseded by the -r* options which allow much more fine control over what stages of the build to run. DYNAMIC BUILD DEPENDENCIES When the %generate_buildrequires stage runs and some of the newly generated BuildRequires are not satisfied, rpmbuild creates an intermediate source package ending in sprers.eu, which has the new BuildRequires, and exits with code This package can then be used in place of the original source package to resolve and install the missing build dependencies in the usual way, such as with dnf-builddep(8). Multiple layers of dynamic build dependencies may exist in a spec file; the presence of specific BuildRequires on the system may yield new BuildRequires next time a build is performed with the same source package. The easiest way to ensure that all dynamic build dependencies are satisfied is to run the -br command, install the new dependencies of the sprers.eu package and repeat the whole procedure until rpmbuild no longer exits with code If the -br command is coupled with --nodeps, exit code 11 is always returned and a sprers.eu package is always created. SHOWRC The command rpmbuild --showrc shows the values rpmbuild will use for all of the options are currently set in rpmrc and macros configuration file(s).

FILES         top

rpmrc Configuration /usr/lib/rpm/rpmrc /usr/lib/rpm/<vendor>/rpmrc /etc/rpmrc ~/.rpmrc Macro Configuration /usr/lib/rpm/macros /usr/lib/rpm/<vendor>/macros /etc/rpm/macros ~/.rpmmacros Temporary/var/tmp/rpm*

SEE ALSO         top

gendiff(1), popt(3), rpm(8), rpm2cpio(8), rpmkeys(8)rpmspec(8), rpmsign(8), rpmbuild --help - as rpm supports customizing the options via popt aliases it's impossible to guarantee that what's described in the manual matches what's available. sprers.eu <URL:sprers.eu>

AUTHORS         top

Marc Ewing <[email protected]> Jeff Johnson <[email protected]> Erik Troan <[email protected]>

COLOPHON         top

This page is part of the rpm (RPM Package Manager) project. Information about the project can be found at ⟨sprers.eu⟩. It is not known how to report bugs for this man page; if you know, please send a mail to [email protected] This page was obtained from the project's upstream Git repository ⟨sprers.eu⟩ on (At that time, the date of the most recent commit that was found in the repository was ) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected]

Pages that refer to this page: rpm(8),  rpmdb(8),  rpmdeps(8),  rpmkeys(8),  rpmsign(8),  rpmspec(8)