Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8057557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:04:18+00:00 2026-06-05T09:04:18+00:00

I have been trying to make clang 2.9 output an AST with graphviz using

  • 0

I have been trying to make clang 2.9 output an AST with graphviz using the following:

./clang -cc1 -ast-view smd.c 

However it outputs the code on the console and complains that:

Stmt::viewAST is only available in debug builds on systems with Graphviz or gv!

At llvm documentation it is mentioned that /Applications/Graphviz.app/Contents/MacOS/ should be added to path. I did so using export PATH=$PATH:/Applications/Graphviz.app/Contents/MacOS/ but still does not work.

Also on the same documentation it is mentioned that:

Getting this to work requires a small amount of configuration. On Unix systems with X11, install the graphviz toolkit, and make sure ‘dot’ and ‘gv’ are in your path. If you are running on Mac OS/X, download and install the Mac OS/X Graphviz program, and add /Applications/Graphviz.app/Contents/MacOS/ (or wherever you install it) to your path. Once in your system and path are set up, rerun the LLVM configure script and rebuild LLVM to enable this functionality.

I am clueless on where is this configuration and rebuild LLVM (All I did was download the llvm+clang 2.9 package and run directly from the folder the commands.

In respect to my graphviz version:

$ dot -v
dot - graphviz version 2.28.0 (20111028.1807)

However the gv command is not available and I can’t seem to find on google where is it supposed to be located or to be obtained.

Any clue on this? The question itself is how to output clang 2.9 to graphviz. I just believe it has to do with this gv that cannot be found on my machine but I might be mislead.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:04:20+00:00Added an answer on June 5, 2026 at 9:04 am

    Since I had to go thru some weird details to get this working and from what I saw its not a direct approach for a Mac OS Lion user, here is what I found in case anyone get stuck as much as I did for what seem a simple one line task.

    1. First and before anything, you might want to check if you have graphviz and gv, as mentioned on my original question you will, if you fall under the same situation as I did, have clang complaining at you about graphviz or gv. While graphviz is relatively easy to find just using google, gv didn’t seem to me because it was missing its first name on their official website, that is GNU gv.

    2. You should get graphviz installed without much headache, but gv might not. It complains about a dependency called Xaw3d. Their website contains a not so up to date version (2003) but thats what will do. If you are as unfortunate as me, you will find out the download is broken. Luckily enough a friend pointed me to this website from MIT of someone who had to deal with this so saved me a lot of time. It is very recent (may,2012) at the point I am answering this so it should work for you too. I am posting here what I actually used just in case that page goes down:

    3. Get the zip or tar version of gv.

    4. Avoid the pkg-config utility by running:

    $ ./configure X11_CFLAGS=’-I/usr/X11/include/X11′ X11_LIBS=’-L/usr/X11/lib -lX11 -lXext -lXmu -lXt’

    while inside the ibXaw3d-1.6 directory on your console.

    Followed by:

    make

    sudo make install

    make clean

    With that done go back and install gv, if it doesnt works change their code that was also bugged for me (lacking few parameters on a line that makes it impossible to get the installation done) as the MIT page mentions:

    Change on Scrollbar.c:

    (*swclass->threeD_class.shadowdraw) (w, event, region, FALSE);

    to

    (*swclass->threeD_class.shadowdraw) (w, event, region, sbw->threeD.relief, FALSE);

    On MAC it will also complain about zombie process if the following is not run so just in case as the author also suggests get the configure done this way:

    ./configure –x-includes=/usr/X11/include/X11 –x-libraries=/usr/X11/lib –enable-SIGCHLD-fallback

    And finally gv should be usable if you run $gb whatever.ps. In case you are wondering, that is one of its use, open .ps if not all of it (I didn’t bother looking much on it since it was not the original purpose).


    Now if you are still unlucky as I am, running the same thing will not work.

    Thanks to Joey (the person on the comment below) and the LLVM mailing list people I found out that I should run the build on debug mode.

    Now it seems that if you are downloading the binaries like I originally did for MAC OS it will automatically comes on non debug mode for optimization reasons (10 times faster or so I got on one of the outputs on the console).

    If you go to this page and follow 1. to 5. you will get the most recent version already on debug mode following the instructions on that page.

    Make sure you open the LLVM/Debug+Accerts/bin/clang and execute from that clang. The result should open a GUI on gv with the tree.


    As you may notice I had to move on to the most recent version. There is a way to compile on debug mode on llvm compile according to llvm getting started. Basically this paragraph says it all:

    These builds are enabled with the –enable-optimized option to configure or by specifying ENABLE_OPTIMIZED=1 on the gmake command line. For these builds, the build system will compile the tools and libraries with GCC optimizations enabled and strip debugging information from the libraries and executables it generates. Note that Release Builds are default when using an LLVM distribution.

    Although I got some messages that seemed to confirm I successfully compiled 2.9 on debug mode such as:

    llvm[0]: * Completed Debug Build

    llvm[0]: * Note: Debug build can be 10 times slower than an

    llvm[0]: * optimized build. Use make ENABLE_OPTIMIZED=1 to

    llvm[0]: * make an optimized build. Alternatively you can

    llvm[0]: * configure with –enable-optimized.

    doing the same thing (in this case the folder was only called Debug instead of Debug+Asserts), however did not work for 2.9 going on the same process. If anyone know why please let me know as I am still interested on 2.9 but all in all, at last for seeing it visually this one works. I still have no clue why it only outputs on gv but not on graphviz as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I have been trying to make an init script using start-stop-daemon. I am stuck
I have been trying to make graphs using the igraph library in c. I
Using MVC 2 I have been trying to make this record store project. Creating
I have been trying to make a simple Spring project using Eclipse and Maven
I have been trying to make something work with JQuery. I have the following
I have been trying to use Jeditable to make my html table editable. However
I have been trying to make a case for using Python at my work.
I have been trying to make a simple web service and have been following
I have been trying to make a VBA code to do the following. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.