RailsApps / rails-composer

Rails Composer. The Rails generator on steroids for starter apps.
http://www.railscomposer.com/
3.38k stars 486 forks source link

Errors when building Nokogiri #183

Closed DazDotOne closed 10 years ago

DazDotOne commented 10 years ago

Hey I love the idea of this gem and if/when I get a bit of time to contribute I would very much like to help.

Just running the custom template and I got a few errors in the build process. Here's the full output, I assume you're aware of all this (due to the experimental nature of that feature) but it never hurts to have some more data eh?

    $ rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
           exist  
          create  README.rdoc
          create  Rakefile
          create  config.ru
          create  .gitignore
          create  Gemfile
          create  app
          create  app/assets/javascripts/application.js
          create  app/assets/stylesheets/application.css
          create  app/controllers/application_controller.rb
          create  app/helpers/application_helper.rb
          create  app/views/layouts/application.html.erb
          create  app/assets/images/.keep
          create  app/mailers/.keep
          create  app/models/.keep
          create  app/controllers/concerns/.keep
          create  app/models/concerns/.keep
          create  bin
          create  bin/bundle
          create  bin/rails
          create  bin/rake
          create  config
          create  config/routes.rb
          create  config/application.rb
          create  config/environment.rb
          create  config/secrets.yml
          create  config/environments
          create  config/environments/development.rb
          create  config/environments/production.rb
          create  config/environments/test.rb
          create  config/initializers
          create  config/initializers/assets.rb
          create  config/initializers/backtrace_silencers.rb
          create  config/initializers/cookies_serializer.rb
          create  config/initializers/filter_parameter_logging.rb
          create  config/initializers/inflections.rb
          create  config/initializers/mime_types.rb
          create  config/initializers/session_store.rb
          create  config/initializers/wrap_parameters.rb
          create  config/locales
          create  config/locales/en.yml
          create  config/boot.rb
          create  config/database.yml
          create  db
          create  db/seeds.rb
          create  lib
          create  lib/tasks
          create  lib/tasks/.keep
          create  lib/assets
          create  lib/assets/.keep
          create  log
          create  log/.keep
          create  public
          create  public/404.html
          create  public/422.html
          create  public/500.html
          create  public/favicon.ico
          create  public/robots.txt
          create  test/fixtures
          create  test/fixtures/.keep
          create  test/controllers
          create  test/controllers/.keep
          create  test/mailers
          create  test/mailers/.keep
          create  test/models
          create  test/models/.keep
          create  test/helpers
          create  test/helpers/.keep
          create  test/integration
          create  test/integration/.keep
          create  test/test_helper.rb
          create  tmp/cache
          create  tmp/cache/assets
          create  vendor/assets/javascripts
          create  vendor/assets/javascripts/.keep
          create  vendor/assets/stylesheets
          create  vendor/assets/stylesheets/.keep
           apply  https://raw.github.com/RailsApps/rails-composer/master/composer.rb
        composer  
        composer   _____       _ _
        composer  |  __ \     (_) |       /\
        composer  | |__) |__ _ _| |___   /  \   _ __  _ __  ___
        composer  |  _  // _` | | / __| / /\ \ | '_ | '_ \/ __|
        composer  | | \ \ (_| | | \__ \/ ____ \| |_) | |_) \__ \
        composer  |_|  \_\__,_|_|_|___/_/    \_\ .__/| .__/|___/
        composer                               | |   | |
        composer                               | |   | |
        composer  
        composer  Rails Composer, open source, supported by subscribers.
        composer  Please join RailsApps to support development of Rails Composer.
        composer  Need help? Ask on Stack Overflow with the tag 'railsapps.'
        composer  Your new application will contain diagnostics in its README file.
          insert    config/application.rb
          recipe  Running core recipe...
            core  selected all core recipes
          recipe  Running git recipe...
             git  initialize git
          remove    .gitignore
          create    .gitignore
             run    git init from "."
    Initialized empty Git repository in /Users/user/Documents/rails/work/testers/composer1/.git/
             run    git add -A from "."
             run    git commit -qm "rails_apps_composer: initial commit" from "."
          recipe  Running railsapps recipe...
          option  Build a starter application?
              1)  Build a RailsApps example application
              2)  Contributed applications (none available)
              3)  Custom application (experimental)
          choose  Enter your selection: 3
                  Get on the mailing list for Rails Composer news?
          option  Enter your email address: <-- redacted obvs -->
          recipe  Running learn_rails recipe...
          recipe  Running rails_bootstrap recipe...
          recipe  Running rails_foundation recipe...
          recipe  Running rails_omniauth recipe...
          recipe  Running rails_devise recipe...
          recipe  Running rails_devise_pundit recipe...
          recipe  Running rails_signup_download recipe...
          recipe  Running rails_mailinglist_signup recipe...
          recipe  Running setup recipe...
           setup  Your operating system is darwin13.1.0.
           setup  You are using Ruby version 2.1.2.
           setup  You are using Rails version 4.1.4.
          option  Web server for development?
              1)  WEBrick (default)
              2)  Thin
              3)  Unicorn
              4)  Puma
              5)  Phusion Passenger (Apache/Nginx)
              6)  Phusion Passenger (Standalone)
          choose  Enter your selection: 1
          option  Web server for production?
              1)  Same as development
              2)  Thin
              3)  Unicorn
              4)  Puma
              5)  Phusion Passenger (Apache/Nginx)
              6)  Phusion Passenger (Standalone)
          choose  Enter your selection: 5
          option  Database used in development?
              1)  SQLite
              2)  PostgreSQL
              3)  MySQL
          choose  Enter your selection: 2
          option  Template engine?
              1)  ERB
              2)  Haml
              3)  Slim
          choose  Enter your selection: 1
          option  Test framework?
              1)  None
              2)  RSpec with Capybara
          choose  Enter your selection: 2
           setup  Adding DatabaseCleaner, FactoryGirl, Faker, Launchy, Selenium
          option  Continuous testing?
              1)  None
              2)  Guard
          choose  Enter your selection: 2
          option  Front-end framework?
              1)  None
              2)  Bootstrap 3.0
              3)  Bootstrap 2.3
              4)  Zurb Foundation 5.0
              5)  Zurb Foundation 4.0
              6)  Simple CSS
          choose  Enter your selection: 2
          option  Add support for sending email?
              1)  None
              2)  Gmail
              3)  SMTP
              4)  SendGrid
              5)  Mandrill
          choose  Enter your selection: 3
          option  Authentication?
              1)  None
              2)  Devise
              3)  OmniAuth
          choose  Enter your selection: 2
          option  Devise modules?
              1)  Devise with default modules
              2)  Devise with Confirmable module
              3)  Devise with Confirmable and Invitable modules
          choose  Enter your selection: 1
          option  Authorization?
              1)  None
              2)  Pundit
          choose  Enter your selection: 1
          option  Use a form builder gem?
              1)  None
              2)  SimpleForm
          choose  Enter your selection: 2
          option  Add pages?
              1)  None
              2)  Home
              3)  Home and About
              4)  Home and Users
              5)  Home, About, and Users
          choose  Enter your selection: 5
          create    README
          append    README
          recipe  Running locale recipe...
          option  Set a locale? Enter nothing for English, or es, de, etc: 
          recipe  Running readme recipe...
          recipe  Running gems recipe...
          insert    Gemfile
            gsub    Gemfile
            gsub    Gemfile
            gsub    Gemfile
            gsub    Gemfile
            gsub    Gemfile
             run    git add -A from "."
             run    git commit -qm "rails_apps_composer: Gemfile" from "."
          recipe  Running tests recipe...
          recipe  Running email recipe...
          recipe  Running devise recipe...
          recipe  Running omniauth recipe...
          recipe  Running roles recipe...
          recipe  Running frontend recipe...
          recipe  Running pages recipe...
          recipe  Running init recipe...
          recipe  Running analytics recipe...
          option  Install page-view analytics?
              1)  None
              2)  Google Analytics
              3)  Segment.io
          choose  Enter your selection: 2
          option  Google Analytics ID? 
          recipe  Running deployment recipe...
          option  Add a deployment mechanism?
              1)  None
              2)  Capistrano3
          choose  Enter your selection: 2
      deployment  recipe adding capistrano gems
          recipe  Running extras recipe...
          option  Set a robots.txt file to ban spiders? (y/n) y
          option  Create a GitHub repository? (y/n) n
          option  Add gem and file for environment variables?
              1)  None
              2)  Add .env with Foreman
              3)  Add application.yml with Figaro
          choose  Enter your selection: 3
          option  Reduce assets logger noise during development? (y/n) y
          option  Improve error reporting with 'better_errors' during development? (y/n) y
          option  Use 'pry' as console replacement during development and test? (y/n) y
          extras  recipe setting quiet_assets for reduced asset pipeline logging
          extras  recipe creating application.yml file for environment variables with figaro
          extras  recipe adding better_errors gem
          extras  recipe adding pry-rails gem
          extras  recipe banning spiders by modifying 'public/robots.txt'
        composer  Installing gems. This will take a while.
             run    bundle install --without production from "."
    Fetching gem metadata from https://rubygems.org/........
    Fetching additional metadata from https://rubygems.org/..
    Resolving dependencies...
    Installing rake 10.3.2
    Using i18n 0.6.11
    Using json 1.8.1
    Using minitest 5.4.0
    Using thread_safe 0.3.4
    Using tzinfo 1.2.1
    Using activesupport 4.1.4
    Using builder 3.2.2
    Using erubis 2.7.0
    Using actionview 4.1.4
    Using rack 1.5.2
    Using rack-test 0.6.2
    Using actionpack 4.1.4
    Using mime-types 1.25.1
    Using polyglot 0.3.5
    Using treetop 1.4.15
    Using mail 2.5.4
    Using actionmailer 4.1.4
    Using activemodel 4.1.4
    Using arel 5.0.1.20140414130214
    Using activerecord 4.1.4
    Installing addressable 2.3.6
    Installing bcrypt 3.1.7
    Installing coderay 1.1.0
    Installing better_errors 1.1.0
    Installing debug_inspector 0.0.2
    Installing binding_of_caller 0.7.2
    Installing sass 3.2.19
    Installing bootstrap-sass 3.2.0.0
    Using bundler 1.6.2
    Installing colorize 0.7.3
    Installing net-ssh 2.9.1
    Installing net-scp 1.2.1
    Installing sshkit 1.5.1
    Installing capistrano 3.0.1
    Installing capistrano-bundler 1.1.2
    Installing capistrano-rails 1.1.0
    Installing capistrano-rails-console 0.2.0
    Installing capistrano-rvm 0.1.1
    Installing mini_portile 0.6.0
    Building nokogiri using system libraries.

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

        /Users/user/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb --use-system-libraries
    Building nokogiri using system libraries.
    libxml2 version 2.6.21 or later is required!
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  You may
    need configuration options.

    Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/user/.rvm/rubies/ruby-2.1.2/bin/ruby
        --help
        --clean
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include
        --without-exslt-include=${exslt-dir}/include
        --with-exslt-lib
        --without-exslt-lib=${exslt-dir}/lib
        --with-libexslt-config
        --without-libexslt-config

    extconf failed, exit code 1

    Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.1.2@composer1/gems/nokogiri-1.6.2.1 for inspection.
    Results logged to /Users/user/.rvm/gems/ruby-2.1.2@composer1/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.2.1/        gem_make.out
    An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
    Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
        composer  Updating gem paths.
        composer  Stage Two (running recipe 'stage_two' callbacks).
    locale
    gems
            gems  recipe stage two
            gems  configuring database
          remove    config/database.yml
          create    config/database.yml
          option  Username for PostgreSQL?(leave blank to use the app name) 
          option  Host for PostgreSQL in database.yml? (leave blank to use default socket connection) 
            gems  Creating a user named 'composer1' for PostgreSQL
             run    createuser --createdb composer1 from "."
            gsub    config/database.yml
            gsub    config/database.yml
            gsub    config/database.yml
            gsub    config/database.yml
          option  Okay to drop all existing databases named composer1? 'No' will abort immediately! (y/n) y
             run    bundle exec rake db:drop from "."
    Could not find gem 'figaro (>= 1.0.0.rc1) ruby' in the gems available on this machine.
    Run `bundle install` to install missing gems.
             run    bundle exec rake db:create:all from "."
    Could not find gem 'figaro (>= 1.0.0.rc1) ruby' in the gems available on this machine.
    Run `bundle install` to install missing gems.
             run    git add -A from "."
             run    git commit -qm "rails_apps_composer: create database" from "."
    gems
            gems  recipe stage two
            gems  running generators
            gems  recipe installing simple_form for use with Bootstrap
        generate    simple_form:install --bootstrap
    Could not find gem 'figaro (>= 1.0.0.rc1) ruby' in the gems available on this machine.
    Run `bundle install` to install missing gems.
        generate    figaro:install
    Could not find gem 'figaro (>= 1.0.0.rc1) ruby' in the gems available on this machine.
    Run `bundle install` to install missing gems.
            gsub    config/application.yml
    The template [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] could not be loaded. Error: No such file         or directory @ rb_sysopen - /Users/user/Documents/rails/work/testers/composer1/config/application.yml        
