RPM Packaging Problems

Build errors

unrecognized option –tag=CXX’ Try libtool –help’ for more information

The macro is part of the macro (check with ), and because there is a version mismatch, things will break. blackPanther OS uses , while KDE uses . Version doesn’t understand , so it breaks.

On top of your specfile, you can define this:

%define __libtoolize    /bin/true

When you add this define, won’t be run, and all should go well.

Binaries have a strange i586-blackPanther-linux- prefix!

add (notice there is nothing after the equal sign) to the call;

alternatively, add to the call.

You can also try to use , with

Libraries don’t have the “so” (libfoo.0.0.0 instead of libfoo.so.0.0.0)

This is related to too.

%define __libtoolize    /bin/true

will solve this issue.

No X display available

Some packages require the availability of an X display during the package build. If no interaction is needed, this can be solved with Xvfb: just add

BuildRequires: x11-server-xvfb

and run the command with xvfb-run, e.g.

xvfb-run make check

undefined reference to `xxx’

Since May 2008, packages are built with ld flag –no-undefined to prevent underlinking shared libraries.

gcc -shared foo.o -ldl /usr/lib/libglib-2.0.so /usr/lib/libXext.so ... -Wl,--no-undefined -o .libs/libkeymouselistener.so
.libs/keymouselistener.o: In function `parse_line':
.../gdm-2.20.6/gui/modules/keymouselistener.c:410: undefined reference to `XKeysymToKeycode'
collect2: ld returned 1 exit status

Check underlinking to understand how to faix.

Missing %files for subpackage xxx

Since June 2008, subpackage xxx with no raises a fatal error. It
helps to detect dead subpackages, or typos in .spec file.

It also occurs in valid spec files, when “%files xxx” appears inside a . The fix is to put the whole section inside a .

format not a string literal and no format arguments

Since December 2008, things like printf(error_message) instead of printf("%s", error_message) are detected by which is used by default. The reason for this error is described on the following Wikipedia page: format string attack

Example of error:

fud.c:72: error: format not a string literal and no format arguments

simple fixes

The fix can be something like:

-      printf(xkblayouttext);
+      printf("%s", xkblayouttext);
-      syslog(LOG_ERR, error_message(r));
+      syslog(LOG_ERR, "%s", error_message(r));
-   snprintf(id_resp_command, MAXIDVALUELEN, *argv);
+   snprintf(id_resp_command, MAXIDVALUELEN, "%s", *argv);

(another example: nautilus fix)

C++ code

Beware of C++ objects:

  QCString msgText = substitute(outputFormat, "$file", fileSubst) + '\n';
fprintf(warnFile, msgText);

simply doing fprintf(warnFile, "%s", msgText) would introduce a crash, as warned by gcc:

message.cpp:150: warning: cannot pass objects of non-POD type 'class QCString' through '...'; call will abort at runtime
message.cpp:150: warning: format '%s' expects type 'char*', but argument 3 has type 'int'

You must explicitly cast to (const char *):

fprintf(warnFile, "%s", (const char *) msgText);

or simpler:

fputs(msgText, warnFile);

escaping by hand

Beware of weird code like (from doxygen):

  QCString msgText = substitute(substitute(outputFormat, "$file", fileSubst),
"%", "%%") + '\n';
fprintf(warnFile, msgText);

Doing fputs(msgText, warnFile) modifies the program’s behaviour since % will be displayed %% since % is escaped in msgText. The correct fix is to also get rid of the %s escaping:

  QCString msgText = substitute(outputFormat, "$file", fileSubst) + '\n';
fputs(msgText, warnFile);

but you can also disable the warning (see below) and keep the code unchanged, since the code is valid (even if ugly).

disabling this warning

If the code is valid, you can disable the check using

The use of is inpired by Debian Hardening and Ubuntu CompilerFlags which use to detect such issues. But warnings are not enough (especially since blackPanther OS does not keep build logs), so blackPanther OS chose to enforce it by making such warnings fatal.

error: possibly undefined macro: AM_ACLOCAL_INCLUDE

Fix is to replace AM_ACLOCAL_INCLUDE call in or with ACLOCAL_AMFLAGS variable in .
For example, if has AM_ACLOCAL_INCLUDE(macros), remove it and add this to :

ACLOCAL_AMFLAGS = -I macros

conflicting types for `getline’

A file includes /usr/include/stdio.h but at the same time defines a local getline function. Fix is to rename the local getline, e.g. ‘parseline’. You may do this automatically with this command:

