How to install Fastlane on Buddybuild

546 views Asked by At

I try to install Fastlane in a pre build step on Buddybuild.

My pre build script looks like this:

#!/bin/bash
if ! which fastlane >/dev/null; then
   echo "Installing fastlane this may need sudo"
   sudo gem install fastlane
else
   echo "Updating fastlane this may need sudo"
   sudo gem update fastlane
fi

I get the following error:

ERROR: Error installing fastlane:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 mkrf_conf.rb .
Building native extensions. This could take a while... /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError) .
/usr/bin/ruby2.1 extconf.rb .
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h extconf failed, exit code 1

How can I solve this?

Rest of the Log

Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/gems/unf_ext-0.0.7.4 for inspection. Results logged to /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/extensions/x86_64-linux/2.1.0/unf_ext-0.0.7.4/gem_make.out from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in block in build from /usr/lib/ruby/2.1.0/tempfile.rb:324:in 'open' from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in 'build' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in 'block (2 levels) in build_extension' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'chdir' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'block in build_extension' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in 'synchronize' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in 'block in build_extensions' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'each' from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'build_extensions' from /usr/lib/ruby/2.1.0/rubygems/installer.rb:677:in 'build_extensions' from /usr/lib/ruby/2.1.0/rubygems/installer.rb:232:in 'install' from /usr/lib/ruby/2.1.0/rubygems/resolver/specification.rb:78:in 'install' from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:206:in 'block in install_into' from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'each' from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'install_into' from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:119:in 'install' from /usr/lib/ruby/2.1.0/rubygems/dependency_installer.rb:389:in 'install' from mkrf_conf.rb:15:in '' rake failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/unf-0.2.0.beta2/gem_make.out

2

There are 2 answers

0
Tal Zion On

Change your script to:

 if ! which fastlane >/dev/null; then
    echo "Installing fastlane..."
    echo password | sudo -S gem install fastlane
else
    echo "Updating fastlane..."
    echo password | sudo -S gem update fastlane
fi
0
Romain Pouclet On

Our recommendation (and, as it turns out, fastlane's) is to use bundler and a Gemfile to achieve that. It lets you use a specific version of fastlane and, as a bonus, don't require sudo.

Let me know if this helps!