Subject: Re: bug#22975: 25.0.92; CANNOT_DUMP build can't start in tty mode

From: Eli Zaretskii <[email-masked]>
Date: Thu, 10 Mar 2016 09:10:54 +0200

> From: Ken Raeburn <[email-masked]>
> Date: Thu, 10 Mar 2016 00:41:50 -0500
> 
> The emacs_abort call comes from bidi_initialize because the bidi_type_table result is nil.
> 
> 1097	    emacs_abort ();
> 1092	static void
> 1093	bidi_initialize (void)
> 1094	{
> 1095	  bidi_type_table = uniprop_table (intern ("bidi-class"));
> 1096	  if (NILP (bidi_type_table))
> 1097	    emacs_abort ();
> 1098	  staticpro (&bidi_type_table);
> 1099	
> 1100	  bidi_mirror_table = uniprop_table (intern ("mirroring"));
> 1101	  if (NILP (bidi_mirror_table))

A build that CANNOT_DUMP should load loadup.el at startup.  Does this
build do it?

When loadup.el is loaded it loads charprop.el.  Does thi happen with
this build?

When charprop.el loads, it runs this code:

  (define-char-code-property 'bidi-class "uni-bidi.el"
    "Unicode bidi class.
  Property value is one of the following symbols:
    L, LRE, LRO, LRI, R, AL, RLE, RLO, RLI, FSI, PDF, PDI,
    EN, ES, ET, AN, CS, NSM, BN, B, S, WS, ON")

When this code runs, it should load uni-bidi.el, which defines the
char-table accessed in the above snippet.

What I think happens in your case is that bidi_initialize is called
_before_ all of the above happens, probably because Emacs wants to
display some message in the echo area during loading loadup.el, or
maybe even earlier.  If so, the solution should be to disable bidi
until loadup is done, and turn it on afterwards.  One way of disabling
bidi is to (setq-default bidi-display-reordering nil) (or its C
equivalent) at the beginning of 'main', or maybe at the beginning of
loadup.el (if you can detect CANNOT_DUMP from Lisp).  Then turn it
back on when loadup.el finishes by setting bidi-display-reordering to
t.

Can you try that?