On this new arch install matlab seems to work pretty much out of the box except for the help browser which is apparently functional but not very pretty. Basically it looks like it is not applying CSS styles to the html. At the same time I get a bunch of java errors in the command window :
Exception in thread "XPCOMMessageLoop" java.lang.UnsatisfiedLinkError: /usr/local/MATLAB/R2017b/sys/jxbrowser/glnxa64/xulrunner/xulrunner-linux-64/libxul.so: /usr/lib/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.c(Unknown Source)
at com.teamdev.jxbrowser.gecko.xpcom.impl.linux.LinuxMozillaToolkit.a(Unknown Source)
at com.teamdev.jxbrowser.gecko.xpcom.MozillaToolkit.initialize(Unknown Source)
at com.teamdev.jxbrowser.gecko.xpcom.AppShellXPCOMThread$b.run(Unknown Source)
Notice that the errors seem to involve libharfbuzz again.
Looking around with the debug info, I found this thread on stack overflow with a solution.
The solution involves replacing the libfreetype.so.6 shipped with matlab with the one currently installed on the system. Either copy the file from /usr/lib, to <matlabroot>/bin/glnxa64/, symlink it or LD_PRELOAD it and the bug goes away. Interestingly, this trick is also on the wiki to solve a different problem.
Finally note that even though the problem is apparently related to jxbrowser, replacing the jxbrowser-chromium files as suggested in the wiki (about a different issue) does not solve this specific problem.
]]>Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
Does that give clues about what goes wrong (post them if needed) ?
]]>Otherwise I checked files opened by matlab when it works (using older versions of cairo and harfbuzz) and when it does not. In both cases, I run matlab with the -nodesktop option (so that it does not crash during startup) and then check opened files using lsof.
Here are the files opened by the working version and not by the crashing one:
*:31416
*:31516
/dev/pts/10
/dev/pts/10
/dev/pts/10
[eventfd]
/home/#######/java.log.16957
/home/#######/.local/share/mime/mime.cache
/run/media/#######/#######/R2017a/sys/java/jre/glnxa64/jre/lib/resources.jar
/run/media/#######/#######/R2017a/sys/java/jre/glnxa64/jre/lib/resources.jar
/tmp/hsperfdata_#######/16957
/tmp/.java_pid16957.tmp type=STREAM
/tmp/jna--1123374486/jna3717931278283588.tmp
type=STREAM
/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so
/usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so
/usr/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so
/usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so
/usr/lib/libatk-1.0.so.0.22409.1
/usr/lib/libcanberra-gtk.so.0.1.9
/usr/lib/libcanberra.so.0.2.5
/usr/lib/libdatrie.so.1.3.3
/usr/lib/libgdk_pixbuf-2.0.so.0.3600.9
/usr/lib/libgdk-x11-2.0.so.0.2400.31
/usr/lib/libgthread-2.0.so.0.5200.3
/usr/lib/libgtk-x11-2.0.so.0.2400.31
/usr/lib/libltdl.so.7.3.1
/usr/lib/libogg.so.0.8.2
/usr/lib/libpango-1.0.so.0.4000.12
/usr/lib/libpangocairo-1.0.so.0.4000.12
/usr/lib/libpangoft2-1.0.so.0.4000.12
/usr/lib/libpixman-1.so.0.34.0
/usr/lib/libpng16.so.16.32.0
/usr/lib/libtdb.so.1.3.12
/usr/lib/libthai.so.0.3.0
/usr/lib/libvorbisfile.so.3.3.7
/usr/lib/libvorbis.so.0.4.8
/usr/lib/libxcb-render.so.0.0.0
/usr/lib/libxcb-shm.so.0.0.0
/usr/lib/libXcomposite.so.1.0.0
/usr/lib/libXdamage.so.1.1.0
/usr/lib/libXrandr.so.2.2.0
/usr/local/lib/libcairo.so.2.11400.10
/usr/local/lib/libharfbuzz.so.0.10400.6
/usr/share/fonts/TTF/LiberationSans-Regular.ttf
/usr/share/fonts/Type1/Lucida MAC Bold.pfb
/usr/share/locale/en_GB/LC_MESSAGES/gdk-pixbuf.mo
/usr/share/locale/en_GB/LC_MESSAGES/gtk20.mo
/usr/share/locale/en_GB/LC_MESSAGES/gtk20-properties.mo
/usr/share/mime/mime.cache
and here are the files opened by the crashing version but not the working one
*:31415
*:31515
/dev/pts/7
/dev/pts/7
/dev/pts/7
/home/#######/java.log.21150
/tmp/hsperfdata_#######/21150
/tmp/.java_pid21150.tmp type=STREAM
/tmp/jna--1123374486/jna7321425067610395336.tmp
/usr/share/fonts/Type1/Lucida G.pfb
/usr/share/fonts/Type1/Lucida Gr Regular.pfb
/usr/share/fonts/Type1/MACGrande.pfb
A few observations:
it looks like the working version loads several more libraries than the crashing one. My guess is that the crashing one fails to load cairo and then any libraries that are loaded in the same code block or that depend on cairo. None of the extra libraries loaded by the working version come from foreign packages.
the working version loads one more jar: resources.jar. Maybe the issue is related to what may be loaded by that jar?
the fonts loaded by both versions are slightly different. The working one loads "Lucida MAC Bold" and "liberation sans" while the other one loads "Lucida G" "Lucida Gr Regular" and "MACGrande". All these fonts except the liberation-sans come from the ttf-mac-fonts AUR package. Sadly, removing it does not change anything to the problem. The liberation font is from a community package and is a bit more difficult to remove since quite a few packages depend on it.
So, there are some system fonts loaded by matlab but it looks like the problem could be elsewhere. Otherwise, there seems to be a problem with loading resources.jar but I am not sure how to check what is actually happening during the loading process.
]]>Or perhaps whether you have some font customizations (but I recall looking at matlab fonts on linux and they didn't really use system ones anyway).
]]>Matlab is indeed very self-contained and it defaults to using its own java version. I think the problem is more what the java runtime might be loading from the system. I tried to look at which libraries matlab may be loading (using ldd) but neither cairo or harfbuzz were there (they might be dependencies of some of the loaded libraries though). As for what the java runtime may be loading, I have no idea where to look.
]]>You may want to check pacman -Qm output for java-related packages, I only have the j{dk,re}6-compat packages listed there. As far as I can recall Matlab is very self-contained in general, but it seems yours is trying to use system libraries instead.
]]>Again, building cairo 1.14.10 locally (e.g. from https://www.cairographics.org/releases/ … .10.tar.xz ) and feeding it to matlab through LD_LIBRARY_PATH solves the issue.
Still this is getting annoying and I would really like to understand why it works for some users but not me or vectro. All I know is that it seems to be related to java (whatever version) but I am not sure how to dig deeper.
]]>It works both with MATLAB_JAVA set to java-8-openjdk and without.
]]>Otherwise, I also noticed that I get a GTK warning ( Unable to locate theme engine in module_path: "adwaita" ) when matlab works (harfbuzz <=1.4.6) but nothing when it does not. I have no idea if that could be related to the problem.
]]>However, there is another problem. Focusing on the problem itself, I’ve missed that we’re talking about proprietary software. You can’t rebuild it and as such you can do nothing except reporting the issue to MathWork and waiting patiently, praying they will care to fix it. At best you may build the alternative, older version of HarfBuzz into “/usr/local” and use LD_LIBRARY_PATH to manipulate MATLAB into searching for it in “/usr/local/lib”.
]]>I will try to do what you suggest and build a custom version in /usr/local. Is there a convenient way to do that with pacman? From what I see, the easiest seems to be using the --root option of pacman -U to install to a temporary location and then move the files to /usr/local manually. I guess it may also be useful to use the -b option so that the main database is not polluted. Am I on the right track?
]]>Also, I would be happy to read some thoughts regarding what my solution (downgrading harfbuzz) could be breaking for my Arch install.
This is a partial update — one of the main reasons Arch gets broken. If you downgrade, downgrade all the packages — not just one. Alternatively you may build a custom version of HarfBuzz and MATLAB into “/usr/local” and use that instead until the issue is fixed.
Downgrading one package may seem to work temporarily, but you do it at your own risk¹ and don’t expect any support if anything goes wrong.
If so, could you confirm if my solution works, so that I can add it to the wiki?
For the reasons stated above, I doubt it will be accepted into the wiki.
____
¹ No one here is a saint in that matter — but we are aware of the consequences.