fastlane: Installing plugin fails

I’m trying to install the plugin with fastlane 2.19.1 on macOS 10.12.3 with XCode 8.2.1. The installation fails with the following error:

$ fastlane add_plugin instrumented_tests
+---------------------------------------------+---------+-----------------------------+
|                                    Used plugins                                     |
+---------------------------------------------+---------+-----------------------------+
| Plugin                                      | Version | Action                      |
+---------------------------------------------+---------+-----------------------------+
| fastlane-plugin-automated_test_emulator_run | 1.3.2   | automated_test_emulator_run |
+---------------------------------------------+---------+-----------------------------+

[11:51:10]: Plugin 'fastlane-plugin-instrumented_tests' was added to './fastlane/Pluginfile'
[11:51:10]: Make sure to commit your Gemfile, Gemfile.lock and Pluginfile to version control
Installing plugin dependencies...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/xxx/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3/ext/json/ext/generator
/Users/xxx/.fastlane/bin/bundle/bin/ruby -r ./siteconf20170303-7561-1yddh4i.rb extconf.rb 
creating Makefile

current directory: /Users/xxx/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/xxx/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Users/xxx/.fastlane/bin/bundle/include/ruby-2.2.0/ruby.h:33:
In file included from /Users/xxx/.fastlane/bin/bundle/include/ruby-2.2.0/ruby/ruby.h:29:
/Users/xxx/.fastlane/bin/bundle/include/ruby-2.2.0/ruby/defines.h:26:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/xxx/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3 for inspection.
Results logged to /Users/xxx/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/json-2.0.3/gem_make.out

An error occurred while installing json (2.0.3), and Bundler cannot continue.
Make sure that `gem install json -v '2.0.3'` succeeds before bundling.

I ran gem install json -v '2.0.3' as admin user and successfully installed the gem. Unfortunately it didn’t fix the problem. I’m still getting the same error.

$ gem list

*** LOCAL GEMS ***

bigdecimal (1.2.0)
CFPropertyList (2.2.8)
io-console (0.4.2)
json (2.0.3, 1.7.7)
libxml-ruby (2.6.0)
minitest (4.3.2)
nokogiri (1.5.6)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
sqlite3 (1.3.7)
test-unit (2.0.0.0)
✅ fastlane environment ✅

Stack

Key Value
OS 10.12.3
Ruby 2.2.4
Bundler? false
Git git version 2.10.1 (Apple Git-78)
Installation Source ~/.fastlane/bin/bundle/bin/fastlane
Host Mac OS X 10.12.3 (16D32)
Ruby Lib Dir ~/.fastlane/bin/bundle/lib
OpenSSL Version OpenSSL 1.0.2g 1 Mar 2016
Is contained true
Is homebrew false
Xcode Path /Applications/Xcode821.app/Contents/Developer/
Xcode Version 8.2.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE en_US.UTF-8

fastlane gems

Gem Version Update-Status
fastlane 2.19.1 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-automated_test_emulator_run 1.3.2 ✅ Up-To-Date
fastlane-plugin-instrumented_tests 0.1.5 ✅ Up-To-Date
Loaded gems
Gem Version
CFPropertyList 2.3.5
activesupport 4.2.7.1
addressable 2.5.0
babosa 1.0.2
bigdecimal 1.2.6
bundler 1.14.3
claide 1.0.1
colored 1.2
commander 4.4.3
domain_name 0.5.20161129
dotenv 2.2.0
excon 0.55.0
excon 0.54.0
faraday 0.11.0
faraday-cookie_jar 0.0.6
faraday_middleware 0.11.0.1
fastimage 2.1.0
fastimage 2.0.1
fastlane-plugin-automated_test_emulator_run 1.3.2
fastlane-plugin-instrumented_tests 0.1.5
gh_inspector 1.0.3
google-api-client 0.9.26
googleauth 0.5.1
highline 1.7.8
http-cookie 1.0.3
httpclient 2.8.3
hurley 0.2
i18n 0.8.1
i18n 0.7.0
io-console 0.4.3
json 1.8.1
jwt 1.5.6
libxml-ruby 2.9.0
little-plugger 1.1.4
logging 2.1.0
memoist 0.15.0
mime-types 3.1
mime-types-data 3.2016.0521
mini_magick 4.5.1
minitest 5.10.1
minitest 5.4.3
multi_json 1.12.1
multi_xml 0.6.0
multipart-post 2.0.0
nanaimo 0.2.3
nokogiri 1.5.6
os 0.9.6
plist 3.2.0
power_assert 0.2.2
psych 2.0.8
public_suffix 2.0.5
rake 10.4.2
rdoc 4.2.0
representable 2.3.0
retriable 2.1.0
rouge 1.11.1
rubygems-update 2.5.2
rubyzip 1.2.1
rubyzip 1.2.0
security 0.1.3
signet 0.7.3
slack-notifier 1.5.1
sqlite3 1.3.13
terminal-notifier 1.7.1
terminal-table 1.7.3
test-unit 3.0.8
thread_safe 0.3.6
thread_safe 0.3.5
tty-screen 0.5.0
tzinfo 1.2.2
uber 0.0.15
unf 0.1.4
unf_ext 0.0.7.2
unicode-display_width 1.1.3
word_wrap 1.0.0
xcodeproj 1.4.2
xcpretty 0.2.4
xcpretty-travis-formatter 0.0.4

