iOS Fastlane build fails on bundle install `digest-crc` dependency on Xcode 12 beta 3 image

I am trying to adopt an already working pipeline to make builds using Xcode12 beta 3 image.
One of the first steps I have is installing fastlane on the image which I run with bundle install --path .bundle. I have only Fastlane in my bundle.
This fails on the installation of dependencies phase:

#!/bin/bash --login -eo pipefail
bundle install --path .bundle
[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path '.bundle'`, and stop using this flag
Fetching gem metadata from https://rubygems.org/........
Fetching rake 13.0.1
Installing rake 13.0.1
Fetching CFPropertyList 3.0.2
Installing CFPropertyList 3.0.2
Fetching public_suffix 4.0.5
Installing public_suffix 4.0.5
Fetching addressable 2.7.0
Installing addressable 2.7.0
Fetching atomos 0.1.3
Installing atomos 0.1.3
Fetching aws-eventstream 1.1.0
Installing aws-eventstream 1.1.0
Fetching aws-partitions 1.351.0
Installing aws-partitions 1.351.0
Fetching aws-sigv4 1.2.1
Installing aws-sigv4 1.2.1
Fetching jmespath 1.4.0
Installing jmespath 1.4.0
Fetching aws-sdk-core 3.104.3
Installing aws-sdk-core 3.104.3
Fetching aws-sdk-kms 1.36.0
Installing aws-sdk-kms 1.36.0
Fetching aws-sdk-s3 1.75.0
Installing aws-sdk-s3 1.75.0
Fetching babosa 1.0.3
Installing babosa 1.0.3
Using bundler 2.1.4
Fetching claide 1.0.3
Installing claide 1.0.3
Fetching colored 1.2
Installing colored 1.2
Fetching colored2 3.1.2
Installing colored2 3.1.2
Fetching highline 1.7.10
Installing highline 1.7.10
Fetching commander-fastlane 4.4.6
Installing commander-fastlane 4.4.6
Fetching declarative 0.0.20
Installing declarative 0.0.20
Fetching declarative-option 0.1.0
Installing declarative-option 0.1.0
Fetching digest-crc 0.6.1
Installing digest-crc 0.6.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/distiller/project/.bundle/ruby/2.6.0/gems/digest-crc-0.6.1/ext/digest
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -rrubygems
/Users/distiller/project/.bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake
RUBYARCHDIR\=/Users/distiller/project/.bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/digest-crc-0.6.1
RUBYLIBDIR\=/Users/distiller/project/.bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/digest-crc-0.6.1
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -S
extconf.rb
checking for stdint.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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in
`block in try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in
`with_werror'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in
`try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in
`block in have_header'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in
`block in checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block (2 levels) in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in
`postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
`checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in
`have_header'
	from extconf.rb:3:in `<main>'
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
/Users/distiller/project/.bundle/ruby/2.6.0/gems/digest-crc-0.6.1/ext/digest/Rakefile:32:in
`block (3 levels) in <top (required)>'
/Users/distiller/project/.bundle/ruby/2.6.0/gems/digest-crc-0.6.1/ext/digest/Rakefile:31:in
`chdir'
/Users/distiller/project/.bundle/ruby/2.6.0/gems/digest-crc-0.6.1/ext/digest/Rakefile:31:in
`block (2 levels) in <top (required)>'
/Users/distiller/project/.bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in
`<main>'
Tasks: TOP => default => crc16_genibus/crc16_genibus_ext.bundle =>
crc16_genibus/Makefile
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in
/Users/distiller/project/.bundle/ruby/2.6.0/gems/digest-crc-0.6.1 for
inspection.
Results logged to
/Users/distiller/project/.bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/digest-crc-0.6.1/gem_make.out

An error occurred while installing digest-crc (0.6.1), and Bundler
cannot continue.
Make sure that `gem install digest-crc -v '0.6.1' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  fastlane was resolved to 2.154.0, which depends on
    google-cloud-storage was resolved to 1.27.0, which depends on
      digest-crc

Exited with code exit status 5

I have already seen this https://github.com/fastlane/fastlane/issues/16725 but it seems that it was resolved already for that specific case.

It seems that the same pipeline works fine if the image is Xcode 11.6.0. I’d appreciate any thoughts on this.

P.S. my Gemfile

source "https://rubygems.org"

gem "fastlane"


plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

I am having the same issue, it’s strange to me because I can get it to work fine on 10.5.6 on my local machine, ruby version is the same across 11.6.0 and 12.0.0 as well.

That error is consistent with not having the Xcode command-line tools install. The ordinary solution is to run: xcode-select --install before the build.

I do not know if this has something to do with Xcode 12 or with CircleCI’s image. Maybe try inserting that command towards the beginning of your pipeline.

@klsetzer :wave: The Beta command line tools are installed in the image. Since beta 3 these issues have started cropping up and I believe it is due to changes in Clang to do with the universal tools (with beta 3 Apple merged Xcode for Universal Apps into Xcode proper).

Most gems that build with native extensions seem affected and this is particularly the case if you are using the System Ruby. In some cases this can be resolved by switching to Ruby 2.7, however your mileage may vary right now due to the nature of the tooling being in beta still: https://support.circleci.com/hc/en-us/articles/360047066532