The problem can be reproduced by installing Graphviz on Mac OS High Sierra and running the following command:
dot -v -Tpng:quartz /path/to/graph.dot -o /path/to/out.png
graph.dot
must contain the following (minimal) graph structure to reproduce the bug:
digraph {
imgnode[image="/path/to/some-image.png", label=""];
}
As seen in the tracelog below, the error is raised when dot
tries to load an image into the graph.
The error takes place in libgvplugin_quartz
when embedding some-image.png
in the resulting graph PNG using gvloadimage_quartz
:
Source code: https://gitlab.com/graphviz/graphviz/blob/master/plugin/quartz/gvloadimage_quartz.c at line 130.
Upgrading Graphviz, Quartz or Mac OS does not seem to have any effect, so the question is: why does this error occur and how to fix it? Is the error caused by me or is this a bug in Graphviz or Mac OS? I cannot seem to find any solutions online except for a bug report which hasn't been active for a while: https://github.com/Homebrew/homebrew-core/issues/18684
Dot
tracelog:
dot[11528:2474068] +[__NSCFConstantString length]: unrecognized selector sent to class 0x7fffa240c578
dot[11528:2474068] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[__NSCFConstantString length]: unrecognized selector sent to class 0x7fffa240c578'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff4811200b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff6ececc76 objc_exception_throw + 48
2 CoreFoundation 0x00007fff481aac14 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff480883f0 ___forwarding___ + 1456
4 CoreFoundation 0x00007fff48087db8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00007fff48025914 CFStringCompareWithOptionsAndLocale + 68
6 ImageIO 0x00007fff4a976ad0 _ZN17IIO_ReaderHandler15readerForUTTypeEPK10__CFString + 52
7 ImageIO 0x00007fff4a94ac94 _ZN14IIOImageSource14doBindToReaderEv + 434
8 ImageIO 0x00007fff4a94b30d _ZN14IIOImageSource18createImageAtIndexEmP13IIODictionary + 39
9 ImageIO 0x00007fff4a93906b CGImageSourceCreateImageAtIndex + 237
10 libgvplugin_quartz.6.dylib 0x0000000108ef648b memory_data_consumer_get_byte_pointer + 699
11 libgvc.6.dylib 0x0000000108e26afa gvloadimage + 250
12 libgvc.6.dylib 0x0000000108e24e58 gvrender_usershape + 1080
13 libgvc.6.dylib 0x0000000108e4cd5a html_port + 4186
14 libgvc.6.dylib 0x0000000108e492cc emit_html_label + 524
15 libgvc.6.dylib 0x0000000108e50569 emit_label + 57
16 libgvc.6.dylib 0x0000000108e5f187 find_user_shape + 10151
17 libgvc.6.dylib 0x0000000108e3edda getObjId + 2778
18 libgvc.6.dylib 0x0000000108e435ae emit_graph + 3998
19 libgvc.6.dylib 0x0000000108e45a51 gvRenderJobs + 6673
20 dot 0x0000000108e1dc95 dot + 11413
21 libdyld.dylib 0x00007fff6f8dc115 start + 1
22 ??? 0x0000000000000004 0x0 + 4
)
libc++abi.dylib: terminating with uncaught exception of type NSException