<div dir="ltr">i got it taken care of internally with this<br><br><span style="font-family:monospace,monospace">import sys<br>from os import environ, execv<br>hb_lib_path                = environ['HOME'] + '/HB/lib'<br>environ['GI_TYPELIB_PATH'] = hb_lib_path + '/girepository-1.0'<br>if environ.get('LD_LIBRARY_PATH') != hb_lib_path:<br>    environ['LD_LIBRARY_PATH'] = hb_lib_path<br>    execv(sys.argv[0], sys.argv)</span><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 2, 2016 at 10:04 PM, Behdad Esfahbod <span dir="ltr"><<a href="mailto:behdad@behdad.org" target="_blank">behdad@behdad.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Aug 2, 2016 at 6:15 PM, Kelvin Ma <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>> wrote:<br>
> Thank you that worked! I didn't know you could set LD_LIBRARY_PATH from the<br>
> terminal. But how do I make it so it automatically sets it in the script?<br>
<br>
</span>Either create a small shell-script that calls your app, or put the<br>
envvars in your ~/.bash_profile and reboot.  Google around for your<br>
distro and "how to set environment variable".<br>
<div class="HOEnZb"><div class="h5"><br>
> LD_LIBRARY_PATH=$HOME/HB/lib ./app.py doesn’t seem very user-friendly.<br>
><br>
> On Tue, Aug 2, 2016 at 8:05 PM, Behdad Esfahbod <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>> wrote:<br>
>><br>
>> Start with:<br>
>><br>
>> LD_LIBRARY_PATH=$HOME/HB/lib python sample.py<br>
>><br>
>> On Tue, Aug 2, 2016 at 4:20 PM, Kelvin Ma <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>><br>
>> wrote:<br>
>> > well what is the “right” way to do it then ?<br>
>> ><br>
>> > On Tue, Aug 2, 2016 at 7:05 PM, Behdad Esfahbod <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Whatever.<br>
>> >><br>
>> >> On Tue, Aug 2, 2016 at 3:42 PM, Kelvin Ma <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > No, environ['LD_LIBRARY_PATH'] = '/usr/local/lib/girepository-1.0'<br>
>> >> > with<br>
>> >> > harfbuzz installed in /usr/local works correctly, but<br>
>> >> > environ['LD_LIBRARY_PATH'] = '/home/kelvin/HB/lib/girepository-1.0'<br>
>> >> > with<br>
>> >> > harfbuzz installed in /home/kelvin/HB does not. That's the problem<br>
>> >> > i'm<br>
>> >> > having, harfbuzz in /usr/local works fine.<br>
>> >> ><br>
>> >> > On Tue, Aug 2, 2016 at 6:34 PM, Behdad Esfahbod <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> On Tue, Aug 2, 2016 at 3:31 PM, Kelvin Ma<br>
>> >> >> <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > environ['LD_LIBRARY_PATH'] = '/usr/local/lib/girepository-1.0'<br>
>> >> >><br>
>> >> >> Try:<br>
>> >> >> environ['LD_LIBRARY_PATH'] = '/usr/local/lib'<br>
>> >> >><br>
>> >> >> At any rate, I don't think setting LD_LIBRARY_PATH from current<br>
>> >> >> process affects the process itself.  You need to set this before<br>
>> >> >> calling python.  And that's all the help I can offer on this issue.<br>
>> >> >> Someone else told you exactly this before.<br>
>> >> >><br>
>> >> >> > environ['GI_TYPELIB_PATH'] = '/usr/local/lib/girepository-1.0'<br>
>> >> >> ><br>
>> >> >> > from gi.repository import HarfBuzz as hb<br>
>> >> >> > from gi.repository import GLib<br>
>> >> >> ><br>
>> >> >> > fontdata = open(sys.argv[1], 'rb').read ()<br>
>> >> >> > text = sys.argv[2]<br>
>> >> >> > # Need to create GLib.Bytes explicitly until this bug is fixed:<br>
>> >> >> > # <a href="https://bugzilla.gnome.org/show_bug.cgi?id=729541" rel="noreferrer" target="_blank">https://bugzilla.gnome.org/show_bug.cgi?id=729541</a><br>
>> >> >> > blob = hb.glib_blob_create (GLib.Bytes.new (fontdata))<br>
>> >> >> > face = hb.face_create (blob, 0)<br>
>> >> >> > del blob<br>
>> >> >> > font = hb.font_create (face)<br>
>> >> >> > upem = hb.face_get_upem (face)<br>
>> >> >> > del face<br>
>> >> >> > hb.font_set_scale (font, upem, upem)<br>
>> >> >> > hb.ot_font_set_funcs (font)<br>
>> >> >> ><br>
>> >> >> > buf = hb.buffer_create ()<br>
>> >> >> > class Debugger(object):<br>
>> >> >> >     def message (self, buf, font, msg, data, _x_what_is_this):<br>
>> >> >> >         print(msg)<br>
>> >> >> >         return True<br>
>> >> >> > debugger = Debugger()<br>
>> >> >> > hb.buffer_set_message_func (buf, debugger.message, 1, 0)<br>
>> >> >> ><br>
>> >> >> > hb.buffer_add_utf32 (buf, array.array('I', text.encode('utf-32')),<br>
>> >> >> > 0,<br>
>> >> >> > -1)<br>
>> >> >> ><br>
>> >> >> > hb.buffer_guess_segment_properties (buf)<br>
>> >> >> ><br>
>> >> >> > hb.shape (font, buf, [])<br>
>> >> >> > del font<br>
>> >> >> ><br>
>> >> >> > infos = hb.buffer_get_glyph_infos (buf)<br>
>> >> >> > positions = hb.buffer_get_glyph_positions (buf)<br>
>> >> >> ><br>
>> >> >> > for info,pos in zip(infos, positions):<br>
>> >> >> >     gid = info.codepoint<br>
>> >> >> >     cluster = info.cluster<br>
>> >> >> >     x_advance = pos.x_advance<br>
>> >> >> >     x_offset = pos.x_offset<br>
>> >> >> >     y_offset = pos.y_offset<br>
>> >> >> ><br>
>> >> >> >     print("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance,<br>
>> >> >> > x_offset,<br>
>> >> >> > y_offset))<br>
>> >> >> ><br>
>> >> >> > This works correctly when Harfbuzz is installed in usr/local/.<br>
>> >> >> ><br>
>> >> >> > However, if I sudo make uninstall, run ./configure --with-gobject<br>
>> >> >> > --enable-introspection --prefix=/home/kelvin/HB, and make install,<br>
>> >> >> > and<br>
>> >> >> > change the environment variables to<br>
>> >> >> ><br>
>> >> >> > environ['LD_LIBRARY_PATH'] =<br>
>> >> >> > '/home/kelvin/HB/lib/girepository-1.0'<br>
>> >> >> > environ['GI_TYPELIB_PATH'] =<br>
>> >> >> > '/home/kelvin/HB/lib/girepository-1.0'<br>
>> >> >> ><br>
>> >> >> > The script crashes like this:<br>
>> >> >> ><br>
>> >> >> > ~$ ./hbt.py NocturnoDisplay-Bk.otf effectiveness<br>
>> >> >> > ./hbt.py:11: PyGIWarning: HarfBuzz was imported without specifying<br>
>> >> >> > a<br>
>> >> >> > version<br>
>> >> >> > first. Use gi.require_version('HarfBuzz', '0.0') before import to<br>
>> >> >> > ensure<br>
>> >> >> > that the right version gets loaded.<br>
>> >> >> >   from gi.repository import HarfBuzz as hb<br>
>> >> >> ><br>
>> >> >> > ** (process:7354): WARNING **: Failed to load shared library<br>
>> >> >> > 'libharfbuzz-gobject.so.0' referenced by the typelib:<br>
>> >> >> > libharfbuzz-gobject.so.0: cannot open shared object file: No such<br>
>> >> >> > file<br>
>> >> >> > or<br>
>> >> >> > directory<br>
>> >> >> > Segmentation fault (core dumped)<br>
>> >> >> ><br>
>> >> >> > And yes, libharfbuzz-gobject.so.o is in the folder:<br>
>> >> >> ><br>
>> >> >> > ~/HB/lib$ ls<br>
>> >> >> > girepository-1.0                  <a href="http://libharfbuzz.la" rel="noreferrer" target="_blank">libharfbuzz.la</a><br>
>> >> >> > <a href="http://libharfbuzz-gobject.la" rel="noreferrer" target="_blank">libharfbuzz-gobject.la</a>            libharfbuzz.so<br>
>> >> >> > libharfbuzz-gobject.so            libharfbuzz.so.0<br>
>> >> >> > libharfbuzz-gobject.so.0          libharfbuzz.so.0.10200.7<br>
>> >> >> > libharfbuzz-gobject.so.0.10200.7  pkgconfig<br>
>> >> >> ><br>
>> >> >> ><br>
>> >> >> > On Tue, Aug 2, 2016 at 5:52 PM, Behdad Esfahbod<br>
>> >> >> > <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>><br>
>> >> >> > wrote:<br>
>> >> >> >><br>
>> >> >> >> On Tue, Aug 2, 2016 at 2:42 PM, Kelvin Ma<br>
>> >> >> >> <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>><br>
>> >> >> >> wrote:<br>
>> >> >> >> > ok thanks, but when I rebuild and install into ~/HB using<br>
>> >> >> >> > harfbuzz<br>
>> >> >> >> > (and<br>
>> >> >> >> > changing the environment variables to the new directory)<br>
>> >> >> >> > doesn't<br>
>> >> >> >> > work. I<br>
>> >> >> >> > get<br>
>> >> >> >><br>
>> >> >> >> "doesn't work" is never enough.  It sure works for me.  Works for<br>
>> >> >> >> a<br>
>> >> >> >> thousand other people.  Only you can debug it.  For example, is<br>
>> >> >> >> libharfbuzz-gobject.so.o in ~/HB/lib?  If yes, is your<br>
>> >> >> >> LD_LIBRARY_PATH<br>
>> >> >> >> correctly set, try strace, does it look there, etc.<br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> > ** (kt.py:15896): WARNING **: Failed to load shared library<br>
>> >> >> >> > 'libharfbuzz-gobject.so.0' referenced by the typelib:<br>
>> >> >> >> > libharfbuzz-gobject.so.0: cannot open shared object file: No<br>
>> >> >> >> > such<br>
>> >> >> >> > file<br>
>> >> >> >> > or<br>
>> >> >> >> > directory<br>
>> >> >> >> ><br>
>> >> >> >> > and sometimes a bunch of other errors after it<br>
>> >> >> >> ><br>
>> >> >> >> > On Tue, Aug 2, 2016 at 5:31 PM, Behdad Esfahbod<br>
>> >> >> >> > <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>><br>
>> >> >> >> > wrote:<br>
>> >> >> >> >><br>
>> >> >> >> >> "make uninstall"<br>
>> >> >> >> >><br>
>> >> >> >> >> On Tue, Aug 2, 2016 at 2:28 PM, Kelvin Ma<br>
>> >> >> >> >> <<a href="mailto:kelvinsthirteen@gmail.com">kelvinsthirteen@gmail.com</a>><br>
>> >> >> >> >> wrote:<br>
>> >> >> >> >> > I want to move my harfbuzz installation out of root space<br>
>> >> >> >> >> > and<br>
>> >> >> >> >> > into<br>
>> >> >> >> >> > user<br>
>> >> >> >> >> > space, but I can't find uninstall info anywhere. How do I<br>
>> >> >> >> >> > uninstall<br>
>> >> >> >> >> > harfbuzz?<br>
>> >> >> >> >> ><br>
>> >> >> >> >> > _______________________________________________<br>
>> >> >> >> >> > HarfBuzz mailing list<br>
>> >> >> >> >> > <a href="mailto:HarfBuzz@lists.freedesktop.org">HarfBuzz@lists.freedesktop.org</a><br>
>> >> >> >> >> > <a href="https://lists.freedesktop.org/mailman/listinfo/harfbuzz" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
>> >> >> >> >> ><br>
>> >> >> >> >><br>
>> >> >> >> >><br>
>> >> >> >> >><br>
>> >> >> >> >> --<br>
>> >> >> >> >> behdad<br>
>> >> >> >> >> <a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
>> >> >> >> ><br>
>> >> >> >> ><br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >><br>
>> >> >> >> --<br>
>> >> >> >> behdad<br>
>> >> >> >> <a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
>> >> >> ><br>
>> >> >> ><br>
>> >> >><br>
>> >> >><br>
>> >> >><br>
>> >> >> --<br>
>> >> >> behdad<br>
>> >> >> <a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
>> >> ><br>
>> >> ><br>
>> >><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> behdad<br>
>> >> <a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
>> ><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> behdad<br>
>> <a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
behdad<br>
<a href="http://behdad.org/" rel="noreferrer" target="_blank">http://behdad.org/</a><br>
</font></span></blockquote></div><br></div>