Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error fontforge compilation failed – need help #347

Open
gpluess opened this issue Aug 9, 2017 · 23 comments
Open

Error fontforge compilation failed – need help #347

gpluess opened this issue Aug 9, 2017 · 23 comments

Comments

@gpluess
Copy link

gpluess commented Aug 9, 2017

I installed fontcustom today on a new Mac following the instructions (using Homebrew). However, when trying to compile, I'm getting the following error:

$ fontcustom compile --debug
       debug  Using settings from `config/fontcustom.yml`.
       debug  Generated files will be saved to `icons/`.
       debug  Using options:
                {:input=>{:vectors=>".", :templates=>"."},
                :output=>{:fonts=>"icons", :css=>"icons", :preview=>"icons"},
                :config=>"config/fontcustom.yml",
                :templates=>["scss-rails"],
                :font_name=>"icons",
                :font_design_size=>16,
                :font_em=>512,
                :font_ascent=>448,
                :font_descent=>64,
                :css_selector=>".i-{{glyph}}",
                :preprocessor_path=>nil,
                :autowidth=>false,
                :no_hash=>true,
                :css3=>false,
                :debug=>true,
                :force=>true,
                :quiet=>true,
                :copyright=>"",
                :base64=>true}
       debug  Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
               License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
               with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
               Based on sources from 21:22 UTC  6-Aug-2017-D.
               Based on source from git with hash:
       error  `fontforge` compilation failed.
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
/Users/gpluess/.rvm/gems/ruby-2.4.1@global/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/gpluess/.rvm/gems/ruby-2.4.1@global/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/gpluess/.rvm/gems/ruby-2.4.1@global/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/gpluess/.rvm/gems/ruby-2.4.1@global/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/Users/gpluess/.rvm/gems/ruby-2.4.1/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
/Users/gpluess/.rvm/gems/ruby-2.4.1/bin/fontcustom:23:in `load'
/Users/gpluess/.rvm/gems/ruby-2.4.1/bin/fontcustom:23:in `<main>'
/Users/gpluess/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/Users/gpluess/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'

I'm not familiar with the ruby or python ecosystem, so any help or hints will be much appreciated.

@FerrusDude
Copy link

I am seeing the same error.

Also you should make sure you have installed woff2 per the main page instructions. I originally was using the instructions on the webpage here and they currently omit this information.

Also there is an outstanding issue - #344, that might be related to this issue.

@gpluess
Copy link
Author

gpluess commented Aug 9, 2017

Thank you for your reply! I did install woff2. I came across issue #344 as well while searching for a solution. I fixed it using the change in pull request #346 but the problem still occurs. I also tried to remove all svg files and only use one very simple test svg file, without luck.

@FerrusDude
Copy link

Likewise, confirmed.

@FerrusDude
Copy link


... is returning nil

fontforge -script appears to be reacting to python scripts, so I don't think it's a dependency issue for fontforge.

@kmchen
Copy link

kmchen commented Aug 14, 2017

Anyone else having this issue?

@kutomer
Copy link

kutomer commented Aug 16, 2017

+1

I guess the problem is with fontforge version.
I had fontforge version 20170104, run yarn upgrade fontforge and got 20170806 since then I get the same error.

Will try to downgrade fontforge version.

@kmchen
Copy link

kmchen commented Aug 16, 2017

Anyone knows how to downgrade fontforge? I try to build from source but unsuccessful

@FerrusDude
Copy link

I installed via the Homebrew method. Homebrew does not seem to have older versions of fontforge available, which poses a problem for downgrading.

@greencoppercompany
Copy link

After digging a bit inside font.rb, we can see a seg fault when fontcustom is calling fontforge

[1] 8436 segmentation fault fontforge -script .fontcustom-manifest.json

ruby 2.2.4p230
fontforge 21:22 UTC 6-Aug-2017
libfontforge 20170806
fontcustom-2.0.0

We did try to downgrade fontforge with brew, but we would not recommend go that way :/ . Older fontforge version are using libjpeg8d (so lib loading issue if you have 9b), and even older will have an issue with cmzq version.

@gpluess
Copy link
Author

gpluess commented Aug 17, 2017

I think I've found a possible temporary solution which is working for me, not sure if it's working for anyone else though. So here's what I did:

First I edited the formula using

brew edit fontforge

and replaced the file's contents with this older version:
https://raw.githubusercontent.com/Homebrew/homebrew-core/d1dfe7b506da542c8828ebd775a1f4f943e55ed7/Formula/fontforge.rb

Then I ran

brew remove fontforge

and

brew install fontforge

With this older version of fontforge I'm now able to build my webfonts again. Thanks everybody who contributed to this thread and pointed me into the right direction!

@roh26it
Copy link

roh26it commented Aug 17, 2017

@gpluess thanks, worked for me as well! I just needed to run

brew cask install fontforge

as well and then ran into a libjpeg problem which I solved with this kind person's help - https://stackoverflow.com/a/45546980/6887881

