LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Help doing UML with graphviz (http://www.linuxquestions.org/questions/slackware-14/help-doing-uml-with-graphviz-853968/)

spudgunner 01-03-2011 02:12 PM

Help doing UML with graphviz
 
I'm doing a group project using some UML stuff. I tried install graphiz and it installed find but apparently it keeps telling me I'm missing dot when compiling the UML (tells me dot should be at /usr/bin/dot which it is, but it can't find it). I also tried a command "java -jar plantuml.jar -testdot" (which was suggested where the UML should have been) and the jar file couldn't be found.

Any suggestions to make this work for me?

jamesf 01-03-2011 08:46 PM

1 Attachment(s)
Try creating this simple file I called testfile.gv and storing it in your home directory:
Code:

digraph testgraph {
        hi -> bye -> done;
}

Now, open a terminal, cd to your home directory, and enter this:
Code:

james@darkstar:~$ dot -Tpng -O testfile.gv
james@darkstar:~$ ls testfile.gv*
testfile.gv      testfile.gv.png 
james@darkstar:~$ xv testfile.gv.png

if all that went well you should see this:

spudgunner 01-04-2011 07:27 AM

That worked fine

jamesf 01-04-2011 07:58 AM

Weird. Which UML software are you using? And, are you sure that the UML support offered by the software was actually selected during compilation?

I use graphviz a lot in my Windows-centric day job and I've used it a bit here at home, but only from the command line 'dot' command and family.

spudgunner 01-04-2011 09:18 AM

All I know is that I'm using graphviz and whatever came with it. I'm using it with latex to make pdf files.

jamesf 01-04-2011 01:04 PM

Please post the output of 'dot -v' (you'll probably have to control-c after that command), the output of 'which dot', and the command / program you're using that errors out and the errors themselves.

thanks!

Edit: are you embedding latex in dot graphs, or dot graphs in latex documents?

spudgunner 01-04-2011 01:53 PM

Outputs are as follows:

dot -v:
Code:

dot - graphviz version 2.26.3 (20100126.1600)
Activated plugin library: libgvplugin_pango.so.6
Using textlayout: textlayout:cairo
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.so.6
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
        /usr/lib/graphviz/config6
                was successfully loaded.
    render        :  cairo dot fig gd map ps svg tk vml vrml xdot
    layout        :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout        :  textlayout
    device        :  bmp canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gtk gv ico imap imap_np ismap jpe jpeg jpg pdf plain plain-ext png ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp x11 xdot xlib
    loadimage        :  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg xbm

which dot:
Code:

/usr/bin/dot
I'm using makefiles to build the latex from multiple folders of stuff, so here's the makefile:
Code:

MODULES := latex uml
TEXINPUTS := .:uml/img/:latex/:graphs/:output/:bib/:
export BIBINPUTS:= bib/
TEXOUT = -output-directory=output
LATEXFILES :=
GFXFILES :=
UMLFILES :=


# include the description for each module
include $(patsubst %, %/module.mk,$(MODULES))

all: $(UMLFILES) $(LATEXFILES)

#compile latex
$(LATEXFILES) :
        pdflatex $(TEXOUT) latex/$@
        #bibtex output/$@
        pdflatex $(TEXOUT) latex/$@
        #pdflatex $(TEXOUT) latex/$@

#UML File Generation
#$(UMLFILES): $(addprefix uml/,$(addsuffix .uml,$(basename $(notdir $(UMLFILES)))))
%.png:
        cat $(addprefix uml/,$(addsuffix .uml,$(basename $(notdir $(@))))) | java -jar uml/compiler/plantuml.jar -pipe > $@

clean:
        rm output/*.* uml/img/*

# Personal (for dev-ing)
dan : all
        AcroRd32.exe output/report.pdf

I am embedding the UML in the latex documents, and the error shows up as pictures with the following text:
Code:

Dot executable: /usr/bin/dot
File does not exist
Cannot find Graphviz: try 'java -jar plantuml.jar -testdot'

When I do what this error message recommends, I get this output:
Code:

Unable to access jarfile plantuml.jar

jamesf 01-04-2011 03:37 PM

Assuming that you're running this from the command line, is your current directory the directory that contains plantuml.jar?

Since dot works (per tests above) I'm leaning towards a java configuration / plantuml configuration problem. Try the stuff
at this url: http://plantuml.sourceforge.net/faqinstall.html

If that doesn't work, then as root 'updatedb' and 'locate -i plantuml.jar'. 'exit' root, 'cd' to the directory that contains plantuml.jar, then try the -testdot option like this:
Code:

user@machine$ java -jar plantuml.jar -testdot
and see what happens.

There is an environment variable, GRAPHVIZ_DOT, that plantuml will use. You could try (assuming bash):
Code:

user@machine$ export GRAPHVIZ_DOT=/usr/bin/dot make whatever_your_target_is
Also, the plantuml website on sourceforge says that they're a continuous integration development model, so you might try updating the plantuml installation if there is a newer one. But let us focus on other things first.

spudgunner 01-04-2011 04:02 PM

I found the plantuml.jar and the -testdot works in that directory, but nowhere else

jamesf 01-04-2011 08:31 PM

Quote:

I found the plantuml.jar and the -testdot works in that directory, but nowhere else
Ok. This is (close to) nailed. Unfortunately, I'm not at my best with java programming and setup. I'm a C#/Mono guy. :v(

However, I _think_ the problem is either your CLASSPATH is wrong -or- you need to be in the plantuml.jar directory to run plantuml.jar.

Your make file is probably _not_ in this directory (if I had to guess), so, when you try to 'make' your target the .jar gets run _but_ something inside it gets confused. Perhaps another java class or utility file can't be found.

If you use a file manager to navigate to the plantuml.jar directory and double-click the .jar does everything work as expected?

Also, try moving your makefile to the directory containing plantuml.jar and running it from there. I notice that you'll have to remove the uml/compiler/ from your java command if you try this, among other changes.

spudgunner 01-05-2011 12:48 PM

Instead of moving the makefile to the uml/compile/ directory, I moved plantuml.jar to the directory containing the makefile (because plantuml.jar was the only thing in uml/compile). I changed the reference in the makefile and the -testdot works, but it still will not compile into my latex document correctly (still complaining the error that I mentioned above).

Edit: Apparently I am needed to export the GRAPHVIZ_DOT variable in bash. I tried creating a .bashrc file in my home directory and putting the export in there but it won't work, so I have to do it manually every time. How do I make bash automatically export this whenever I start it?

Edit 2: Figured out how to export automatically, use .bash_profile instead of .bashrc and it'll run every time you log in.

Thanks for all the help.

jamesf 01-05-2011 03:49 PM

Quote:

Originally Posted by spudgunner (Post 4214254)
Edit: Apparently I am needed to export the GRAPHVIZ_DOT variable in bash. I tried creating a .bashrc file in my home directory and putting the export in there but it won't work, so I have to do it manually every time. How do I make bash automatically export this whenever I start it?

Edit 2: Figured out how to export automatically, use .bash_profile instead of .bashrc and it'll run every time you log in.

Thanks for all the help.

You're very welcome. Now, with KDE starting bash you put it in the right spot. If you use (I think) xfce then the export won't appear because they each start bash a little differently (on my standard-install -current box). I had to end up source-ing /etc/profile and ~/.bash_profile in .bashrc to get consistent results across most environments.

I'm really glad it is working for you, though.


All times are GMT -5. The time now is 08:33 AM.