1

我正在尝试为 Fedora Linux “rpm-build -ba”一个包(Pike),这是我第一次执行此过程,但我不断收到此错误:

"Bad exit status from /var/tmp/rpm-tmp.hI2V3W (%install)"

据我所知,事情开始变得很糟糕:

"Installing Pike in /~/rpmbuild/BUILDROOT/pike7.8-7.8.866-1.0.fc21.x86_64/usr, please wait...

Could not resolve Getopt. (Perhaps the installed pike tree has been moved.)
lib/master.pike:3406: master()->main_resolv("Getopt",UNDEFINED)"

这里是 SPEC 文件:

# Notes:
#
#  This package contains the  major.minor version of Pike, in order
#  to permit the parallel installation of multiple releases at the
#  same time (for example, 7.6 and 7.8.) Documentation, including
#  the module reference may be found in  /usr/share/doc/pike-VERSION.
# 
#  the most recent stable version of pike will be available
#  as /usr/bin/pike, in addition to /usr/bin/pikeMAJOR.MINOR.
#
#  this behavior is managed by alternatives(8).
#
#  This file is based on pike.spec from repoforge, and has been fairly 
#  extensively modified. The original repoforge content appears to be
#  new BSD licensed, though this is not spelled out in individual files
#  or in any adjoining material. It would be good to clarify this.

%{?fc4:%define _without_modxorg 1}
%{?el4:%define _without_modxorg 1}
%{?fc3:%define _without_modxorg 1}
%{?fc2:%define _without_modxorg 1}
%{?fc1:%define _without_modxorg 1}
%{?el3:%define _without_modxorg 1}
%{?rh9:%define _without_modxorg 1}
%{?rh7:%define _without_modxorg 1}
%{?el2:%define _without_modxorg 1}
%{?rh6:%define _without_modxorg 1}
%{?yd3:%define _without_modxorg 1}

%{?fc1:%define _without_xorg 1}
%{?el3:%define _without_xorg 1}
%{?rh9:%define _without_xorg 1}
%{?rh8:%define _without_xorg 1}
%{?rh7:%define _without_xorg 1}
%{?el2:%define _without_xorg 1}
%{?rh6:%define _without_xorg 1}
%{?yd3:%define _without_xorg 1}

%define real_name Pike
%define real_version v7.8.866
%define relnum 7.8
%define myname pike
%define shared_docs %{_docdir}/%{myname}-%{version}
%define debug_package %{nil}

Summary: Pike is a general purpose dynamic programming language with a syntax similar to Java and C.
Name: pike%{relnum}
Version: 7.8.866
Release: 1.0%{?dist}
License: GPL/LGPL/MPL
Group: Development/Languages
URL: http://pike.ida.liu.se/

Source: http://pike.ida.liu.se/download/pub/pike/all/%{version}/Pike-v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires: nettle-devel, gmp-devel, autoconf
BuildRequires: gdbm-devel, gettext, zlib-devel, nasm, fftw-devel
BuildRequires: mysql-devel
BuildRequires: sane-backends-devel, ffmpeg-devel
BuildRequires: freetype-devel, libjpeg-devel, libtiff-devel
BuildRequires: pcre-devel, bzip2-devel, freeglut-devel, gtk2-devel, libgnomeui-devel
BuildRequires: SDL-devel, pkgconfig, gtkglarea2-devel
BuildRequires: SDL_mixer-devel, librsvg2-devel
BuildRequires: chrpath

%if 0%{?_without_modxorg:1}
%{?_without_xorg:BuildRequires: XFree86-devel, XFree86-Mesa-libGLU}
%{!?_without_xorg:BuildRequires: xorg-x11-devel, xorg-x11-Mesa-libGLU}
%else
BuildRequires: libXt-devel, mesa-libGLU-devel
%endif

%description
Pike is a general purpose programming language, which means that you can put
it to use for almost any task. Its application domain spans anything from
the world of the Net to the world of multimedia applications, or
environments where your shell could use some spicy text processing or system
administration tools.

%package devel
Summary: Header files, libraries and development documentation for %{myname}.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
This package contains the header files, static libraries and development
documentation for %{myname}. If you like to develop programs using %{myname},
you will need to install %{name}-devel.

%package odbc
Summary: ODBC driver module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: unixODBC

%description odbc
This package contains support for ODBC database access for %{myname}.

%package freetype
Summary: Freetype module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: freetype

%description freetype
This package contains support for Freetype 2 (TTF) rendering in %{myname}.

%package ffmpeg
Summary: Ffmpeg module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: ffmpeg

%description ffmpeg
This package contains support for Ffmpeg in %{myname}.

%package svg
Summary: SVG Image module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: librsvg2

%description svg
This package contains support for SVG rendering in %{myname}.

%package mysql
Summary: mysql driver module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: mysql

%description mysql
This package contains support for mysql database access for %{myname}.

%package sdl
Summary: SDL (Simple Direct Media Layer) module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: SDL SDL_mixer

%description sdl
This package contains support for using SDL in %{myname}.

%package sane
Summary: SANE (Scanner Access Now Easy) module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: sane-backends

%description sane
This package contains support for using SANE scanners in %{myname}.

%package gl
Summary: OpenGL module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: mesa-libGLU freeglut

