2017-03-28 11:52 GMT+02:00 Ludovic Courtès <ludo@gnu.org>:
Howdy!

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> when defining a new package, I often find myself spending *a lot* of
> time debugging and tweaking the build. E.g. the if the Makefile needs to
> be modified, or some test-cases adjusted.
>
> How do I "get into" the build container, so I can debug, modify files,
> rebuild and run tests there - in a closed environment (nearly) like the
> build-daemon has?

Most of the time, you don’t need to get into a container.  In those
cases, it’s enough to do:

  guix build -K foo
  # build fails…
  cd /tmp/guix-build-foo.drv-0
  source ./environment-variables
  cd foo-1.2
  …

In some cases (for example when you have tests that fail in the build
environment but succeed once you’ve followed the steps above), you
really need a container similar to that created by guix-daemon.  In that
case, do:

  guix build -K foo
  # build fails…
  cd /tmp/guix-build-foo.drv-0
  guix environment -C foo --ad-hoc strace gdb
  rm /bin/sh           # to be really like in the guix-daemon environment
  source ./environment-variables
  cd foo-1.2
  $GUIX_ENVIRONMENT/bin/strace -f -o log make check
  …

That would probably make a good “Debugging Build Failures” section.



This is important information and it's more detailed than what Pjotr wrote in his wrap up

I'd do it myself but I don't know the first thing about the info system

Which is the source file ?
How do I compile it ?
Which Emacs mode should I use ?