Re: rpm cpio error: prelink and SBCL

2009-12-21 Thread Jerry James
> FWIW, this didn't work.  It solved the problem with generating
> uninstallable RPMs, but the binary RPM contains a pristine SBCL image.
>  I know a good image was dumped, because it is executed during the
> build to generate some auxiliary files.  I see it running in the log,
> so something about the binary RPM generation stripped out all the
> built stuff and threw it away.  So far, the only successful build came
> from a spec file with this entry:
>
> %global __prelink_undo_cmd %{nil}

Nope, ignore that.  The real problem is that the dumped image is being
stripped.  So to successfully build a project that uses SBCL to
generate a dumped executable, I have to:
(1) Add an explicit requires on the version of SBCL that creates the image;
(2) Use an unprelinked copy of the SBCL binary to build; and
(3) Disable stripping of the dumped image.

This is probably the case for at least some of the other Common Lisps.
 Who approves changes to the Lisp packaging requirements page?
-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-21 Thread Jerry James
On Thu, Dec 17, 2009 at 2:09 PM, Jerry James  wrote:
> On Thu, Dec 17, 2009 at 1:54 PM, Jakub Jelinek  wrote:
>> You need to first prelink -u on a copy of the program, then
>> run it and let it dump itself, then package it up.
>
> Ah, thanks.

FWIW, this didn't work.  It solved the problem with generating
uninstallable RPMs, but the binary RPM contains a pristine SBCL image.
 I know a good image was dumped, because it is executed during the
build to generate some auxiliary files.  I see it running in the log,
so something about the binary RPM generation stripped out all the
built stuff and threw it away.  So far, the only successful build came
from a spec file with this entry:

%global __prelink_undo_cmd %{nil}

-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-17 Thread Jerry James
On Thu, Dec 17, 2009 at 1:54 PM, Jakub Jelinek  wrote:
> You need to first prelink -u on a copy of the program, then
> run it and let it dump itself, then package it up.

Ah, thanks.

> I'd actually argue that such packaging is broken anyway, because you didn't
> compile the binary you are packaging from source, you copied it from
> /usr/bin.

True, so future sbcl updates wouldn't be reflected in the saved image.
 How should I deal with that?  I can think of a few approaches.

1. Put an explicit versioned dependency on the sbcl used to build.
Then every sbcl update breaks upgrades for anyone with my package
installed until I get around to rebuilding it.  It looks like maxima
has taken this approach.

2. Don't dump an executable, but instead store individual FASL files
that are loaded at runtime by whatever version of sbcl happens to be
installed.  The application I'm working with did not take this
approach because of the large size of the application, which would
lead to a significant startup delay.  Plus, the SBCL documentation
explicitly doesn't guarantee that FASL files generated by one version
can be loaded and used without error by another version.

3. Compile sbcl AND the application I really want to build from
source.  Not only will that make my spec file significantly more
complex, but then I have to stay on top of future sbcl updates so I
can update my package, too.  That doesn't seem any better than what
I'm doing now (embedding the existing sbcl binary into my
application).

Even with its faults, #1 seems best to me.  Does anybody see another
approach that will work better?
-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-17 Thread Jakub Jelinek
On Thu, Dec 17, 2009 at 01:48:20PM -0700, Jerry James wrote:
> On Thu, Dec 17, 2009 at 11:24 AM, Jerry James  wrote:
> > So this is going to hit anybody who tries to package up an executable
> > produced by SBCL.  Perhaps this should be noted on
> > https://fedoraproject.org/wiki/Packaging:Lisp.
> 
> And it's even worse than I thought: "prelink -u saved-image" strips
> out the dumped Lisp image!  I had a saved image go from 43MB to 171552
> bytes when I did that.  It looks like putting this in the spec file
> works:

You need to first prelink -u on a copy of the program, then
run it and let it dump itself, then package it up.

