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

fastlane update_fastlane fails because of native extensions building failure #92

Open
0xced opened this issue Oct 12, 2018 · 1 comment
Assignees

Comments

@0xced
Copy link
Contributor

0xced commented Oct 12, 2018

Documenting how I resolved this issue if anyone else also stumbles on it.

I just tried to run fastlane update_fastlane and it failed with this error:

Updating installed gems
Updating fastlane
Building native extensions.  This could take a while...
Gems updated: msgpack
Gems already up-to-date: fastlane
ERROR:  Error installing fastlane:
	ERROR: Failed to build gem native extension.

    current directory: ~/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/msgpack-1.2.4/ext/msgpack
~/.fastlane/bin/bundle/bin/ruby -r ./siteconf20181012-30133-1kxu5zj.rb extconf.rb
checking for ruby/st.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=~/.fastlane/bin/bundle/bin/$(RUBY_BASE_NAME)
~/.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 ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:321:in `open'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:321:in `open'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
	from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
	from extconf.rb:3:in `<main>'

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

  ~/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/msgpack-1.2.4/mkmf.log

extconf failed, exit code 1

Looking the mkmf.log file reveals the issue:

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

This /Applications/Xcode-7.3.1.app path comes from ~/.fastlane/bin/bundle/lib/ruby/2.2.0/x86_64-darwin15/rbconfig.rb

After replacing the two occurrences of /Applications/Xcode-7.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk in the rbconfig.rb file with /Applications/Xcode/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk (notice I also replaced MacOSX10.11.sdk with MacOSX.sdk) I got another error (mkmf.log):

"/usr/bin/clang -o conftest -I~/.fastlane/bin/bundle/include/ruby-2.2.0/x86_64-darwin15 -I~/.fastlane/bin/bundle/include/ruby-2.2.0/ruby/backward -I~/.fastlane/bin/bundle/include/ruby-2.2.0 -I. -I/Users/crashlytics/buildAgent/work/2484be8b71880c21/bundle-2.28.3/fastlane_lib/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/MacOSX.sdk -pipe conftest.c  -L. -L~/.fastlane/bin/bundle/lib -L. -L/Users/crashlytics/buildAgent/work/2484be8b71880c21/bundle-2.28.3/fastlane_lib/dependencies/lib -fstack-protector     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/Users/crashlytics/buildAgent/work/2484be8b71880c21/bundle-2.28.3/fastlane_lib/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 */

So I deleted -I/Users/crashlytics/buildAgent/work/2484be8b71880c21/bundle-2.28.3/fastlane_lib/dependencies/include in the rbconfig.rb file (CONFIG["CPPFLAGS"] line) and I deleted -L/Users/crashlytics/buildAgent/work/2484be8b71880c21/bundle-2.28.3/fastlane_lib/dependencies/lib (CONFIG["LDFLAGS"] line) and tried again.

Then the next error was this (it was actually already in the previous error but I missed it):

"/usr/bin/clang -o conftest -I~/.fastlane/bin/bundle/include/ruby-2.2.0/x86_64-darwin15 -I~/.fastlane/bin/bundle/include/ruby-2.2.0/ruby/backward -I~/.fastlane/bin/bundle/include/ruby-2.2.0 -I. -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/MacOSX.sdk -pipe conftest.c  -L. -L~/.fastlane/bin/bundle/lib -L. -fstack-protector     -lruby-static -framework CoreFoundation  -lpthread -ldl -lobjc "
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 */

So I edited rbconfig.rb again and replaced CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_STATIC)" with CONFIG["LIBRUBYARG"] = ""

Finally, I was able to update my packaged fastlane with fastlane update_fastlane and the native extensions were built successfully. 🎉

@getaaron
Copy link
Collaborator

Thanks for this @0xced, @joshdholtz is working on a fix

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

3 participants