perl -pi -e 's|getline|parseline|' path/to/src/*.c

Empty Debug Files

Some packages do not have any Debug Files. This will result in the build error “error: Empty %files file …/debugfiles.list”. Fix this by preventing the build or install steps from stripping the binaries (by removing a -s flag or a strip command, if present) or add the -g flag (to cause the compiler to generate the debug info to begin with). If the package has no binaries, then it should be changed to a noarch package. If all else fails, add this to prevent this error:

%define debug_package %{nil}

build warnings

overlinking

To reduce overlinking, rpm can display some warnings alike:

Warning: unused libraries in /usr/bin/xdm: /usr/lib/libXext.so.6 /usr/lib/libXt.so.6 /usr/lib/libSM.so.6 /usr/lib/libXpm.so.4 /usr/lib/libxcb-xlib.so.0 /usr/lib/libxcb.so.1

Check overlinking to understand how to fix.

underlinking

To reduce underlinking, rpm can display some warnings alike:

Warning: undefined symbols in /usr/lib/libgmodule-1.2.so.0.0.10: g_free g_thread_functions_for_glib_use g_threads_got_initialized ...

Check underlinking to understand how to fix.

rpm loop warnings

LOOP warnings from tsort relations

Example:
warning: LOOP:
warning: removing libdrakx-net-0.94-1.1.noarch “Requires: /usr/share/locale/fr/LC_MESSAGES” from tsort relations.
warning: removing harddrake-13.52-1.i586 “Requires: drakxtools-curses = 13.52-1” from tsort relations.
warning: removing drakxtools-curses-13.52-1.i586 “Requires(hint): drakx-net-text” from tsort relations.
warning: removing drakx-net-text-0.94-1.1.noarch “Requires: libdrakx-net = 0.94” from tsort relations.

  • What is a Tsort relation?

The set of ordered dependencies, before rpm installation, so if rpm installation order is not correct, this may result in broken installations, it is important to prevent these erros in order to have a more robust installation system.

  • How to solve the error?

Remove unnecessary circular dependencies when encountered.

Often the loops may be harmless, but sometimes they might cause packages to be installed in the wrong order, ie. like one package requiring a specific user for ownership of directories which are created by another package, or maybe running a script requiring a file from another package that due to dependency loop gets installed only after the script is attempted to run..

  • In practical, how to solve this?

Edit the spec file of the application to remove unnecessary circular dependencies.

check errors

Rpmlint errors

script-without-shebang

This executable text file does not contain a shebang (#!/bin/sh), thus it cannot be properly executed. Often this is a sign of spurious executable bits for a non-script file, but can also be a case of a missing shebang. To fix this error, find out which case of the above it is by looking at the top of the file, and either remove the executable bits or add the shebang.

Add sh shebang:

Add Perl shebang:

Add Python shebang:

no-signature

The package was not signed with a gpg key. You need to use after having built it. This is not a problem if you plan to send the rpm to contribs or another packaging project, as they usually resign the package with the project key. You can ignore it in config.

binary-or-shlib-defines-rpath

‘The binary or shared library defines the PATH’. Usually this is a bad thing because it hard codes the path to search libraries and so it makes it difficult to move libraries around. Most likely you will find a Makefile with a line like: .

If the program uses , you can probably add (verify with to see if the option is available).

You can look at the Debian wiki for more information.

If you can not change that easily, you can use on the given file at the end of . If you do so, do not forget to add a to your .

configure-without-libdir-spec

This usually happens when you don’t use the or macro to call the script. They run with predefined default options, so the files get installed in the right location. You can ignore the error if the sources contain a script that wasn’t generated by .

explicit-lib-dependency

Don’t include dependencies like “Requires: libdvdread3” in your file. Library dependencies are managed automatically, so if your program is linked against , the package will be an automatic dependency. Also, this isn’t portable to architectures like amd64, where the package is named . If you really need a library dependency, e.g. to force the upgrade to a new version, use the virtual name provided by that package, in this example “Requires: libdvdread”.

invalid-directory-reference

Don’t include files in or in your package.

lib-package-without-%mklibname

If you split out library packages, you should use the macro to generate the name of the library package. Further information on the usage of are in the library policy section.

no-prereq-on

Example error: no-prereq-on rpm-helper

Solution: Add “Requires(pre): rpm-helper“, “Requires(preun): rpm-helper” as needed to the package.

prereq-use

Example error: prereq-use rpm-helper

Solution: prereq-use is no longer used, you should use Requires(stage) instead with stage in }. For example: Requires(post): rpm-helper

no-signature

Packages get signed during upload process, so just ignore this or add into your .

Rpmlint Warnings

spurious-executable-perm

From an unexperienced packager :

It can happen for example for doc files (README, COPYING, etc…) that have executable permissions in the source tarball.
To solve this you have to fix the permissions, for example in the %build section.

dangling-relative-symlink

The relative symbolic link points nowhere. If you are sure the pointed file will be there (e.g. you require the package containing it) you can safely ignore this. Else, just fix it 🙂

invalid-packager

The packager tag is incorrect. It needs to be the same as the option Packager. By default, uses a regexp: ‘@blackPanthersoft.com|@linux-blackPanther.com|@blackPanther.org|https?://blackPanthersoft.com|http://www.blackPantherexpert.com’, found in ( search DEFAULT_PACKAGER ). This is not a problem if you send your package to contribs, as the packager tags should be replaced when the package is rebuilt, unless you added it in the files.

incoherent-init-script-name

The init script name should be the same as the package name in lower case.

no-default-runlevel

The default runlevel isn’t specified in the init script. You need to add a line like the following one in the header of the init script:

# chkconfig: 2345 04 70

2345 are the default runlevels. When installed, the package will be started on runlevel 2, 3, 4 and 5, and stopped for 1 and 6. 04 and 70 are starting order and stopping order. See Initscript Howto for more information.

postin-without-ghost-file-creation

You tagged a file with but did not create it in nor in

Upload errors

You have not built your package with the changes from the previous package

debug packages

packages are built per default in Cauldron, but sometimes this won’t apply so you need a way to turn it off. To disable packages you have to add this two definitions (either when calling rpmbuild, into your or into the file):

%define _enable_debug_packages %{nil}
%define debug_package          %{nil}

Packaging

This page is a Wiki! Log in or register an account to edit.
admin

About admin