Runner unable to create ios build as "'ruby/config.h' file not found" during "bundle install"
Sorry i already raised this here: https://gitlab.com/gitlab-org/gitlab/-/issues/288152 , but didn't realise there was a dedicated issues section for gitlab-runner.
I have created a runner on OSX 10.15.7 with XCode 12.2 in order to create a react native iOS build.
I know the setup on the machine is fine as I have created the builds locally, however when I try to run "bundle install" on the runner, i get the following error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
fatal error: 'ruby/config.h' file not found
I have been researching this for days now and it seems to come does to the ruby version. I fount the same problem mentioned over at CircleCi: Since switching to Xcode 11 you receive "Failed to build gem native extension"
Based on this i have tried installing various ruby versions and even switching to them as an actual step in the job.
Thanks in advance for your help, the entire readout is below:
Running with gitlab-runner 13.6.0 (8fa89735)
2 on [some-machine] stYf7G1e
3
Preparing the "shell" executor
00:00
4Using Shell executor...
6
Preparing environment
00:00
7Running on [some-machine]...
9
Getting source from Git repository
00:13
10Fetching changes with git depth set to 50...
11Reinitialized existing Git repository in [some-url].git/
12Checking out 6924469f as fix/move-to-root...
13Removing .env
14Removing ios/vendor/
15Removing node_modules/
16Skipping Git submodules setup
18
Restoring cache
00:00
19Checking cache for fix-move-to-root...
20Runtime platform arch=amd64 os=darwin pid=74209 revision=8fa89735 version=13.6.0
21No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
22Successfully extracted cache
24
Executing "step_script" stage of the job script
00:53
25$ yarn generate-dotenv
26yarn run v1.21.1
27$ sh ci/scripts/generate-dotenv.sh > .env
28Done in 0.09s.
29$ yarn
30yarn install v1.21.1
31[1/4] Resolving packages...
32[2/4] Fetching packages...
33warning np@6.3.0: The engine "git" appears to be invalid.
34[3/4] Linking dependencies...
35warning " > expo-apple-authentication@2.0.0" has unmet peer dependency "@unimodules/core@~3.0.0".
36warning " > expo-apple-authentication@2.0.0" has unmet peer dependency "@unimodules/react-native-adapter@~3.0.0".
37warning " > react-native-branch@4.0.0" has incorrect peer dependency "react-native@^0.60.0".
38warning " > react-native-config@1.4.1" has unmet peer dependency "react-native-windows@>=0.61".
39warning " > react-native-country-picker-modal@1.10.0" has unmet peer dependency "react-dom@*".
40warning " > react-native-country-picker-modal@1.10.0" has unmet peer dependency "react-native-web@*".
41warning "react-native-country-picker-modal > modal-react-native-web@0.2.0" has unmet peer dependency "react-art@16.x.x".
42warning "react-native-country-picker-modal > modal-react-native-web@0.2.0" has unmet peer dependency "react-dom@16.x.x".
43warning "react-native-country-picker-modal > modal-react-native-web@0.2.0" has unmet peer dependency "react-native-web@0.9.x".
44warning " > swr@0.2.3" has incorrect peer dependency "react@^16.11.0".
45warning "eslint-config-react-native-wcandillon > eslint-config-airbnb@18.1.0" has incorrect peer dependency "eslint@^5.16.0 || ^6.8.0".
46warning "eslint-config-react-native-wcandillon > eslint-config-airbnb > eslint-config-airbnb-base@14.1.0" has incorrect peer dependency "eslint@^5.16.0 || ^6.8.0".
47[4/4] Building fresh packages...
48Done in 35.71s.
49$ cd ios/
50$ rbenv global 2.7.2
51$ bundle install
52Fetching gem metadata from https://rubygems.org/.........
53Fetching gem metadata from https://rubygems.org/.
54Resolving dependencies...
55Fetching rake 13.0.1
56Installing rake 13.0.1
57Fetching CFPropertyList 3.0.2
58Installing CFPropertyList 3.0.2
59Fetching concurrent-ruby 1.1.7
60Installing concurrent-ruby 1.1.7
61Fetching i18n 1.8.5
62Installing i18n 1.8.5
63Fetching minitest 5.14.2
64Installing minitest 5.14.2
65Fetching thread_safe 0.3.6
66Installing thread_safe 0.3.6
67Fetching tzinfo 1.2.8
68Installing tzinfo 1.2.8
69Fetching activesupport 5.2.4.4
70Installing activesupport 5.2.4.4
71Fetching public_suffix 4.0.6
72Installing public_suffix 4.0.6
73Fetching addressable 2.7.0
74Installing addressable 2.7.0
75Fetching httpclient 2.8.3
76Installing httpclient 2.8.3
77Fetching json 2.3.1
78Installing json 2.3.1 with native extensions
79Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
80current directory:
81/ [some-path-to-project]/ios/vendor/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/generator
82/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
83/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
84./siteconf20201125-75046-qmfmhb.rb extconf.rb
85creating Makefile
86current directory:
87 [some-path-to-project]/ios/vendor/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/generator
88make "DESTDIR=" clean
89current directory:
90/ [some-path-to-project]/ios/vendor/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/generator
91make "DESTDIR="
92compiling generator.c
93In file included from generator.c:1:
94In file included from ./../fbuffer/fbuffer.h:5:
95In file included from
96/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33:
97/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10:
98fatal error: 'ruby/config.h' file not found
99#include "ruby/config.h"
100 ^~~~~~~~~~~~~~~
101/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10:
102note: did not find header 'config.h' in framework 'ruby' (loaded from
103'/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks')
1041 error generated.
105make: *** [generator.o] Error 1
106make failed, exit code 2
107Gem files will remain installed in
108/[some-path-to-project]/ios/vendor/ruby/2.6.0/gems/json-2.3.1
109for inspection.
110Results logged to
111/[some-path-to-project]/ios/vendor/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/json-2.3.1/gem_make.out
112An error occurred while installing json (2.3.1), and Bundler cannot continue.
113Make sure that `gem install json -v '2.3.1' --source 'https://rubygems.org/'`
114succeeds before bundling.
115In Gemfile:
116 cocoapods was resolved to 1.10.0, which depends on
117 cocoapods-core was resolved to 1.10.0, which depends on
118 algoliasearch was resolved to 1.27.5, which depends on
119 json
121
Cleaning up file based variables
00:00
123ERROR: Job failed: exit status 1