unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: 38112@debbugs.gnu.org
Subject: bug#38112: guile's recompilation does not play well with release builds
Date: Thu, 7 Nov 2019 23:34:17 +0000	[thread overview]
Message-ID: <20191107233417.5be99aab@sf> (raw)

I'll start from a failure where I found it out.

What I observed:
  I had guix-0.13 installed systemwide. Then I attempted to install
  guix-0.14 by unpacking/building it Bbuild failed with obscure errors
  about missing required functions

Why I think it failed:
  When guix-0.13 was built and installed among other things my system
  got compiled file as:
    '/usr/lib64/guile/2.2/site-ccache/guix/modules.go'

  When I unpacked guix-0.14 it's source file timestamps were preserved
  by unpack process. Specifically 'guix/modules.scm' was older than system's
  '/usr/lib64/guile/2.2/site-ccache/guix/modules.go'

  As a result guix build attempted to pull in parts of 0.13 release into 0.14
  build process.

  It looks like the main problem is in libguile/load.c:compiled_is_fresh():
    https://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=libguile/load.c;h=e95c36db1d670f0c7091aba080e21deb53bbab4f;hb=HEAD#l558

   567   if (source_mtime.tv_sec < compiled_mtime.tv_sec
   568       || (source_mtime.tv_sec == compiled_mtime.tv_sec
   569           && source_mtime.tv_nsec <= compiled_mtime.tv_nsec))
   570     compiled_is_newer = 1;

  Here 'mtime(.scm) < mtime(.go)' is enough to avoid recompilation.

The workaround:
  Currently Gentoo just 'touch'es source tarball at unpacking time to guarantee
  the rebuild as:
    https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=651f557f9302d29aa0de5ea10ef4e575b686fb21

  It is unfortunate and would require changing every package.

  The build failure is easily reproducible. I can try to craft artificial example
  to ease debugging if needed.

Probable fix:
  I think guile should embed/check more data about source file to hit the cache.
  The examples would be:
  1. size of source file
  2. hash of source file contents
  3. hash of parsed source file
  4. use 'mtime(.scm) == mtime(.go)' as a cache hit hint (would require faking
    mtime on a .go file)

Thank you!

-- 

  Sergei





                 reply	other threads:[~2019-11-07 23:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191107233417.5be99aab@sf \
    --to=slyfox@gentoo.org \
    --cc=38112@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).