generated on: 2017-03-03

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 47 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @brianlenz could you try running bundle install and then trying bundle exec fastlane add_plugin appicon one more time?

In case anybody else has similar issues, once I did the above, I ran into issues with OpenSSL in some fastlane commands. So, I decided to start over: installed openssl and ruby via Homebrew, reinstalled fastlane via Homebrew, trashed the ~/.fastlane/ directory again, and then ran everything through bundle (using the Homebrew Ruby installation instead of macOS Ruby):

bundle install bundle exec fastlane upgrade_plugins bundle exec fastlane [lane]

Everything is working flawlessly now, no sudo required.

Thanks again, @ohayon!

Oh, no worries; your help is much appreciated.

I used sudo for the rm -rf ~/.fastlane, as apparently some of those files were owned by root, too. Now it works!

$ sudo bundle exec fastlane add_plugin appicon
+-------------------------+---------+-----------------+
|                    Used plugins                     |
+-------------------------+---------+-----------------+
| Plugin                  | Version | Action          |
+-------------------------+---------+-----------------+
| fastlane-plugin-appicon | 0.5.2   | android_appicon |
|                         |         | appicon         |
+-------------------------+---------+-----------------+

[13:52:21]: Make sure to commit your Gemfile, Gemfile.lock and Pluginfile to version control
Installing plugin dependencies...
Successfully installed plugins

Thanks again!

Hi Everyone!

If you are getting stuck by this issue, you can work around it by creating a Gemfile in your project’s directory and executing fastlane by using bundle exec fastlane <actions>. This will ensure that you will always have the plugins necessary for your fastlane execution.

We will update this issue as we get more information and have a proposed fix! 🚀

Please continue to let us know if you are still experiencing this issue!

Thanks! 🐙

@hjanuschka I think it is definitely related to the contained version.

The problem should be the following line:

clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'

I’m guessing that all the people who have this problem have macOS 10.12? /cc @multiholle @jaydrogers @j2kun

My best guess would be that the sysroot for the ruby installation in the contained version gets set to the above line, which is not valid on 10.12, so it fails when trying to install a plugin with native extensions. <strike> As a workaround, manually creating a link like ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk should probably work. </strike> Nevermind, I just set up a test project and it doesn’t.

Just a note… I have this exact same issue but instead of a plugin it’s using the badge action (or is that a plugin?).

I then try to follow your suggestion of adding a Gemfile to the project and using bundle but despite adding the file with gem 'badge' I was getting the following error:

Add ‘gem “badge”’ to your Gemfile and restart fastlane

I ended up just removing the badge step from my fastfile for now but would be good to get a proper fix to this

Thanks for all of your suggestions on this thread. Since I am running macOS 10.12.3, I attempted the suggestion from @milch and now I am getting new errors:

Output when I attempt fastlane add_plugin cordova:

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

    current directory: /Users/user/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3/ext/json/ext/parser
/Users/user/.fastlane/bin/bundle/bin/ruby -r ./siteconf20170308-6694-5c17he.rb extconf.rb 
checking for rb_enc_raise() in ruby.h... *** 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/.fastlane/bin/bundle/bin/$(RUBY_BASE_NAME)
/Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:1020:in `block in have_func'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:321:in `open'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:321:in `open'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
	from /Users/user/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:1019:in `have_func'
	from extconf.rb:4:in `<main>'

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

  /Users/user/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/json-2.0.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/user/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/json-2.0.3 for inspection.
Results logged to /Users/user/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/json-2.0.3/gem_make.out

An error occurred while installing json (2.0.3), and Bundler cannot continue.
Make sure that `gem install json -v '2.0.3'` succeeds before bundling.

Here is my mkmf.log:

