Subject: Re: bug#36758: 27.0.50; Mac OS/Lucid/X11: crash with libharfbuzz

From: Simon Leinen <[email-masked]>
Date: Mon, 22 Jul 2019 13:19:20 +0200

YAMAMOTO Mitsuharu writes:
>> This is the same version of libharfbuzz that my Emacs binary uses:
>> 
>> : leinen@macsl[leinen]; objdump -macho -dylibs-used /var/tmp/emacs/gbuild/src/emacs
> (snip)
>> /opt/X11/lib/libfreetype.6.dylib (compatibility version 19.0.0, current version 19.6.0)

> I noticed the versions of libfreetype are different between the test
> program and Emacs.

Ah, good point - I hadn't noticed that!

> What happens if you link the test program with the latter one using
> the environment variable DYLD_LIBRARY_PATH ?

>   $ DYLD_LIBRARY_PATH=/opt/X11/lib ./a.out

Unfortunately it is not that easy:

  : leinen@macsl[tmp]; DYLD_LIBRARY_PATH=/opt/X11/lib ./a.out
  dyld: Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib
    Referenced from: /private/var/tmp/./a.out
    Reason: Incompatible library version: a.out requires version 24.0.0 or later, but libfreetype.6.dylib provides version 19.0.0
  Abort trap: 6

...but if I recompile the test program with -L/opt/X11/lib, then it
crashes:

  : leinen@macsl[tmp]; cc -g hb-ot-test.c -L/opt/X11/lib `pkg-config freetype2 harfbuzz --cflags --libs`
  : leinen@macsl[tmp]; objdump -macho -dylibs-used /var/tmp/a.out
  /var/tmp/a.out:
  	/opt/X11/lib/libfreetype.6.dylib (compatibility version 19.0.0, current version 19.6.0)
  	/usr/local/opt/harfbuzz/lib/libharfbuzz.0.dylib (compatibility version 20504.0.0, current version 20504.0.0)
  	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
  : leinen@macsl[tmp]; ./a.out
  HarfBuzz Version: 2.5.3
  Segmentation fault: 11

So I guess all I have to do is make sure Emacs doesn't use the old
libfreetype in /opt/X11/lib, but rather the newer one in /usr/local/lib
(and hope that that one works in an X11 environment...)

I'll be in meetings for the next few hours, but will let you know what
happens once I find time to do the above.

Thanks a lot so far!!!

Cheers,
-- 
Simon.