I'd actually argue that such packaging is broken anyway, because you didn't
compile the binary you are packaging from source, you copied it from
/usr/bin.

Jakub

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-17 Thread Jerry James
On Thu, Dec 17, 2009 at 11:24 AM, Jerry James  wrote:
> So this is going to hit anybody who tries to package up an executable
> produced by SBCL.  Perhaps this should be noted on
> https://fedoraproject.org/wiki/Packaging:Lisp.

And it's even worse than I thought: "prelink -u saved-image" strips
out the dumped Lisp image!  I had a saved image go from 43MB to 171552
bytes when I did that.  It looks like putting this in the spec file
works:

%global __prelink_undo_cmd %{nil}

-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-17 Thread Jerry James
On Thu, Dec 17, 2009 at 10:12 AM, yersinia  wrote:
> You probably have a prelinked file in BUILD ROOT (objdump -s  |
> grep prelink) . Try to get rid of this in %install with prelink -u

Oh ho!  The sbcl executable has already been prelinked.  When
save-lisp-and-die is called (at least with :executable t), the sbcl
executable itself is dumped with the Lisp core written into it.  So we
wind up with a prelinked image in the build directory, like so:

--
$ objdump -s /usr/bin/sbcl | grep -F prelink
Contents of section .gnu.prelink_undo:
$ sbcl
This is SBCL 1.0.30-2.fc12, an implementation of ANSI Common Lisp.
More information about SBCL is available at .

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (defun my-fun () "Isn't this fun?")

MY-FUN
* (save-lisp-and-die "sbcl-test" :executable t)
[undoing binding stack and other enclosing state... done]
[saving current Lisp image into sbcl-test:
writing 6176 bytes from the read-only space at 0x2000
writing 4064 bytes from the static space at 0x2010
writing 42983424 bytes from the dynamic space at 0x10
done]
$ objdump -s sbcl-test | grep -F prelink
Contents of section .gnu.prelink_undo:
--

So this is going to hit anybody who tries to package up an executable
produced by SBCL.  Perhaps this should be noted on
https://fedoraproject.org/wiki/Packaging:Lisp.
-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Re: rpm cpio error: prelink and SBCL

2009-12-17 Thread yersinia
On Thu, Dec 17, 2009 at 5:13 PM, Jerry James  wrote:
> Is that due to prelink?  If so, what is broken?  SBCL, because it
You probably have a prelinked file in BUILD ROOT (objdump -s  |
grep prelink) . Try to get rid of this in %install with prelink -u

Regards

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


rpm cpio error: prelink and SBCL

2009-12-17 Thread Jerry James
I'm trying to package up a Common Lisp application that is built with
SBCL.  Near the end of the rpmbuild run, I see this right before the
list of Provides:

prelink: 
/home/jamesjer/rpmbuild/BUILDROOT/pvs-sbcl-4.2-2.svn20091008.fc12.x86_64/usr/lib64/pvs/bin/ix86_64-Linux/runtime/pvs-sbclisp:
Section .gnu.version created after prelinking

The rpmbuild run appears to complete successfully.  However, when I
try to rpm -i the resulting rpm, I get this:

# rpm -i pvs-sbcl-4.2-2.svn20091008.fc12.x86_64.rpm
error: unpacking of archive failed on file
/usr/lib64/pvs/bin/ix86_64-Linux/runtime/pvs-sbclisp;4b2a52f1: cpio:
Digest mismatch
# rpm -K pvs-sbcl-4.2-2.svn20091008.fc12.x86_64.rpm
pvs-sbcl-4.2-2.svn20091008.fc12.x86_64.rpm: sha1 md5 OK

Is that due to prelink?  If so, what is broken?  SBCL, because it
isn't putting a .gnu.version section in the executable images it
creates?  Prelink, because it somehow manages to break the rpm?  Both?
 And how do I build an RPM that can be installed successfully?

Thanks,
-- 
Jerry James
http://www.jamezone.org/

-- 
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list