DazDotOne commented 10 years ago

Follow up

    $ gem install nokogiri -v '1.6.2.1'
    Building native extensions.  This could take a while...
    Building nokogiri using packaged libraries.
    Building libxml2-2.8.0 for nokogiri with the following patches applied:
      - 0001-Fix-parser-local-buffers-size-problems.patch
      - 0002-Fix-entities-local-buffers-size-problems.patch
      - 0003-Fix-an-error-in-previous-commit.patch
      - 0004-Fix-potential-out-of-bound-access.patch
      - 0005-Detect-excessive-entities-expansion-upon-replacement.patch
      - 0006-Do-not-fetch-external-parsed-entities.patch
      - 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
      - 0008-Improve-handling-of-xmlStopParser.patch
      - 0009-Fix-a-couple-of-return-without-value.patch
      - 0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
      - 0011-Do-not-fetch-external-parameter-entities.patch
    ************************************************************************
    IMPORTANT!  Nokogiri builds and uses a packaged version of libxml2.

    If this is a concern for you and you want to use the system library
    instead, abort this installation process and reinstall nokogiri as
    follows:

        gem install nokogiri -- --use-system-libraries

    If you are using Bundler, tell it to use the option:

        bundle config build.nokogiri --use-system-libraries
        bundle install

    However, note that nokogiri does not necessarily support all versions
    of libxml2.

    For example, libxml2-2.9.0 and higher are currently known to be broken
    and thus unsupported by nokogiri, due to compatibility problems and
    XPath optimization bugs.
    ************************************************************************
    Building libxslt-1.1.28 for nokogiri with the following patches applied:
      - 0001-Adding-doc-update-related-to-1.1.28.patch
      - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
      - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
      - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
      - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
      - 0007-Separate-function-for-predicate-matching-in-patterns.patch
      - 0008-Fix-direct-pattern-matching.patch
      - 0009-Fix-certain-patterns-with-predicates.patch
      - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
      - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
      - 0014-Fix-for-bug-436589.patch
      - 0015-Fix-mkdir-for-mingw.patch
    ************************************************************************
    IMPORTANT!  Nokogiri builds and uses a packaged version of libxslt.

This seems to be where a lot of issues are coming from then. Having manually installed nokogiri, the bundle install works as expected.

DanielKehoe commented 10 years ago

Nokogiri is a gem that requires compilation for your specific operating system. As such, if your system environment doesn't match Nokogiri's requirements, compilation of Nokogiri will fail, bundler will not be able to continue, and Rails Composer will abort. If you fix your system so gem install nokogiri succeeds, Rails Composer will run successfully.

Every time a new version of Nokogiri is released, many people have problems with failing to build because of problems with their local system environments.