dongpao1926 2019-02-08 02:58
浏览 504

rpmbuild php包无法创建目录权限,然后%install

I want to custom build a php rpm package, but I have some problem in the %install time, errors show as follows:

Build complete.
Don't forget to run 'make test'.

+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.JrATF9
+ umask 022
+ cd /home/work/rpmbuild/BUILD
+ '[' /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64 '!=' / ']'
+ rm -rf /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
++ dirname /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ mkdir -p /home/work/rpmbuild/BUILDROOT
+ mkdir /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ cd php-7.3.2
+ rm -rf /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ /usr/bin/mkdir -p /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64/usr/local/lib/php/extensions/no-debug-non-zts-20180731
+ /usr/bin/make install DESTDIR=/home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
mkdir: cannot create directory '/usr/local/lib/php': Permission denied
mkdir: cannot create directory '/usr/local/lib/php/extensions': No such file or directory
mkdir: cannot create directory '/usr/local/lib/php/extensions/no-debug-non-zts-20180731': No such file or directory
make: *** [install-modules] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.JrATF9 (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.JrATF9 (%install)

My php Spec file is here:

Name:           php
Version:        7.3.2
Release:        1%{?dist}

Source0:        %{name}-%{version}.tar.gz

BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root

%prep
%setup -q

%build
./configure --enable-fpm --enable-mbstring --with-pdo-mysql --without-sqlite3 --without-pdo-sqlite --with-openssl --with-zlib --with-curl --with-libdir=lib64

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

%{__mkdir} -p $RPM_BUILD_ROOT/usr/local/lib/php/extensions/no-debug-non-zts-20180731

%make_install

%files
%defattr(-,root,root)

%attr(0755,root,root) %dir /usr/local/lib/php
%attr(0755,root,root) %dir /usr/local/lib/php/extensions
%attr(0755,root,root) %dir /usr/local/lib/php/extensions/no-debug-non-zts-20180731

How can I create the /usr/local/lib/php permission or own the right permission ?

Any help you ?

  • 写回答

1条回答 默认 最新

  • doujiu8145 2019-02-09 13:38
    关注

    You're on the right track by not building as root! Try replacing the ./configure call with %{configure} which is a macro that will put in all the Red Hat flags they want (like checking for stack overflows, etc) as well as the DESTDIR flags and whatnot you need for it all to "just work." You're already (properly) using the %{make_install} macro so you're fine there.

    I would take out the mkdir call because the "make install" should cover that.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能