Just if anyone's searching.

@kmchen
Copy link

kmchen commented Aug 17, 2017

Thanks for you replies. However i'm still getting error as follows after applying @gpluess script:

debug  Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
               License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
               with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
               Based on sources from 10:53 BST 18-Jul-2017-D.
               Based on source from git with hash:
              Traceback (most recent call last):
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 88, in <module>
                  name = createGlyph(glyph, data['source'], data['codepoint'])
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 66, in createGlyph
                  temp = removeSwitchFromSvg(source)
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 57, in removeSwitchFromSvg
                  tmpsvgfile.file.write(svgtext.encode('utf-8'))
              UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 118: ordinal not in range(128)
       error  `fontforge` compilation failed.

@abhilashlr
Copy link

as well and then ran into a libjpeg problem which I solved with this kind person's help - https://stackoverflow.com/a/45546980/6887881

This solved the jpeg issues. Thanks @roh26it

@cz848
Copy link

cz848 commented Aug 20, 2017

I'm still getting error after downgrade fontforge

debug  Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
               License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
               with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
               Based on sources from 15:51 CST 20-Aug-2017-D.
               Based on source from git with hash:
              Traceback (most recent call last):
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 88, in <module>
                  name = createGlyph(glyph, data['source'], data['codepoint'])
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 66, in createGlyph
                  temp = removeSwitchFromSvg(source)
                File "/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py", line 57, in removeSwitchFromSvg
                  tmpsvgfile.file.write(svgtext.encode('utf-8'))
              UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 757: ordinal not in range(128)
       error  `fontforge` compilation failed.
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
/usr/local/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
/usr/local/bin/fontcustom:23:in `load'
/usr/local/bin/fontcustom:23:in `<main>'

@cz848
Copy link

cz848 commented Aug 20, 2017

@kmchen i found a solution for me, you can try this:
edit file/usr/local/lib/ruby/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/scripts/generate.py line 57, replace with:

tmpsvgfile.file.write(svgtext.decode('utf-8').encode('utf-8'))

and gone!

@greencoppercompany
Copy link

greencoppercompany commented Aug 23, 2017

Hi!

Here is our temporary workaround using brew only. Please note this should let you use as default the latest libjpeg version (9) for other tools, even if you may have to unlink/switch version during install steps ;)

# Install fontcustom deps
brew tap bramstein/webfonttools
brew update
brew install woff2

# Install older fontforge version
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d1dfe7b506da542c8828ebd775a1f4f943e55ed7/Formula/fontforge.rb

# Install jpeg 8
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7f16e5aa9451ea391cbb7822a59d2bf702c5b834/Formula/jpeg.rb

# Install other fontcustom deps
brew install eot-utils
gem install fontcustom -v 2.0.0

# Link jpeg8
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dylib

@kohloth
Copy link

kohloth commented Aug 30, 2017

I had an error that was similar to what OP was experiencing:

   error  `fontforge` compilation failed.
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:92:in `create_fonts'
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/generator/font.rb:20:in `generate'
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:62:in `start_generators'
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/base.rb:23:in `compile'
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/lib/fontcustom/cli.rb:83:in `compile'
   /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
   /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
   /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
   /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
   /var/lib/gems/2.3.0/gems/fontcustom-2.0.0/bin/fontcustom:5:in `<top (required)>'
   /usr/local/bin/fontcustom:23:in `load'
   /usr/local/bin/fontcustom:23:in '<main>'

When getting this message, I had actually already installed woff2, but I found that I needed to run sudo apt-get install woff-tools as well.
Please correct me if I am wrong, but shouldn't this be in the linux section of the installation guidelines?

@kmchen
Copy link

kmchen commented Sep 1, 2017

Thanks to @cz848 , it works!!

@EugeneDae
Copy link

Thanks @greencoppercompany !

@jean377
Copy link

jean377 commented Sep 5, 2017

@roh26it
Thanks! That did the trick here.
I only had to add the app binary to the PATH.
export PATH="$PATH:/Applications/FontForge.app/Contents/Resources/opt/local/bin"

@Simek
Copy link
Contributor

Simek commented Sep 7, 2017

@greencoppercompany solution works for me. I've also manage to use latest fontforge version, without downgrading. Only change was linking jpeg.8 as jpeg.9 dylib.
ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.9.dylib

@prakvem
Copy link

prakvem commented Oct 6, 2017

@greencoppercompany Thanks for the solution, but unfortunately No luck.
debug dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.9.dylib Referenced from: /usr/local/opt/libtiff/lib/libtiff.5.dylib Reason: image not found error fontforge compilation failed.
Appreciate If you can us out. Many Thanks

Anyone who can help us, please contact [email protected]

@lexnim
Copy link

lexnim commented Oct 22, 2021

For those still getting fontforge compilation error, i was able to resolve it following this: #382 (comment)

The only missing part was sfnt2woff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests