I have been looking for ways of building GraphViz from sources on my new MacBook Air without using Homebrew or MacPorts, if possible. We use the GraphViz libraries in another project built with the Qt frameworks. It has worked successfully on Windows and Linux Ubuntu, and now we are trying to get it to build on macOS Sequoia version 15.6 with CLang 17.x. Actually, the configure script for GraphViz runs without errors but with many warnings about missing packages and/or dependencies. I would like to add as many of the missing dependencies as possible before building it, though.
When I run the configure script in the terminal, it looks for libANN (or libann) although this is not listed as a dependency on the “Source Code” page at graphviz.org. I saw a script on the GitLab site which pulls in libANN via MacPorts, so I assume it may not be entirely optional?
What is it used for, exactly? All we really need is the SVG renderer, some of the basic PNG/JPEG renderers, and a few of the engines: especially dot and neato for undirected graph output with HTML labels and standard coloring and fonts. If we can leave out libANN, I suppose we shall do that.
But I wanted to try, anyway. So I downloaded the source code of libANN from the Savannah-GNU site which will not compile on macOS Sequoia 15.6 using clang without modifications to some of the code. I eventually got it to build the library, but then it wanted to call makeinfo from the TexInfo package which is even more of a headache to build.
But according to the licence information contained in the package’s COPYING file, it is GPL and not LGPL. How does this jive with the AT&T licence used by GraphViz? I am not a lawyer and therefore cannot judge whether this is an issue or not.
The ANN Library (all versions) is provided under the terms and
conditions of the GNU Lesser General Public Library, which is stated
below. It can also be found at:
But, feel free to exclude it in your build. Graphviz needs nearest neighbors for the node overlap removal algorithm in neato, described in a paper by Gansner and Hu.
Because libANN is unsupported and maybe not even SOTA at this point 15 years later, at times we’ve had idle thoughts that it might be nice to replace libANN with annoy or FLANN, but they are probably not plug-compatible, so it would be some work.
PS ann 1.1.2 builds without much drama in MacOS Sequoia 15.6 and Xcode 16.4. There are some warnings, mostly ‘register’ storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]repeated a bunch of times, but not much else. This is make macosx-g++.It was charming to see make sunos5 as an option, too.
@scnorth : Thanks very much for the link and the details in your other messages! This will help us a lot.
Looks like there are more than one library by the same name. I obviously pulled the wrong one – although the version number is higher than the one I should have used, it is much older code. No wonder I couldn’t make it compile!
Is there any reason not to add this library to the list of dependencies on the main website, along with this link? Since our app deals with undirected graphs, we need to provide neato functionality. From what you wrote, it seems like it would be necessary for it.
Hmm … do we need to explicitly give the make target like that? Usually configure or cmake does “the right thing” as far as the platform and choice of compiler (not always, though).
Another thing I remember from compiling GraphViz a few years ago on Ubuntu, and I couldn’t get GraphViz’ configure to find libann.so until I realized that libann did not install a *.pc file for pkg-config. Is this still the case?
We should probably add this to the list of dependencies; it’s probably just an oversight that it’s not there. There’s an “edit this page” link on every page of the graphviz website if you’d like to contribute an edit?
As a continuation of my last question, I see that the target must be supplied. However, I’m not sure how to make GraphViz find the (static) library once it has been built. Noticing that the variable MAKELIB on macOS uses libtool, does this put the library in the right place in the file system so that other programs will find it automatically? (I never had to work with static libraries before, so I apologize if this is a beginner’s question.)
@mark Thanks for the suggestion about making an edit. But I think it would be better if someone like you or Stephen, or Matthew did that. I might leave out something important.
So, also, I keep getting this wrong: libANN is only needed by mingle, an edge bundling utility. It’s not needed for the overlap removal algorithm in neato that I referenced. My understanding is that hardly anyone uses mingle - only researchers who are benchmarking edge bundling algorithms. Sorry for spreading misinformation.
@smattr@mark@scnorth Thanks. I looked at the commit message in the link as well as how this is handled in configure. Of course, it still requires that the correctlibANN was built and then installed where it can be found.
If someone (not me) decides to add this to the dependency requirements now, which I think is a good idea because a link to the right library site can be included, one could mention that it is a minor issue if it is not installed and only needed for mingle.
Otherwise, someone else like myself would hunt around looking for it and end up with the wrong one!