2

When building an RPM from existing source code, I'm getting the following error:

/usr/bin/strip: unable to copy file '/home/vagrant/temp/BUILDROOT/python3-3.4.3-1.el6.x86_64/usr/lib/libpython3.4m.a'; reason: Permission denied

When I look at the permissions for this file, it has no Write permission.

-r-xr-xr-x 1 vagrant vagrant 12823866 May 14 17:33 libpython3.4m.a

I've tried setting the permission in the %files section:

%attr(0644,root,root) /usr/lib/libpython3.4m.a

But this has no effect.

When does the stripping process occur, and how can I fix the file so it can be stripped, before the stripping operation occurs?

Dan
  • 316
  • 2
  • 10
  • strip'd be somewhere in the compile phase. depending on how things are being built, this might be something you have to fix at the underlying makefile/build instructions level, and not in the rpm. – Marc B May 14 '15 at 17:53
  • 2
    The stripping happens wherever in the build process it is being run. Probably in `%build` if that is par of the build itself or during packaging at the end (if this is part of the `-debug` rpm creation). In either case you need to fix the permissions in `%build` or `%install`. The `%files` section just controls what the permissions are on disk once the rpm is installed. – Etan Reisner May 14 '15 at 17:54

1 Answers1

1

The configure script creates a Makefile. In that Makefile is the following:

# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED= ${INSTALL} -m 555

I'm no automake expert, so there may be some option to adjust this. However, instead I do this in my %install section of the spec file

%install
sed -i 's/INSTALL_SHARED= ${INSTALL} -m 555/INSTALL_SHARED= ${INSTALL} -m 755'/ $RPM_BUILD_DIR/Python-%{version}/Makefile
make install DESTDIR=$RPM_BUILD_ROOT

Additionally, since I was building python I also needed to turn off the rpm brp-python-bytecompile part of the post install. I found this on the fedora mailing list and the credit goes to David Malcom @ RedHat. Here is the original thread - you can put it at the top of your spec file:

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
mikew
  • 912
  • 2
  • 11
  • 22