"/usr/bin/clang -o conftest -I/Users/user/.fastlane/bin/bundle/include/ruby-2.2.0/x86_64-darwin15 -I/Users/user/.fastlane/bin/bundle/include/ruby-2.2.0/ruby/backward -I/Users/user/.fastlane/bin/bundle/include/ruby-2.2.0 -I. -I~/.fastlane/bundle/bin/dependencies/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -pipe conftest.c  -L. -L/Users/user/.fastlane/bin/bundle/lib -L. -L~/.fastlane/bundle/bin/dependencies/lib -fstack-protector     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L~/.fastlane/bundle/bin/dependencies/lib'
ld: library not found for -lruby-static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Here is the output of gem install json -v '2.0.3':

You can see that it doesn’t run into any issue.

Building native extensions.  This could take a while...
Successfully installed json-2.0.3
Parsing documentation for json-2.0.3
Done installing documentation for json after 0 seconds
1 gem installed

Thanks again for all of your help!

the contained version ships with it’s own ruby version and all sort of libraries - but for whatever reason it has problems building gems that require C extensions.

the only workaround i see right now is switching to rvm/rbenv based install - but i do not recommend this, i would wait for @ohayon - maybe there is a easy fix in the contained version.

i already pinged the right members.

This appears not to be fixed in v2.20.0

Sure thing!

$ sudo bundle install
Password:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Using CFPropertyList 2.3.5
Using i18n 0.8.1
Using minitest 5.10.1
Using thread_safe 0.3.6
Using public_suffix 2.0.5
Using babosa 1.0.2
Using claide 1.0.1
Using colored 1.2
Using highline 1.7.8
Using unf_ext 0.0.7.2
Using dotenv 2.2.0
Using excon 0.55.0
Using multipart-post 2.0.0
Using fastimage 2.1.0
Using bundler 1.12.5
Using gh_inspector 1.0.3
Using jwt 1.5.6
Using little-plugger 1.1.4
Using multi_json 1.12.1
Using memoist 0.15.0
Using os 0.9.6
Using httpclient 2.8.3
Using hurley 0.2
Using mime-types-data 3.2016.0521
Using uber 0.0.15
Using retriable 2.1.0
Using json 2.0.3
Using mini_magick 4.5.1
Using multi_xml 0.6.0
Using plist 3.2.0
Using rubyzip 1.2.1
Using security 0.1.3
Using slack-notifier 1.5.1
Using terminal-notifier 1.7.1
Using unicode-display_width 1.1.3
Using tty-screen 0.5.0
Using word_wrap 1.0.0
Using nanaimo 0.2.3
Using rouge 1.11.1
Using tzinfo 1.2.2
Using addressable 2.5.0
Using commander 4.4.3
Using unf 0.1.4
Using faraday 0.11.0
Using logging 2.2.0
Using mime-types 3.1
Using representable 2.3.0
Using fastlane-plugin-appicon 0.5.2
Using terminal-table 1.7.3
Using xcpretty 0.2.4
Using activesupport 4.2.8
Using domain_name 0.5.20170223
Using faraday_middleware 0.11.0.1
Using signet 0.7.3
Using xcpretty-travis-formatter 0.0.4
Using xcodeproj 1.4.2
Using http-cookie 1.0.3
Using googleauth 0.5.1
Using faraday-cookie_jar 0.0.6
Using google-api-client 0.9.28
Using fastlane 2.19.3
Bundle complete! 2 Gemfile dependencies, 61 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

bundle exec fastlane add_plugin appicon still gives the same error. Should I run that via sudo, as well?

@jaydrogers FWIW, I was trying to install the same plugin and ran into the same issue. It appears to be depending on a library (ruby-static) that is installed as part of the ruby development platform. I was able to download just that library from >here<. (it’s an RPM). Dropped the unpacked libruby-static.a into ~/.fastlane/bin/dependencies/lib and it finally installed correctly. Alternatively, I read another thread >here< that suggested that you could update the ruby install and it would provide the library that way. Good luck.

This plugin better be worth the trouble 😛

👍 I wonder if there is a way to avoid using the absolute path there in the first place. I am going to try to track down the source of that.

I did a bit of googling, but I don’t think there is. (EDIT: specifically, briefly looking at https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb (the file that is used to create the configuration) it seems that expand_path is called on paths that are passed in)

Do you have a hunch that if we built this against macOS 10.12 SDK that this would be 👌 ?

No, I think just building against 10.12 would only shift the issue from people who have 10.12 installed to people who have 10.11 installed. A better fix would be to use /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk as $SYSROOT when building, I think that should be the same on both 10.12 and 10.11. I don’t have a machine with 10.11 on it to test that, though.