简体   繁体   中英

Capistrano 3 error - extconf.rb:29:in `<main>': The “libxml2” package isn't available. (RuntimeError)

When I tried to deploy some new code today, I've got this error message:

  01 Warning, new version of rvm available '1.29.3', you are using older version '1.29.2'.
  01 You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
  01 You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
  01 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  01
  01 current directory:
  01 /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/gems/ovirt-engine-sdk-4.2.4/ext/ovirtsdk4c
  01 /home/deployer/.rvm/rubies/ruby-2.3.3/bin/ruby -r
  01 ./siteconf20180429-31340-1net0o9.rb extconf.rb
  01 checking for xml2-config... no
  01 *** extconf.rb failed ***
  01 Could not create Makefile due to some reason, probably lack of necessary
  01 libraries and/or headers.  Check the mkmf.log file for more details.  You may
  01 need configuration options.
  01
  01 Provided configuration options:
  01    --with-opt-dir
  01    --without-opt-dir
  01    --with-opt-include
  01    --without-opt-include=${opt-dir}/include
  01    --with-opt-lib
  01    --without-opt-lib=${opt-dir}/lib
  01    --with-make-prog
  01    --without-make-prog
  01    --srcdir=.
  01    --curdir
  01    --ruby=/home/deployer/.rvm/rubies/ruby-2.3.3/bin/$(RUBY_BASE_NAME)
  01    --with-libxml2-config
  01    --without-libxml2-config
  01    --with-pkg-config
  01    --without-pkg-config
  01 extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)
  01
  01 To see why this extension failed to compile, please check the mkmf.log which can
  01 be found here:
  01
  01 /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.2.4/mkm…
  01
  01 extconf failed, exit code 1
  01
  01 Gem files will remain installed in
  01 /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/gems/ovirt-engine-sdk-4.2.4
  01 for inspection.
  01 Results logged to
  01 /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.2.4/gem…
  01
  01 An error occurred while installing ovirt-engine-sdk (4.2.4), and Bundler cannot
  01 continue.
  01 Make sure that `gem install ovirt-engine-sdk -v '4.2.4'` succeeds before
  01 bundling.

Locally (OSX) the app is running great. Today, I tried to deploy it on the staging server and faced this error (out of the blue, I just modified some content).

I tried to add the gem ovirt-engine-sdk to the Gemfile , but it didn't work out. I tried to log in on the server (Ubuntu) and install it there, it got installed, but the the deployment failed again.

When I looked to the mkmf.log file, this is its content:

find_executable: checking for xml2-config... -------------------- no

--------------------

"pkg-config --exists libxml2"
package configuration for libxml2 is not found
deployer@ip-172-31-46-41:~$ cat /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.2.4/gem_make.out
current directory: /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/gems/ovirt-engine-sdk-4.2.4/ext/ovirtsdk4c
/home/deployer/.rvm/rubies/ruby-2.3.3/bin/ruby -r ./siteconf20180429-31340-1net0o9.rb extconf.rb
checking for xml2-config... no
*** 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=/home/deployer/.rvm/rubies/ruby-2.3.3/bin/$(RUBY_BASE_NAME)
    --with-libxml2-config
    --without-libxml2-config
    --with-pkg-config
    --without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/deployer/apps/app-staging/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.2.4/mkmf.log

extconf failed, exit code 1

I also tried to install (again, but I remember that 2 years ago, when I was setting up the server, I installed it - other gems needed it) libxml2 , the installation went well, but when I tried to deploy the app again - again the same error.

I am not sure where to look as what might be wrong, because I haven't modified the configuration of the application in any way, so the occurrence of this error looks a bit like a mystery.

The difficult thing here's that I am not even sure where to start debugging the issue - the error has absolutely nothing to do with the content changes made in the app.

Thank you for any help!

Have you tried reinstalling the development package for xml2 ?

apt-get install libxml2-dev

This should work imo. Else, can you look for the library (.so) in your system and check the symlink is not broken ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM