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