I have cloned the latest code from GitLab to my MacBook Air running Sequoia version 15.7. Running ./autogen.sh exits with the errors shown at the end of the output:
configure.ac:213: the top level
configure.ac:185: error: possibly undefined macro: AC_ENABLE_STATIC
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:188: error: possibly undefined macro: AC_DISABLE_STATIC
configure.ac:196: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:206: error: possibly undefined macro: AC_DISABLE_SHARED
autoreconf: error: /usr/local/bin/autoconf failed with exit status: 1
autoconf is version 2.72
m4 is version 1.4.20
aclocal is version 1.18
Further up in the output I see this:
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool <=== but macOS/Xcode has libtool...???
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /usr/local/bin/autoconf --force
I was already able to configure with CMake, but there were some other things not found such as libANN which is installed in /usr/local/lib and has a pkg-config *.pc file which @scnorth was kind enough to supply. And somewhere in the various commit messages on GitLab I saw a caveat about the CMake build not yet working 100% and that one should use configure instead – or did I get this wrong?
I’m using Homebrew (on top of Xcode) and install Homebrew copies of autoconf, automake, glib, getext, libtool, pkgconf [sic] as listed in the build instructions somewhere.
I had seen some topics which suggested that it arises from not finding pkg-config. However, this is installed, and PKG_CONFIG_PATH is also set and exported correctly:
So the question is, why is Xcode’s libtool not being used, and might this be the reason for the broken autogen.sh script? (if it is broken… at least for me it is…)
For the moment I do not want to use Homebrew or MacPorts. As convenient as they may be, they add an extra indirection into the environment that I’d rather avoid if possible. Besides, the Homebrew maintainers have to build THEIR version of the different libraries, too – somehow…
Understood, but if you’re not using Mac parts or Homebrew, you’ll have to get your machete and hack your way through the underbrush. As far as I know, nobody has done this in on MacOS. many years.
I don’t remember the details, but I’m fairly sure there’s been divergence between Xcode command line tools (like /usr/bin/libtool) and the GNU tools. Google even claims,
Xcode’slibtooland the GNUlibtool(available through**Homebrew**asglibtool) are completely different tools that serve distinct purposes and have incompatible command-line options.
Apparently Xcode doesn’t have GNU Autotools.
Conceptually what you are doing should eventually work, but you may be spending hours hacking your way through compiling dependencies like cairo, pango, rsvg, expat, etc. It may not be worth it. I guess if it were me, on MacOS, I would probably just try the quartz plugin first (it’s native), followed by libgd/freetype/fontconfig (it’s simpler) before going full bore with cairo, pango, rsvp, expat, (cough) Ghostscript.
@scnorth Thanks for the tip about libtool. I installed GNU libtool and autogen.sh magically worked, producing a working configure script.
Now the configure script wants pangoft2 again. However, thanks to a little help from ChatGPT, I was able to build pangoft2 successfully – whether it all works still remains to be seen!
I assume that you are building Graphviz from a cloned repo? Beyond what Xcode Command Line Tools installs, I find that to run autogen.sh I need to install autoconf, automake, libtool, pkg-config, and bison.
To run configure, I specify --with-quartz, as quartz currently is not the default.
@zosmac That’s right. I had to basically install the entire GTK+ environment to get pangoft2 to be built. Then I had a couple of hours hunting down errors related to missing rpath stuff.
However, I was finally able to configure GraphViz and run dot -c (actually sudo dot -c), so I think the problem has been solved. This would all have been much less painful if there weren’t cyclic dependencies in GTK+ such as exist between many of the libraries.
For example, this is what ChatGPT was eventually able to come up with – it’s pretty amazing! Note the different packages which have to be built twice, for example GLib, with different options before everything comes together:
Core Dependencies
Library
Version (suggested)
Notes
GLib
≥ 2.66 (2.78.3 OK)
Core GNOME base library; build twice (1st w/o, 2nd with introspection)
gobject-introspection
1.78.1
Build after minimal GLib, then rebuild GLib with introspection
libpng
1.6.x
Required by gdk-pixbuf
jpeg / libjpeg
9.x or similar
Also required by gdk-pixbuf
tiff (libtiff)
4.x
Optional but used by gdk-pixbuf
gdk-pixbuf
≥ 2.40 (2.42.10 OK)
Image loader; needed by GTK+
freetype2
≥ 2.10
Font rendering backend
fontconfig
≥ 2.13
Font discovery
expat
-
Used by fontconfig
harfbuzz
≥ 2.6
Text shaping
cairo
≥ 1.16
2D graphics library
pango
≥ 1.48
Text layout
atk
≥ 2.36
Accessibility toolkit
ATKmm (optional)
-
Only for C++ bindings
GTK+
3.24.43 (target)
The library you’re building
Example Build Order
Here’s the recommended build sequence:
1. libffi ← required early by GLib
2. gettext ← needed by GLib
3. pkg-config ← must be installed before anything else
4. python3 ← needed by Meson, g-ir-scanner
5. glib (NO introspection)
6. gobject-introspection
7. glib (WITH introspection)
8. libpng
9. jpeg
10. tiff
11. gdk-pixbuf
12. expat ← needed for fontconfig
13. freetype2
14. fontconfig
15. harfbuzz
16. cairo
17. pango
18. atk
19. gtk+ 3.24.43
There’s actually more, e.g. harfbuzz and pango. Don’t build ANY of the tests or examples before everything builds and can be installed! After all, if you are only doing this so that you can get GraphViz built, who needs them?
I only configure graphviz with --with-quartz. (I also specify --prefix=/usr/local/graphviz to isolate graphviz from other content in /usr/local). With quartz, graphviz can produce bmp, gif, jpeg, pdf, png, svg, and tiff output. I have only used conventional fonts in my graphs, so I have no experience with the additional text/font/type libraries that graphviz may use. I also only build for the Mac. Are you cross-compiling these libraries for deployment to other platforms?
The Xcode Command Line Tools include expat, python3 and pip3. Perhaps these are incompatible with the versions of these that are used to build the rest of the libraries in the list?
I am unfamiliar with gtk+, which I gather is what is calling for the png, jpeg, and tiff libraries?
Building from graphviz source from the downloads page, configure is already present, so running autogen.sh in that case is not necessary.
Once upon a time, the macosx folder had a prebuild folder. This had an include file that defined locations for all of the dependencies you list, and a makefile to download and install them. It was all pretty old and quite fragile. You can find my updated take on that here: GitHub - zosmac/graphviz_app: macOS app for Graphviz , in the prebuild folder. (the repo contains my overly ambitious effort to update the Graphviz app to the latest Objective-C and Storyboard features a few years ago)
@zosmac Hi, and thanks for the detailed response! I was trying to install as many of the dependencies listed on the GraphViz site as possible, even if they are optional. I wasn’t aware that selecting only --with-quartz would be sufficient.
Up until now, I was able to build all of the libraries either with CMake, Autotools configure-make-install, or meson + ninja. I am building GraphViz to use in a project I am developing with Qt in C++, also with a few other libraries, fortunately none of which have a GUI component.
The problem I am now facing is that Qt on macOS is built with a lower version of Xcode and complains about my self-built libraries being too new. But in the meantime, I have some guildelines about how to address that issue.
I will definitely take a look at your GitHub site, but don’t know if I can get to it before the weekend.
Are you using Xcode? On my Xcode 16 installation I can reset the project format back to 12, and the macOS deployment target to macOS 11 Big Sur (CFLAGS/CXXFLAGS -mmacosx-version-min=11.0)
@zosmac I am building everything from the command line so that I eventually know what is going on. Since GraphViz has a cmake build system (?? I think it does), I could use an Xcode generator to try to build the resulting project in the Xcode IDE. But I would like to try another way first without “using” Xcode. OTOH, it would be nice to try using the IDE so as to learn how to use it.
Yes, there are two parallel build systems, Autotools and CMake. There used to be three (+ MS Build). CMake is the newest and intended to be the future, but it’s taking a while to get there. Autotools and CMake are mostly at parity these days, though occasionally we come across gaps that we’ve been plugging as we find them.