gemhome / rails-erd

retired fork, DO NOT USE. see https://github.com/voormedia/rails-erd
MIT License
0 stars 0 forks source link

Error in Mavericks: "only use PostScript names" #19

Open bf4 opened 10 years ago

bf4 commented 10 years ago

Issue by leonelgalan Wednesday Oct 30, 2013 at 05:02 GMT Originally opened as https://github.com/voormedia/rails-erd/issues/61


brew info graphviz
graphviz: stable 2.34.0, devel 2.35.20130914.0446
...

Errors are shown one by one on this order:

Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:54:38.917 dot[42907:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Italic" and got font with PostScript name "Arial-ItalicMT". For best performance, only use PostScript names when calling this API.
...
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:56:52.537 dot[43000:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
...
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:57:12.159 dot[43036:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Bold" and got font with PostScript name "Arial-BoldMT". For best performance, only use PostScript names when calling this API.

Replacing the font names with the PostScript names solves the issue. I'm not sure if this is backwards compatible, so I'm not pushing my code. I will, gladly, once this is discussed.

bf4 commented 10 years ago

Comment by evserykh Wednesday Nov 06, 2013 at 00:59 GMT


have the same problem

os x mavericks graphviz 2.34.0 rails-erd 1.1.0

bf4 commented 10 years ago

Comment by mattgoldman Wednesday Nov 06, 2013 at 21:53 GMT


same problem here

bf4 commented 10 years ago

Comment by ptyagi16 Friday Nov 15, 2013 at 07:02 GMT


I got a slightly different issue. In my case rake erd just hangs. When I find the dot process and kill it I see the following errors

Original error: 2013-11-15 01:54:00.740 dot[55363:d07] 
CoreText performance note: Client called CTFontCreateWithName() using name "Arial Italic" and 
got font with PostScript name "Arial-ItalicMT". For best performance, only use PostScript names 
when calling this API.

Seems like a Mavericks related issue. Other projects are in the same boat. https://github.com/thoughtbot/capybara-webkit/issues/581 and http://forums.adobe.com/thread/1320979 and http://stackoverflow.com/questions/18291333/coretext-performance-warning-when-creating-a-ctfont

bf4 commented 10 years ago

Comment by doshea Saturday Nov 30, 2013 at 21:58 GMT


+1

bf4 commented 10 years ago

Comment by ipuchkov Tuesday Dec 03, 2013 at 03:14 GMT


+1 same problem mavericks, graphviz 2.34, rails-erd 1.1.0

bf4 commented 10 years ago

Comment by yepesasecas Tuesday Dec 03, 2013 at 20:51 GMT


+1

bf4 commented 10 years ago

Comment by frgooall Wednesday Dec 04, 2013 at 13:54 GMT


+1 Same problem With Rails 3.12 I get an error but it renders the pdf, with rails 4.0.2 it just hangs when i try generating a pdf. Maverick, graphviz 2.30.1, rails-erd 1.1.0

bf4 commented 10 years ago

Comment by hayduke19us Tuesday Dec 10, 2013 at 23:03 GMT


Rails 4.0.0 ruby 2.0.0p353 graphviz/2.34.0 rails-erd (1.1.0)

leonelgalan is right. Changing the font names will correct the problem to get rails-erd to produce a pdf. I also don't know if there will be any backward compatibility issues, but it's a quick fix to get up and running.

gems/rails-erd-1.1.0/lib/rails_erd/diagram/graphviz.rb LINES: 60, 67, 74 change font names to post script font names! https://gist.github.com/hayduke19us/7901900

gems/rails-erd-1.1.0/lib/rails_erd/diagram/templates/node.html.erb LINES: 3,9 change font face names to post script font names! https://gist.github.com/hayduke19us/7901898

bf4 commented 10 years ago

Comment by maxrosecollins Thursday Dec 12, 2013 at 22:04 GMT


+1

ruby 2.0.0p353 Rails 4.0.2 graphviz-2.34.0 rails-erd (1.1.0)

But seems to create the pdf anyway?!

bf4 commented 10 years ago

Comment by hiphapis Tuesday Dec 17, 2013 at 07:52 GMT


:+1: ;(

bf4 commented 10 years ago

Comment by rd13 Sunday Dec 29, 2013 at 20:50 GMT


+1

hayduke19us's post script changes worked for me.

bf4 commented 10 years ago

Comment by ahennie Thursday Jan 02, 2014 at 22:21 GMT


+1 throws an error though the pdf is still generated. weird.

bf4 commented 10 years ago

Comment by limhoff-r7 Tuesday Jan 07, 2014 at 14:48 GMT


I don't know if this happened to anyone else, but ruby-graphviz's Graphviz::Utils.output_and_errors_from_comand was actually hanging because the stdout.read before stderr.read meant that the stderr pipe buffer was full, so I first had to change Graphviz::Utils.output_and_errors_from_command to use chunked reads:

   def output_and_errors_from_command(cmd) #:nodoc:
      unless defined? Open3
        begin
          require 'open3'
          require 'win32/open3'
        rescue LoadError
        end
      end
      begin
        Open3.popen3( cmd ) do |stdin, stdout, stderr|
          stdin.close
          stdout.binmode

          buffer_by_io = {
              stderr => "",
              stdout => ""
          }
          waiting_to_read = [stdout, stderr]

          loop do
            readables = IO.select(waiting_to_read).first

            readables.each do |readable|
              chunk = readable.read(4 * 2**10)

              if chunk.nil?
                waiting_to_read.delete(readable)
              else
                buffer_by_io[readable] += chunk
              end
            end

            if waiting_to_read.empty?
              break
            end
          end

          [buffer_by_io[stdout], buffer_by_io[stderr]]
        end
      rescue NotImplementedError, NoMethodError
        IO.popen( cmd ) do |stdout|
          stdout.binmode
          [stdout.read, nil]
        end
      end
    end

That however, still left stderr output, which makes Graphviz::Utils.output_from_command to raise an exception, so I ended up applying @hayduke19us change to my local gemset and that worked.

Even if @hayduke19us change is merged to master, the chunked reading fix should probably still be applied to fix hanging ruby-graphviz when the stderr output exceeds the pipe buffer limit (which is 4k in OS X and Linux IIRC).

bf4 commented 10 years ago

Comment by kcalmes Tuesday Jan 14, 2014 at 06:10 GMT


ruby 1.9.3p484 Rails 3.2.13 graphviz 2.34.0

I am having the same problem with hanging.

* Invoke erd:generate (first_time) * Invoke erd:options (first_time) * Execute erd:options * Invoke erd:load_models (first_time) * Execute erd:load_models Loading application environment... * Invoke environment (first_time) * Invoke rails_admin:disable_initializer (first_time) * Execute rails_admin:disable_initializer [RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it. * Execute environment Loading code in search of Active Record models... * Execute erd:generate Generating Entity-Relationship Diagram for 10 models...

When I attempt to open it the document is empty.

bf4 commented 10 years ago

Comment by plehoux Friday Jan 17, 2014 at 19:26 GMT


+1 @hayduke19us's post script changes also worked for me.

bf4 commented 10 years ago

Comment by seanfisher Monday Jan 20, 2014 at 05:58 GMT


+1 @hayduke19us fixed my problem too on Mavericks.

bf4 commented 10 years ago

Comment by yonkeltron Tuesday Feb 18, 2014 at 20:32 GMT


I was able to get around this issue by reinstalling graphviz with the following options (not sure which one fixed the problem, though):

brew reinstall graphviz --with-bindings --with-freetype --with-librsvg --with-pangocairo

Now everything works just fine.

Running mavericks with ruby 2.1.0 installed via rvm. Let me know if I can provide more info!

bf4 commented 10 years ago

Comment by ptyagi16 Tuesday Feb 18, 2014 at 21:38 GMT


Thanks @yonkeltron. Worked for me! I had to update my home brew before it worked for me correctly.

Others please remember to update your homebew

~>  brew update
bf4 commented 10 years ago

Comment by mrevd Friday Feb 21, 2014 at 18:08 GMT


should also point out that those graphviz options have an XQuartz dependency, which brew doesn't offer. it can be installed from https://xquartz.macosforge.org/

bf4 commented 10 years ago

Comment by paulwittmann Tuesday Feb 25, 2014 at 15:52 GMT


This is the only thing that worked for me on mavericks:

gem 'rails-erd', github: 'paulwittmann/rails-erd', branch: 'mavericks'

It's @bshelton229's fork with a fixed typo. kudos to him and @hayduke19us.

bf4 commented 10 years ago

Comment by hiro-su Thursday Mar 06, 2014 at 22:00 GMT


+1 Thanks @paulwittmann.

gem 'rails-erd', git: 'https://github.com/paulwittmann/rails-erd', branch: 'mavericks'
bf4 commented 10 years ago

Comment by toxaq Wednesday Mar 19, 2014 at 13:12 GMT


@yonkeltron's brew reinstall worked for me.

bf4 commented 10 years ago

Comment by maciejkowalski Tuesday Mar 25, 2014 at 10:03 GMT


@yonkeltron

brew reinstall graphviz --with-bindings --with-freetype --with-librsvg --with-pangocairo

Worked for me. Thanks! :+1:

bf4 commented 10 years ago

Comment by pixind Thursday Mar 27, 2014 at 14:21 GMT


==> Reinstalling graphviz with --with-bindings, --with-pangocairo, --with-freetype, --with-librsvg librsvg: Unsatisfied dependency: XQuartz

This one won't work for me.. but this other one totally does :) thanks @paulwittmann.

gem 'rails-erd', git: 'https://github.com/paulwittmann/rails-erd', branch: 'mavericks'

bf4 commented 10 years ago

Comment by maciejkowalski Thursday Mar 27, 2014 at 14:31 GMT


@pixind http://lmgtfy.com/?q=XQuartz first link https://xquartz.macosforge.org/landing/

bf4 commented 10 years ago

Comment by paulwittmann Thursday Mar 27, 2014 at 14:34 GMT


@maciejkowalski even that didn't help me.

bf4 commented 10 years ago

Comment by maciejkowalski Thursday Mar 27, 2014 at 14:34 GMT


@paulwittmann did you restarted mac?

bf4 commented 10 years ago

Comment by pixind Thursday Mar 27, 2014 at 14:38 GMT


Loud applause for the LMGTFY @maciejkowalski, you are the smartest of all, by far. I had seen the link of course, but I prefer not to install/reinstall X11 if I can go only with the most recent (and relevant) gem.

bf4 commented 10 years ago

Comment by robertwbradford Tuesday Apr 01, 2014 at 17:19 GMT


Just tried @maciejkowalski's

brew reinstall graphviz --with-bindings --with-freetype --with-librsvg --with-pangocairo

and got the following during the install:

==> Installing graphviz dependency: glib
==> Downloading http://ftp.gnome.org/pub/gnome/sources/glib/2.36/glib-2.36.3.tar.xz
######################################################################## 100.0%
==> Downloading patches

curl: (22) The requested URL returned error: 404 Not Found
Error: Failure while executing: /usr/bin/curl -f#LA Homebrew\ 0.9.4\ (Ruby\ 1.8.7-358;\ Mac\ OS\ X\ 10.9.2) https://raw.github.com/gist/5393707/5a9047ab7838709084b36242a44471b02d036386/glib-configurable-paths.patch -o 000-homebrew.diff
bf4 commented 10 years ago

Comment by ptyagi16 Tuesday Apr 01, 2014 at 17:51 GMT


Make sure you updates home brew # $ brew update

On Apr 1, 2014, at 1:19 PM, Robert Bradford notifications@github.com wrote:

Just tried @maciejkowalski's

brew reinstall graphviz --with-bindings --with-freetype --with-librsvg --with-pangocairo and got the following during the install:

==> Installing graphviz dependency: glib ==> Downloading http://ftp.gnome.org/pub/gnome/sources/glib/2.36/glib-2.36.3.tar.xz ######################################################################## 100.0% ==> Downloading patches

curl: (22) The requested URL returned error: 404 Not Found Error: Failure while executing: /usr/bin/curl -f#LA Homebrew\ 0.9.4\ (Ruby\ 1.8.7-358;\ Mac\ OS\ X\ 10.9.2) https://raw.github.com/gist/5393707/5a9047ab7838709084b36242a44471b02d036386/glib-configurable-paths.patch -o 000-homebrew.diff — Reply to this email directly or view it on GitHub.