http://wiki.rosalab.com/ru/index.php?title=Problems_and_issues_with_packaging&feed=atom&action=history
Problems and issues with packaging - История изменений
2024-03-29T10:13:10Z
История изменений этой страницы в вики
MediaWiki 1.26.4
http://wiki.rosalab.com/ru/index.php?title=Problems_and_issues_with_packaging&diff=8371&oldid=prev
D uragan в 19:52, 29 мая 2013
2013-05-29T19:52:44Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='ru'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Предыдущая</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Версия 19:52, 29 мая 2013</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Строка 1:</td>
<td colspan="2" class="diff-lineno">Строка 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Packaging Guidelines]]</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Packaging Guidelines]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{{<del class="diffchange diffchange-inline">introduction</del>|This page describes some common problems based by maintainers when packaging software for ROSA Linux}}</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{<ins class="diffchange diffchange-inline">Введение</ins>|This page describes some common problems based by maintainers when packaging software for ROSA Linux}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>__TOC__</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>__TOC__</div></td></tr>
</table>
D uragan
http://wiki.rosalab.com/ru/index.php?title=Problems_and_issues_with_packaging&diff=5348&oldid=prev
D uragan: + autotools notes
2012-02-10T11:07:19Z
<p>+ autotools notes</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='ru'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Предыдущая</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Версия 11:07, 10 февраля 2012</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l111" >Строка 111:</td>
<td colspan="2" class="diff-lineno">Строка 111:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>If the code is valid, you can disable the check using {{macro|%define Werror_cflags %nil}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>If the code is valid, you can disable the check using {{macro|%define Werror_cflags %nil}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The use of {{cmd|<nowiki>-Werror=format-security</nowiki>}}  is inpired by [http://wiki.debian.org/Hardening Debian Hardening] and [http://wiki.ubuntu.com/CompilerFlags Ubuntu CompilerFlags] which use  {{cmd|<nowiki>-Wformat-security</nowiki>}} to detect such issues<del class="diffchange diffchange-inline">. But warnings are not enough (especially since Mandriva does not keep build logs), so Mandriva chose to enforce it by making such warnings fatal</del>.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The use of {{cmd|<nowiki>-Werror=format-security</nowiki>}}  is inpired by [http://wiki.debian.org/Hardening Debian Hardening] and [http://wiki.ubuntu.com/CompilerFlags Ubuntu CompilerFlags] which use  {{cmd|<nowiki>-Wformat-security</nowiki>}} to detect such issues.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== error: possibly undefined macro: AM_ACLOCAL_INCLUDE ==</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">== Autotools problems ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If you experience problems with autotools stuff, you should first ensure that you follow the [[Autotools recommendations]] in your spec files.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">=== libtool version mismatch ===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">If you get the error like</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><pre></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">libtool: You should recreate aclocal.m4 with macros from libtool x.y.z</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"></pre></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">you should regenerate files created by autotools and shipped with upstream sources (see [[Autotools recommendations]] for details).</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">=</ins>== error: possibly undefined macro: AM_ACLOCAL_INCLUDE <ins class="diffchange diffchange-inline">=</ins>==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Fix is to replace AM_ACLOCAL_INCLUDE call in {{file|configure.in}} or {{file|configure.ac}} with ACLOCAL_AMFLAGS variable in {{file|Makefile.am}}.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Fix is to replace AM_ACLOCAL_INCLUDE call in {{file|configure.in}} or {{file|configure.ac}} with ACLOCAL_AMFLAGS variable in {{file|Makefile.am}}.</div></td></tr>
</table>
D uragan
http://wiki.rosalab.com/ru/index.php?title=Problems_and_issues_with_packaging&diff=5322&oldid=prev
D uragan: ROSA packaging problems page
2012-02-09T11:21:30Z
<p>ROSA packaging problems page</p>
<p><b>Новая страница</b></p><div>[[Category:Packaging Guidelines]]<br />
{{introduction|This page describes some common problems based by maintainers when packaging software for ROSA Linux}}<br />
<br />
__TOC__<br />
<br />
= build errors =<br />
<br />
== No X display available ==<br />
<br />
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 <pre>BuildRequires: x11-server-xvfb</pre> and run the command with xvfb-run, e.g. <pre>xvfb-run make check</pre><br />
<br />
== undefined reference to `xxx' ==<br />
<br />
In ROSA Linux, packages are built with ld flag --no-undefined to prevent [[underlinking]] shared libraries.<br />
<br />
<pre><br />
gcc -shared foo.o -ldl /usr/lib/libglib-2.0.so /usr/lib/libXext.so ... -Wl,--no-undefined -o .libs/libkeymouselistener.so<br />
.libs/keymouselistener.o: In function `parse_line':<br />
.../gdm-2.20.6/gui/modules/keymouselistener.c:410: undefined reference to `XKeysymToKeycode'<br />
collect2: ld returned 1 exit status<br />
</pre><br />
<br />
Check [[underlinking]] to understand how to fix.<br />
<br />
== Missing %files for subpackage foo ==<br />
<br />
Subpackage {{pkg|foo}} with no {{macro|%files foo}} raises a fatal error. It<br />
helps to detect dead subpackages, or typos in .spec file.<br />
<br />
It also occurs in valid spec files, when "%files foo" appears inside a {{macro|%if %ccc ... %endif}}. The fix is to put the whole {{macro|%package foo}} section inside a {{macro|%if %ccc ... %endif}}.<br />
<br />
== format not a string literal and no format arguments ==<br />
<br />
In modern gcc, things like <tt>printf(error_message)</tt> instead of <tt>printf("%s", error_message)</tt> are detected by {{cmd|<nowiki>-Werror=format-security</nowiki>}} which is used by default. The reason for this error is described on the following Wikipedia page: [http://en.wikipedia.org/wiki/Format_string_attack format string attack]<br />
<br />
Example of error:<br />
<pre><br />
fud.c:72: error: format not a string literal and no format arguments<br />
</pre><br />
<br />
===simple fixes===<br />
<br />
The fix can be something like:<br />
<br />
<pre><br />
- printf(xkblayouttext);<br />
+ printf("%s", xkblayouttext);<br />
</pre><br />
<br />
<pre><br />
- syslog(LOG_ERR, error_message(r));<br />
+ syslog(LOG_ERR, "%s", error_message(r));<br />
</pre><br />
<br />
<pre><br />
- snprintf(id_resp_command, MAXIDVALUELEN, *argv);<br />
+ snprintf(id_resp_command, MAXIDVALUELEN, "%s", *argv);<br />
</pre><br />
<br />
(another example: [http://svn.gnome.org/viewvc/nautilus/trunk/libnautilus-private/nautilus-mime-actions.c?r1=14811&r2=14810&pathrev=14811 nautilus fix])<br />
<br />
===C++ code===<br />
<br />
Beware of C++ objects:<br />
<br />
<pre><br />
QCString msgText = substitute(outputFormat, "$file", fileSubst) + '\n';<br />
fprintf(warnFile, msgText);<br />
</pre><br />
<br />
simply doing <tt>fprintf(warnFile, "%s", msgText)</tt> would introduce a crash, as warned by gcc:<br />
<br />
<pre><br />
message.cpp:150: warning: cannot pass objects of non-POD type 'class QCString' through '...'; call will abort at runtime<br />
message.cpp:150: warning: format '%s' expects type 'char*', but argument 3 has type 'int'<br />
</pre><br />
<br />
You must explicitly cast to <tt>(const char *)</tt>: <br />
<br />
<pre><br />
fprintf(warnFile, "%s", (const char *) msgText);<br />
</pre><br />
<br />
or simpler:<br />
<br />
<pre><br />
fputs(msgText, warnFile);<br />
</pre><br />
<br />
===code doing <tt>%</tt> escaping by hand===<br />
<br />
Beware of weird code like (from doxygen):<br />
<br />
<pre><br />
QCString msgText = substitute(substitute(outputFormat, "$file", fileSubst),<br />
"%", "%%") + '\n';<br />
fprintf(warnFile, msgText);<br />
</pre><br />
<br />
Doing <tt>fputs(msgText, warnFile)</tt> modifies the program's behaviour since <tt>%</tt> will be displayed <tt>%%</tt> since <tt>%</tt> is escaped in msgText. The correct fix is to also get rid of the <tt>%s</tt> escaping:<br />
<br />
<pre><br />
QCString msgText = substitute(outputFormat, "$file", fileSubst) + '\n';<br />
fputs(msgText, warnFile);<br />
</pre><br />
<br />
but you can also disable the warning (see below) and keep the code unchanged, since the code is valid (even if ugly).<br />
<br />
===disabling this warning===<br />
<br />
If the code is valid, you can disable the check using {{macro|%define Werror_cflags %nil}}<br />
<br />
The use of {{cmd|<nowiki>-Werror=format-security</nowiki>}} is inpired by [http://wiki.debian.org/Hardening Debian Hardening] and [http://wiki.ubuntu.com/CompilerFlags Ubuntu CompilerFlags] which use {{cmd|<nowiki>-Wformat-security</nowiki>}} to detect such issues. But warnings are not enough (especially since Mandriva does not keep build logs), so Mandriva chose to enforce it by making such warnings fatal.<br />
<br />
== error: possibly undefined macro: AM_ACLOCAL_INCLUDE ==<br />
<br />
Fix is to replace AM_ACLOCAL_INCLUDE call in {{file|configure.in}} or {{file|configure.ac}} with ACLOCAL_AMFLAGS variable in {{file|Makefile.am}}.<br />
For example, if {{file|configure.in}} has AM_ACLOCAL_INCLUDE(macros), remove it and add this to {{file|Makefile.am}}:<br />
<pre>ACLOCAL_AMFLAGS = -I macros</pre><br />
<br />
== conflicting types for `getline' ==<br />
<br />
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:<br />
<pre>perl -pi -e 's|getline|parseline|' path/to/src/*.c</pre><br />
<br />
= build warnings =<br />
<br />
== overlinking ==<br />
<br />
To reduce [[overlinking]], rpm can display some warnings alike:<br />
<br />
<pre><br />
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<br />
</pre><br />
<br />
Check [[overlinking]] to understand how to fix.<br />
<br />
== underlinking ==<br />
<br />
To reduce [[underlinking]], rpm can display some warnings alike:<br />
<br />
<pre><br />
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 ...<br />
</pre><br />
<br />
Check [[underlinking]] to understand how to fix.<br />
<br />
== rpm loop warnings ==<br />
<br />
=== LOOP warnings from tsort relations ===<br />
<br />
Example:<br />
warning: LOOP:<br />
warning: removing libdrakx-net-0.94-1.1.noarch "Requires: /usr/share/locale/fr/LC_MESSAGES" from tsort relations.<br />
warning: removing harddrake-13.52-1.i586 "Requires: drakxtools-curses = 13.52-1" from tsort relations.<br />
warning: removing drakxtools-curses-13.52-1.i586 "Requires(hint): drakx-net-text" from tsort relations.<br />
warning: removing drakx-net-text-0.94-1.1.noarch "Requires: libdrakx-net = 0.94" from tsort relations.<br />
<br />
* What is a Tsort relation?<br />
<br />
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.<br />
<br />
* How to solve the error?<br />
<br />
Remove unnecessary circular dependencies when encountered.<br />
<br />
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..<br />
<br />
* In practical, how to solve this?<br />
<br />
Edit the spec file of the application to remove unnecessary circular dependencies.<br />
<br />
If not possible, add the dependency detection to [https://qa.mandriva.com/show_bug.cgi?id=62264| this bug report in bugzilla] or create a new bug linking to it.<br />
<br />
= Rpmlint errors =<br />
<br />
Rpmlint errors and warnings are described in a [[Rpmlint Errors|separate page]]<br />
<br />
= See Also =<br />
* This page is partially inspired by [http://wiki.mandriva.com/en/Problems_and_issues_with_packaging Mandriva's packaging problems] page.</div>
D uragan