%description gl
This package contains support for using OpenGL in %{myname}.

%package gtk2
Summary: GTK2 module for %{myname}.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: gtk2, gtkglarea2, libgnomeui

%description gtk2
This package contains support for using GTK2 in %{myname}.

%prep
%setup -n %{real_name}-%{real_version}

%build
STARTPWD=`pwd`
cd src
./run_autoconfig
mkdir ../build; cd ../build
${STARTPWD}/src/configure \
  --prefix=/usr 
%{__make}
%{__make} documentation
%install buildroot="%{buildroot}"
%{__rm} -rf %{buildroot}
cd build
%{__make} buildroot="%{buildroot}" install INSTALLARGS="buildroot='%{buildroot}' lib_prefix='/usr/lib/%{name}' include_prefix='/usr/include/%{name}' --traditional"

chrpath --delete %{buildroot}%{_libdir}/%{name}/modules/Mysql.so
chrpath --delete %{buildroot}%{_libdir}/%{name}/modules/Postgres.so
chrpath --delete %{buildroot}%{_libdir}/%{name}/modules/Odbc.so

%{__mkdir_p} %{buildroot}%{_bindir}
%{__mkdir_p} %{shared_docs}
%{__rm} -rf %{buildroot}/usr/doc
%{__mv} %{buildroot}/usr/bin/pike %{buildroot}%{_bindir}/%{name}
%{__mv} %{buildroot}/usr/bin/pike.syms %{buildroot}%{_bindir}/%{name}.syms
%{__mv} %{buildroot}/usr/bin/rsif %{buildroot}%{_bindir}/rsif%{relnum}
%{__install} -d -m0755 %{buildroot}%{_mandir}/man1/

# we should make the documentation directory a macro, really.
%{__mkdir_p} %{buildroot}%{_docdir}/%{myname}-%{version}
cd ..
%{__cp} ANNOUNCE CHANGES COMMITTERS COPYING COPYRIGHT README README-CVS %{buildroot}%{shared_docs}
%{__mv} refdoc/modref %{buildroot}%{shared_docs}
%{__mv} refdoc/traditional_manual %{buildroot}%{shared_docs}

cd build
./pike "-DPRECOMPILED_SEARCH_MORE" "-m./master.pike" -x rsif -r "/usr/local/bin/pike" "%{_bindir}/%{name}" %{buildroot} 

%post
/sbin/ldconfig 2>/dev/null
alternatives --install %{_bindir}/%{myname} %{myname} %{_bindir}/%{name} 1

%postun
/sbin/ldconfig 2>/dev/null

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%doc %{_mandir}/man?/*
%{shared_docs}/*
%exclude %{_libdir}/%{name}/modules/Odbc.so
%exclude %{_libdir}/%{name}/modules/SDL.so
%exclude %{_libdir}/%{name}/modules/SANE.so
%exclude %{_libdir}/%{name}/modules/Mysql.so
%exclude %{_libdir}/%{name}/modules/___GTK2.so
%exclude %{_libdir}/%{name}/modules/GL.so
%exclude %{_libdir}/%{name}/modules/GLUT.so
%exclude %{_libdir}/%{name}/modules/_Image_SVG.so
%exclude %{_libdir}/%{name}/modules/_Image_FreeType.so
%exclude %{_libdir}/%{name}/modules/_Ffmpeg.so

%{_bindir}/*
%{_libdir}/%{name}

%files devel
%defattr(-, root, root, 0755)
%{_includedir}/%{name}

%files odbc
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/Odbc.so

%files sdl
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/SDL.so

%files sane
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/SANE.so

%files gtk2
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/___GTK2.so

%files svg
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/_Image_SVG.so

%files ffmpeg
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/_Ffmpeg.so

%files mysql
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/Mysql.so

%files freetype
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/_Image_FreeType.so

%files gl
%defattr(-, root, root, 0755)
%{_libdir}/%{name}/modules/GL.so
%{_libdir}/%{name}/modules/GLUT.so

你能帮助我吗?谢谢你的时间!

4

2 回答 2

0

在您可以使用 rpmbuild 编译软件包之前,您必须以 root 身份发出命令(安装您要构建的给定软件包的所有软件包依赖项)

yum-builddep 你想要编译的包名称

IE

百胜奶酪

yum-utils 软件包中包含 yum-builddep 命令,所以如果您还没有安装 yum-utils,请先安装它。

无论如何,您似乎没有 .spec 文件中可用的所有依赖项,因此首先尝试以 root 身份发出命令

yum-builddep 派克

然后,如果使用“rpmbuild -ba”的编译无论如何都没有成功,请以 root 身份发出命令

百胜安装 util-linux

您将要安装的软件包 util-linux 包含二进制文件 /bin/getopt,它允许可执行文件(甚至是 pike 中的可执行文件,甚至是 rpmbuild 调用的可执行文件)解析命令行参数。

然后你应该能够毫无问题地发出“rpmbuild -ba pike”命令。

于 2015-03-29T13:56:10.223 回答
0

规格文件一定是错误的。它有一个没有用标签getopt正确定义的要求(对于某些语言) 。(此时唯一的其他答案)假设一切都很好,因为这是它将使用的相同标签。%BuildRequiresyum

于 2015-05-30T17:28:25.540 回答