Re: [Nix-dev] sbcl image executables and patch-elf

2015-05-12 Thread Eike

Hi Tomas,

thank you for the explanation. I'm not familiar at all with the C world
as you just saw.

Regards
Eike

Tomas Hlavaty  writes:

> Hi Eike,
>
>> I just found out that this is the strip utility from binutils and I'm
>> wondering how it can do such a harm…
>
> strip does what it is supposed to do.  In the usual C world, executables
> can contain lots of other information, e.g. debugging symbols etc.
> strip removes this additional information while it is not usually needed
> on production systems and take significant amount of space.
>
> However, you tried to create a self-contained sbcl executable
> application in one executable file.  This means that the lisp image
> (usually a separate file) is concatenated to the executable file.  If
> you run strip on this executable, it will remove the lisp image,
> breaking the application.
>
> Cheers,
>
> Tomas
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] sbcl image executables and patch-elf

2015-05-12 Thread Tomas Hlavaty
Hi Eike,

> I just found out that this is the strip utility from binutils and I'm
> wondering how it can do such a harm…

strip does what it is supposed to do.  In the usual C world, executables
can contain lots of other information, e.g. debugging symbols etc.
strip removes this additional information while it is not usually needed
on production systems and take significant amount of space.

However, you tried to create a self-contained sbcl executable
application in one executable file.  This means that the lisp image
(usually a separate file) is concatenated to the executable file.  If
you run strip on this executable, it will remove the lisp image,
breaking the application.

Cheers,

Tomas
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] sbcl image executables and patch-elf

2015-05-11 Thread Eike

Hi Thomas,

thanks for your reply; somehow I missed your response as yet. I just
found out that this is the strip utility from binutils and I'm wondering
how it can do such a harm…

Thanks again
Eike

Tomas Hlavaty  writes:

> Hi Eike,
>
>> I'm making a program in common lisp using sbcl. I then create a
>> executable image which results in quite a big file since the whole
>> lisp is packaged up. When I use nix to build this app, the file that
>> ends up in nix-store is tiny and not working. It seems to me that the
>> patch-elf process is stripping things off, but that's just a guess.
>
> try:
>
>dontStrip = true;
>
> in your build expression.
>
> Cheers,
>
> Tomas

--
gpg: AD7AC35E
finger print: 137F BB0B 1639 D25F DC5D  E59C B412 C5F5 AD7A C35E
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] sbcl image executables and patch-elf

2015-05-11 Thread Tomas Hlavaty
Hi Eike,

> I'm making a program in common lisp using sbcl. I then create a
> executable image which results in quite a big file since the whole
> lisp is packaged up. When I use nix to build this app, the file that
> ends up in nix-store is tiny and not working. It seems to me that the
> patch-elf process is stripping things off, but that's just a guess.

try:

   dontStrip = true;

in your build expression.

Cheers,

Tomas
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] sbcl image executables and patch-elf

2015-05-11 Thread Eike

Hi there,

I'm making a program in common lisp using sbcl. I then create a
executable image which results in quite a big file since the whole lisp
is packaged up. When I use nix to build this app, the file that ends up
in nix-store is tiny and not working. It seems to me that the patch-elf
process is stripping things off, but that's just a guess.

Here is a mini example. Install sbcl and do this

$ echo '(defun main () (format t "Hello World!~%"))' > hello.lisp
$ sbcl --load hello.lisp --eval '(sb-ext:save-lisp-and-die "hello" :toplevel 
(lambda() (main) 0) :executable t)'

then there is a 'hello' executable with about 50mb. Running it prints
the message to stdout.

The same process in a 'hello/default.nix' like this:

{ pkgs ? import  {} }:
pkgs.stdenv.mkDerivation {
  name = "hello-0.0.1";
  src = ./.;
  buildPhase = ''
echo '(defun main () (format t "Hello World!~%"))' > hello.lisp
${pkgs.sbcl}/bin/sbcl --load hello.lisp --eval 
'(sb-ext:save-lisp-and-die "hello" :toplevel (lambda() (main) 0) :executable t)'
ls -lha *
  '';
  installPhase = ''
mkdir -p $out/bin
cp hello $out/bin
  '';
}

Building it with 'nix-build hello' produces this:

these derivations will be built:
  /nix/store/7f6dp34myppgf3r0nfkdcxkinwp81g16-hello-0.0.1.drv
building path(s) ‘/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1’
building /nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1
unpacking sources
unpacking source archive /nix/store/dxk9zf3zd78j63g8ysbfsnmwwsf1gb02-hello
source root is hello
patching sources
configuring
no configure script, doing nothing
building
This is SBCL 1.2.5.nixos, 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.
[undoing binding stack and other enclosing state... done]
[saving current Lisp image into hello:
writing 5680 bytes from the read-only space at 0x2000
writing 3120 bytes from the static space at 0x2010
writing 50462720 bytes from the dynamic space at 0x10
done]
-rw-r--r-- 1 nixbld1 nixbld 410 May 11 08:11 default.nix
-rwxr-xr-x 1 nixbld1 nixbld 49M May 11 08:11 hello
-rw-r--r-- 1 nixbld1 nixbld  44 May 11 08:11 hello.lisp
installing
post-installation fixup
patching ELF executables and libraries in 
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1/bin/hello
gzipping man pages in 
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1
stripping (with flags -S) in 
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1/bin
patching script interpreter paths in 
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1
/nix/store/2rhdmlbiklrrsh660ix0db415xyi46wn-hello-0.0.1

The hello executable was 49M after building it. But the one in nix-store
is this:

l -lha result/bin   

~
insgesamt 272K
dr-xr-xr-x 2 root nixbld 4,0K  1. Jan 1970  .
dr-xr-xr-x 3 root nixbld 4,0K  1. Jan 1970  ..
-r-xr-xr-x 6 root root   262K  1. Jan 1970  hello

What' wrong here?

Thanks in advance!
Eike
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev