You are not logged in.

#1 2017-08-09 09:09:49

kragol
Member
Registered: 2016-03-24
Posts: 10

Matlab broken after recent update (July 2017). A possible solution

Matlab has recently stopped working after a system update. I am posting my solution here in case others may face the same issue. Also, I would be happy to read some thoughts regarding what my solution (downgrading harfbuzz) could be breaking for my Arch install.

When launching matlab from a terminal I got the following error message:

Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.

And when launched with the -nodesktop option, it reaches the command prompt but complains about some Java classes not working.

PostVMInit failed to initialize com.mathworks.mwswing.MJStartupForDesktop
PostVMInit failed to initialize com.mathworks.mwswing.MJStartup
PostVMInit failed to initialize com.mathworks.toolstrip.plaf.TSLookAndFeel

It then crashes as soon as a graphical window is opened.

I tried versions R2016b, R2017a and R2017b_prerelease with the same results. After investigating, I found out that the problem was likely due to an update of the harfbuzz package from version 1.4.6 to 1.4.7 (happened on 22/7/2017). Downgrading harfbuzz to version 1.4.6 (from May 2017) solved the problem for me.

Has anyone else had the same problem with matlab? If so, could you confirm if my solution works, so that I can add it to the wiki?

Offline

#2 2017-08-11 14:17:08

mpan
Member
Registered: 2012-08-01
Posts: 442
Website

Re: Matlab broken after recent update (July 2017). A possible solution

kragol wrote:

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.

kragol wrote:

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.


Sometimes I’m a bit harsh — don’t get offended too easily!
PGP: 7C848198AE93D3BB | Coreutils SHA2 performance
Russian roulette: curl "https://ptpb.pw/$(cat /dev/urandom | tr -cd [:alnum:] | head -c 4)" | sudo bash

Offline

#3 2017-08-11 15:55:28

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

Thank you for your answer. I am aware that downgrading one package is not exactly safe because of the reasons you mention. Still, it seems this one does not create any trouble, at least so far.

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?

Offline

#4 2017-08-12 14:49:00

mpan
Member
Registered: 2012-08-01
Posts: 442
Website

Re: Matlab broken after recent update (July 2017). A possible solution

pacman isn’t used for building. It only installs already built packages. It installs them into the location for which it have been built. Neither --root, nor any other special option is needed: just -U, which is — anyway — called by makepkg -i.

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”.


Sometimes I’m a bit harsh — don’t get offended too easily!
PGP: 7C848198AE93D3BB | Coreutils SHA2 performance
Russian roulette: curl "https://ptpb.pw/$(cat /dev/urandom | tr -cd [:alnum:] | head -c 4)" | sudo bash

Offline

#5 2017-09-07 05:48:54

vectro
Member
Registered: 2016-10-15
Posts: 13

Re: Matlab broken after recent update (July 2017). A possible solution

Thanks mpan, that seems to work nicely for me (matlab2017a) using harfbuzz 1.3.4 ( https://www.freedesktop.org/software/ha … 4.tar.bz2). I just built it into /usr/local, and exported the path before execution.

Offline

#6 2017-09-07 06:47:09

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,170

Re: Matlab broken after recent update (July 2017). A possible solution

Interestingly enough, harfbuzz 1.5.0 works fine for me here. Are you perhaps on 32-bit?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2017-09-07 13:09:03

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

The plot thickens... I just tested harfbuzz 1.5.0 but it does not work for me. The problem cannot be due to architecture simply because 32bit matlab is not available on linux. Which version of matlab are you using with harfbuzz 1.5.0? Also, are you using the version of java shipped with matlab or another one? I have tested both matlab's java and the two versions of openjdk on my system with the same result in all cases (I haven't tested all that with harfbuzz 1.5.0 though).

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.

Offline

#8 2017-09-08 01:53:11

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,170

Re: Matlab broken after recent update (July 2017). A possible solution

Matlab2017a here, and I don't get that GTK warning at all.

It works both with MATLAB_JAVA set to java-8-openjdk and without.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#9 2017-09-19 13:52:10

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

And now it seems the same problem resurfaces with the update of cairo 1.14.10 -> 1.15.8

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.

Offline

#10 2017-09-19 21:25:50

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,170

Re: Matlab broken after recent update (July 2017). A possible solution

And as I'm sure you expected, it does work for me, still.

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.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#11 2017-09-19 22:08:37

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

I had a jre7 foreign package that I installed last month, probably in an attempt to fix the problem with matlab. I removed it but the problem is still there. Now at least I got rid of that useless package (Thanks ngoonee!).

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.

Offline

#12 2017-09-20 01:35:35

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,170

Re: Matlab broken after recent update (July 2017). A possible solution

Looking at the dependency tree from pactree, harfbuzz is a dependency of cairo via fontconfig. Using pactree -r on cairo doesn't seem to turn up anything interesting, maybe you should check whether you have some custom packages in that tree.

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).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#13 2017-09-20 13:52:16

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

I do have quite a few foreign packages that depend on cairo but none of them seem likely to be used by matlab.

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.

Last edited by kragol (2017-09-20 13:58:57)

Offline

#14 2017-09-21 09:22:36

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 6,355

Re: Matlab broken after recent update (July 2017). A possible solution

Compare /home/#######/java.log.21150 and /home/#######/java.log.16957 .

Does that give clues about what goes wrong (post them if needed) ?

Last edited by Lone_Wolf (2017-09-21 09:23:09)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#15 2017-09-21 10:52:03

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

Unfortunately, those log files are completely useless. They only mention some java options which are identical in both cases.

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Offline

#16 2017-10-16 15:51:10

kragol
Member
Registered: 2016-03-24
Posts: 10

Re: Matlab broken after recent update (July 2017). A possible solution

I have recently installed a new arch system and I did not face that bug this time. However I faced another bug that could be related to it. Maybe the solution for this new bug also works with the one I mentioned previously in this thread. Unfortunately, I cannot test it anymore because the machine matlab was installed on died and I reinstalled the hard drive in a new machine.

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.

Offline

Board footer

Powered by FluxBB